Home > @neo4j-cypher/codemirror
Adds support for the cypher query language to Codemirror version 6
This package provides a factory function for constructing an EditorApi instance which wraps a Codemirror 6 instance with cypher language capabilities.
Function | Description |
---|---|
createCypherEditor(parentDOMElement, options) | This function creates a codemirror cypher editor instance |
This function creates a codemirror cypher editor instance
Signature:
export declare function createCypherEditor(
parentDOMElement: Element | DocumentFragment,
options: EditorOptions
): EditorApi;
Parameter | Type | Description |
---|---|---|
parentDOMElement | Element | DocumentFragment | the parent dom element to attach the editor to |
options | EditorOptions | the options for the created editor |
Returns:
An editor api that wraps the created editor instance
Call Signature | Description |
---|---|
AutocompleteChangedListener | Listener for editor autocomplete changes |
EditorCreatedListener | Listener for editor creation |
FocusChangedListener | Listener for editor focus changes |
KeyListener | Listener for editor key events |
LineNumberClickListener | Listener for editor line number click events |
LineNumberFormatter | Formats a line number for display beside the editor text |
PositionChangedListener | Listener for editor cursor position changes |
ScrollChangedListener | Listener for editor scroll position changes |
SearchChangedListener | Listener for editor search changes |
SelectionChangedListener | Listener for editor text selection changes |
ValueChangedListener | Listener for editor value changes |
Listener for editor autocomplete changes
Signature:
export interface AutocompleteChangedListener {
(
open: boolean,
options?: AutocompleteOption[],
option?: AutocompleteOption
): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
open | boolean | whether the autocomplete panel is open or not |
options | AutocompleteOption[] | (Optional) the list of autocomplete options being suggested to the user |
option | AutocompleteOption | (Optional) the autocomplete option selected by the user |
Returns:
void
Listener for editor creation
Signature:
export interface EditorCreatedListener {
(editor: EditorApi): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
editor | EditorApi | The created editor api instance |
Returns:
void
Listener for editor focus changes
Signature:
export interface FocusChangedListener {
(focused: boolean): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
focused | boolean | whether the editor was focused or not |
Returns:
void
Listener for editor key events
Signature:
export interface KeyListener {
(event: KeyboardEvent): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
event | KeyboardEvent | the native keyboard event |
Returns:
void
Listener for editor line number click events
Signature:
export interface LineNumberClickListener {
(lineNumber: number, event: Event): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
lineNumber | number | the 1 based line number that was clicked |
event | Event | the native event |
Returns:
void
Formats a line number for display beside the editor text
Signature:
export interface LineNumberFormatter {
(lineNumber: number, lineCount: number): string;
}
Parameters:
Parameter | Type | Description |
---|---|---|
lineNumber | number | the current line number |
lineCount | number | the number of lines in the editor text |
Returns:
string
Listener for editor cursor position changes
Signature:
export interface PositionChangedListener {
(position: PositionObject): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
position | PositionObject | the new editor cursor position |
Returns:
void
Listener for editor scroll position changes
Signature:
export interface ScrollChangedListener {
(scrollInfo: ScrollInfo): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
scrollInfo | ScrollInfo | the new editor scroll position info |
Returns:
void
Listener for editor search changes
The matches
argument value is controlled via the searchMatches option
Signature:
export interface SearchChangedListener {
(open: boolean, text?: string, matches?: SearchMatch[]): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
open | boolean | whether the search panel is open or not |
text | string | (Optional) the current search text of the search panel |
matches | SearchMatch[] | (Optional) the search matches for the current search text |
Returns:
void
Listener for editor text selection changes
Signature:
export interface SelectionChangedListener {
(selection: EditorSelection): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
selection | EditorSelection | the new editor text selection |
Returns:
void
Listener for editor value changes
Signature:
export interface ValueChangedListener {
(value: string, changes: ChangeSet): void;
}
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | the new cypher query text value |
changes | ChangeSet | the codemirror 6 ChangeSet object representing what changed |
Returns:
void
Interface | Description |
---|---|
AutocompleteOption | Information about an autocomplete option that was suggested to the user |
EditorApi | This is the EditorApi interface which wraps all of the interaction with the cypher editor |
EditorOptions | These are the options for the createCypherEditor function |
PartialPositionObject | Partial editor cursor position with line & column only |
PositionObject | Full editor cursor position with line, column & position |
ScrollInfo | Information about the editor scroll position |
SearchMatch | Information about a search match that was shown to the user |
Information about an autocomplete option that was suggested to the user
Signature:
export interface AutocompleteOption
Property | Type | Description |
---|---|---|
detail? | string | (Optional) More detailed information about the autocomplete option |
from | number | The position in the editor text where the autocompletion option will be inserted |
label | string | The label of the autocomplete option in the list of options |
type? | CompletionType | (Optional) The type of the autocomplete option |
More detailed information about the autocomplete option
Signature:
detail?: string;
The position in the editor text where the autocompletion option will be inserted
Signature:
from: number;
The label of the autocomplete option in the list of options
Signature:
label: string;
The type of the autocomplete option
Signature:
type?: CompletionType;
This is the EditorApi interface which wraps all of the interaction with the cypher editor
Signature:
export interface EditorApi
An instance of this interface is returned by the createCypherEditor function
Property | Type | Description |
---|---|---|
codemirror | EditorView | The codemirror 6 view instance representing the cypher editor |
editorSupport | CypherEditorSupport | The editor support instance used internally by the editor |
The codemirror 6 view instance representing the cypher editor
Signature:
codemirror: EditorView;
The editor support instance used internally by the editor
Signature:
editorSupport: CypherEditorSupport;
Method | Description |
---|---|
clearHistory() | Clears the undo/redo history of the editor |
destroy() | Cleanup function that can be used to safely dispose of the editor |
focus() | Brings the browser focus to the editor |
getLineCount() | Get the number of lines in the current editor value |
getPosition() | Get the current editor cursor position |
getPositionForValue(positionValue) | Get a full position object for any supported position value or null if position value is invalid |
getSelection() | Get the current editor text selection |
offAutocompleteChanged(listener) | Remove an event listener for editor autocomplete changes |
offFocusChanged(listener) | Remove an event listener for editor focus changes |
offKeyDown(listener) | Remove an event listener for editor key down events |
offKeyUp(listener) | Remove an event listener for editor key up events |
offLineNumberClick(listener) | Remove an event listener for editor line number click events |
offPositionChanged(listener) | Remove an event listener for editor curosor position changes |
offScrollChanged(listener) | Remove an event listener for editor scroll position changes |
offSearchChanged(listener) | Remove an event listener for editor search changes |
offSelectionChanged(listener) | Remove an event listener for editor text selection changes |
offValueChanged(listener) | Remove an event listener for editor value changes |
onAutocompleteChanged(listener) | Add an event listener for editor autocomplete changes |
onFocusChanged(listener) | Add an event listener for editor focus changes |
onKeyDown(listener) | Add an event listener for editor key down events |
onKeyUp(listener) | Add an event listener for editor key up events |
onLineNumberClick(listener) | Add an event listener for editor line number click events |
onPositionChanged(listener) | Add an event listener for editor cursor position changes |
onScrollChanged(listener) | Add an event listener for editor scroll position changes |
onSearchChanged(listener) | Add an event listener for editor search changes |
onSelectionChanged(listener) | Add an event listener for editor text selection changes |
onValueChanged(listener) | Add an event listener for editor value changes |
selectAutocompleteOption(autocompleteOptionIndex) | Select the autocomplete option with the given index, causing it to be applied to the editor value |
setAutocomplete(autocomplete) | Set whether or not the autocomplete feature is enabled |
setAutocompleteCloseOnBlur(autocompleteCloseOnBlur) | Set whether or not the autocomplete auto closes whenever the editor loses focus |
setAutocompleteOpen(autocompleteOpen) | Set whether or not the autocomplete panel is shown to the user |
setAutocompleteTriggerStrings(autocompleteTriggerStrings) | Set the keys that when typed will automatically open the autocomplete menu |
setBracketMatching(bracketMatching) | Set whether to show matching brackets in the editor view |
setCloseBrackets(closeBrackets) | Set whether to automatically close brackets or wrap selected text with quotes on quote press |
setCursorWide(cursorWide) | Set whether the wide cursor should be shown |
setCypherLanguage(cypherLanguage) | Set whether or not cypher language extensions are enabled |
setHistory(history) | Set whether or not the editor maintains an undo/redo history |
setIndentUnit(indentUnit) | Set the indent text to use when tabKey is enabled |
setLineNumberFormatter(lineNumberFormatter) | Set the formatter for the line numbers of the editor |
setLineNumbers(lineNumbers) | Set whether or not line numbers are shown to the left of the editor ui |
setLineWrapping(lineWrapping) | Set whether or not the editor wraps lines vs using a horizontal scrollbar |
setLint(lint) | Set whether or not the editor should display lint errors to the user |
setPlaceholder(placeholder) | Set the text to be shown to the user when the editor value is empty |
setPosition(position, scrollIntoView) | Set the current editor cursor position |
setPostExtensions(preExtensions) | Set the codemirror 6 extensions that should be added to the editor after the cypher language support extensions |
setPreExtensions(preExtensions) | Set the codemirror 6 extensions that should be added to the editor before the cypher language support extensions |
setReadOnly(readOnly) | Set whether the editor is read only or the user can edit the editor's value |
setReadOnlyCursor(readOnlyCursor) | Set whether to show the cursor when the editor readOnly is true |
setSchema(schema) | Set the schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database |
setSearch(search) | Set whether search is enabled |
setSearchMatches(searchMatches) | Set the max number of search matches to be included with search changed callbacks |
setSearchOpen(searchOpen) | Set whether or not the search panel is shown to the user |
setSearchText(searchText) | Set the search text value in the search panel |
setSearchTop(searchTop) | Set whether search is appears at the top of the editor window |
setSelection(selection, scrollIntoView) | Set the text selection for the editor |
setTabKey(tabKey) | Set whether the tab key is enabled |
setTheme(theme) | Set whether to use the light or dark theme for the editor |
setTooltipAbsolute(tooltipAbsolute) | Set whether or not the tooltips use simple absolute position styling (vs fixed and trying to stay within bounds) |
setValue(value, parseOnSetValue) | Set the editor value |
Clears the undo/redo history of the editor
Signature:
clearHistory(): void;
Returns:
void
Cleanup function that can be used to safely dispose of the editor
Signature:
destroy(): void;
Returns:
void
Brings the browser focus to the editor
Signature:
focus(): void;
Returns:
void
Get the number of lines in the current editor value
Signature:
getLineCount(): number;
Returns:
number
Get the current editor cursor position
Signature:
getPosition(): PositionObject;
Returns:
Get a full position object for any supported position value or null if position value is invalid
Signature:
getPositionForValue(positionValue: PositionAny): PositionObject | null;
Parameters:
Parameter | Type |
---|---|
positionValue | PositionAny |
Returns:
PositionObject | null
Get the current editor text selection
Signature:
getSelection(): EditorSelection;
Returns:
EditorSelection
Remove an event listener for editor autocomplete changes
Signature:
offAutocompleteChanged(listener: AutocompleteChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | AutocompleteChangedListener |
Returns:
void
Remove an event listener for editor focus changes
Signature:
offFocusChanged(listener: FocusChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | FocusChangedListener |
Returns:
void
Remove an event listener for editor key down events
Signature:
offKeyDown(listener: KeyListener): void;
Parameters:
Parameter | Type |
---|---|
listener | KeyListener |
Returns:
void
Remove an event listener for editor key up events
Signature:
offKeyUp(listener: KeyListener): void;
Parameters:
Parameter | Type |
---|---|
listener | KeyListener |
Returns:
void
Remove an event listener for editor line number click events
Signature:
offLineNumberClick(listener: LineNumberClickListener): void;
Parameters:
Parameter | Type |
---|---|
listener | LineNumberClickListener |
Returns:
void
Remove an event listener for editor curosor position changes
Signature:
offPositionChanged(listener: PositionChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | PositionChangedListener |
Returns:
void
Remove an event listener for editor scroll position changes
Signature:
offScrollChanged(listener: ScrollChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | ScrollChangedListener |
Returns:
void
Remove an event listener for editor search changes
Signature:
offSearchChanged(listener: SearchChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | SearchChangedListener |
Returns:
void
Remove an event listener for editor text selection changes
Signature:
offSelectionChanged(listener: SelectionChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | SelectionChangedListener |
Returns:
void
Remove an event listener for editor value changes
Signature:
offValueChanged(listener: ValueChangedListener): void;
Parameters:
Parameter | Type |
---|---|
listener | ValueChangedListener |
Returns:
void
Add an event listener for editor autocomplete changes
Signature:
onAutocompleteChanged(listener: AutocompleteChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | AutocompleteChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor focus changes
Signature:
onFocusChanged(listener: FocusChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | FocusChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor key down events
Signature:
onKeyDown(listener: KeyListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | KeyListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor key up events
Signature:
onKeyUp(listener: KeyListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | KeyListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor line number click events
Signature:
onLineNumberClick(listener: LineNumberClickListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | LineNumberClickListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor cursor position changes
Signature:
onPositionChanged(listener: PositionChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | PositionChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor scroll position changes
Signature:
onScrollChanged(listener: ScrollChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | ScrollChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor search changes
Signature:
onSearchChanged(listener: SearchChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | SearchChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor text selection changes
Signature:
onSelectionChanged(listener: SelectionChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | SelectionChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Add an event listener for editor value changes
Signature:
onValueChanged(listener: ValueChangedListener): () => void;
Parameters:
Parameter | Type |
---|---|
listener | ValueChangedListener |
Returns:
() => void
A cleanup function that when called removes the listener
Select the autocomplete option with the given index, causing it to be applied to the editor value
Signature:
selectAutocompleteOption(autocompleteOptionIndex: number): void;
Parameters:
Parameter | Type |
---|---|
autocompleteOptionIndex | number |
Returns:
void
Set whether or not the autocomplete feature is enabled
Signature:
setAutocomplete(autocomplete?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
autocomplete | boolean | (Optional) |
Returns:
void
Set whether or not the autocomplete auto closes whenever the editor loses focus
Signature:
setAutocompleteCloseOnBlur(autocompleteCloseOnBlur?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
autocompleteCloseOnBlur | boolean | (Optional) |
Returns:
void
Set whether or not the autocomplete panel is shown to the user
Signature:
setAutocompleteOpen(autocompleteOpen?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
autocompleteOpen | boolean | (Optional) |
Returns:
void
Set the keys that when typed will automatically open the autocomplete menu
Signature:
setAutocompleteTriggerStrings(autocompleteTriggerStrings?: string[]): void;
Parameters:
Parameter | Type | Description |
---|---|---|
autocompleteTriggerStrings | string[] | (Optional) |
Returns:
void
Set whether to show matching brackets in the editor view
Signature:
setBracketMatching(bracketMatching?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
bracketMatching | boolean | (Optional) |
Returns:
void
Set whether to automatically close brackets or wrap selected text with quotes on quote press
Signature:
setCloseBrackets(closeBrackets?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
closeBrackets | boolean | (Optional) |
Returns:
void
Set whether the wide cursor should be shown
Signature:
setCursorWide(cursorWide?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
cursorWide | boolean | (Optional) |
Returns:
void
Set whether or not cypher language extensions are enabled
Signature:
setCypherLanguage(cypherLanguage?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
cypherLanguage | boolean | (Optional) |
Returns:
void
Set whether or not the editor maintains an undo/redo history
Signature:
setHistory(history?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
history | boolean | (Optional) |
Returns:
void
Set the indent text to use when tabKey is enabled
Signature:
setIndentUnit(indentUnit?: string): void;
Parameters:
Parameter | Type | Description |
---|---|---|
indentUnit | string | (Optional) |
Returns:
void
Set the formatter for the line numbers of the editor
Signature:
setLineNumberFormatter(
lineNumberFormatter?: (lineNumber: number, lineCount: number) => string
): void;
Parameters:
Parameter | Type | Description |
---|---|---|
lineNumberFormatter | (lineNumber: number, lineCount: number) => string | (Optional) |
Returns:
void
Set whether or not line numbers are shown to the left of the editor ui
Signature:
setLineNumbers(lineNumbers?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
lineNumbers | boolean | (Optional) |
Returns:
void
Set whether or not the editor wraps lines vs using a horizontal scrollbar
Signature:
setLineWrapping(lineWrapping?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
lineWrapping | boolean | (Optional) |
Returns:
void
Set whether or not the editor should display lint errors to the user
Signature:
setLint(lint?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
lint | boolean | (Optional) |
Returns:
void
Set the text to be shown to the user when the editor value is empty
Signature:
setPlaceholder(placeholder?: string | undefined): void;
Parameters:
Parameter | Type | Description |
---|---|---|
placeholder | string | undefined | (Optional) |
Returns:
void
Set the current editor cursor position
Signature:
setPosition(position?: PositionAny, scrollIntoView?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
position | PositionAny | (Optional) The new cursor position (position, { line, column }, { position, line, column }) |
scrollIntoView | boolean | (Optional) Whether to scroll the editor to the new cursor position (defaults to true) |
Returns:
void
Set the codemirror 6 extensions that should be added to the editor after the cypher language support extensions
Signature:
setPostExtensions(preExtensions?: Extension[]): void;
Parameters:
Parameter | Type | Description |
---|---|---|
preExtensions | Extension[] | (Optional) |
Returns:
void
Set the codemirror 6 extensions that should be added to the editor before the cypher language support extensions
Signature:
setPreExtensions(preExtensions?: Extension[]): void;
Parameters:
Parameter | Type | Description |
---|---|---|
preExtensions | Extension[] | (Optional) |
Returns:
void
Set whether the editor is read only or the user can edit the editor's value
Signature:
setReadOnly(readOnly?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
readOnly | boolean | (Optional) |
Returns:
void
Set whether to show the cursor when the editor readOnly is true
Signature:
setReadOnlyCursor(readOnlyCursor?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
readOnlyCursor | boolean | (Optional) |
Returns:
void
Set the schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database
Signature:
setSchema(schema?: EditorSupportSchema): void;
Parameters:
Parameter | Type | Description |
---|---|---|
schema | EditorSupportSchema | (Optional) |
Returns:
void
Set whether search is enabled
Signature:
setSearch(search?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
search | boolean | (Optional) |
Returns:
void
Set the max number of search matches to be included with search changed callbacks
Signature:
setSearchMatches(searchMatches?: number): void;
Parameters:
Parameter | Type | Description |
---|---|---|
searchMatches | number | (Optional) |
Returns:
void
Set whether or not the search panel is shown to the user
Signature:
setSearchOpen(searchOpen?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
searchOpen | boolean | (Optional) |
Returns:
void
Set the search text value in the search panel
Signature:
setSearchText(searchText?: string): void;
Parameters:
Parameter | Type | Description |
---|---|---|
searchText | string | (Optional) |
Returns:
void
Set whether search is appears at the top of the editor window
Signature:
setSearchTop(searchTop?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
searchTop | boolean | (Optional) |
Returns:
void
Set the text selection for the editor
Signature:
setSelection(selection?: EditorSelection, scrollIntoView?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
selection | EditorSelection | (Optional) The new editor selection |
scrollIntoView | boolean | (Optional) Whether to scroll the editor to the new selection (defaults to true) |
Returns:
void
Set whether the tab key is enabled
Signature:
setTabKey(tabKey?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
tabKey | boolean | (Optional) |
Returns:
void
Set whether to use the light or dark theme for the editor
Signature:
setTheme(theme?: Theme): void;
Parameters:
Parameter | Type | Description |
---|---|---|
theme | Theme | (Optional) |
Returns:
void
Set whether or not the tooltips use simple absolute position styling (vs fixed and trying to stay within bounds)
Signature:
setTooltipAbsolute(tooltipAbsolute?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
tooltipAbsolute | boolean | (Optional) |
Returns:
void
Set the editor value
Signature:
setValue(value?: string, parseOnSetValue?: boolean): void;
Parameters:
Parameter | Type | Description |
---|---|---|
value | string | (Optional) The new editor value |
parseOnSetValue | boolean | (Optional) Whether to update the language parser tree immediately for the new value (defaults to true) |
Returns:
void
These are the options for the createCypherEditor function
Signature:
export interface EditorOptions
Property | Type | Default | Description |
---|---|---|---|
autocomplete? | boolean | true | (Optional) Whether the autocomplete feature is enabled |
autocompleteCloseOnBlur? | boolean | true | (Optional) Whether the autocomplete auto closes whenever the editor loses focus |
autocompleteOpen? | boolean | false | (Optional) Whether the autocomplete panel is initially shown to the user |
autocompleteTriggerStrings? | string[] | [".",":","[]","()","{}","[","(","{","$"] | (Optional) The keys that when typed will automatically open the autocomplete menu |
autofocus? | boolean | true | (Optional) Whether the editor should be auto focused on first creation |
bracketMatching? | boolean | true | (Optional) Whether to show matching brackets in the editor view |
closeBrackets? | boolean | true | (Optional) Whether to automatically close brackets or wrap selected text with quotes on quote press |
cursorWide? | boolean | true | (Optional) Whether the wide cursor should be shown |
cypherLanguage? | boolean | true | (Optional) Whether or not cypher language extensions are enabled |
history? | boolean | true | (Optional) Whether the editor maintains an undo/redo history |
indentUnit? | string | " " | (Optional) The indent text to use when tabKey is enabled |
lineNumberFormatter? | LineNumberFormatter | (line, lineCount) => lineCount === 1 ? "$" : line + ""; | (Optional) The formatter for the line numbers of the editor |
lineNumbers? | boolean | true | (Optional) Whether line numbers are shown to the left of the editor ui |
lineWrapping? | boolean | false | (Optional) Whether the editor wraps lines vs using a horizontal scrollbar |
lint? | boolean | false | (Optional) Whether the editor should display lint errors to the user |
parseOnSetValue? | boolean | true | (Optional) Whether to run the cypher language parser immediately after every call to set the value |
placeholder? | string | undefined | (Optional) The text to be shown to the user when the editor value is empty |
position? | PositionAny | undefined | (Optional) The initial editor cursor position |
postExtensions? | Extension[] | [] | (Optional) The codemirror 6 extensions that should be added to the editor after the cypher language support extensions. |
preExtensions? | Extension[] | [] | (Optional) The codemirror 6 extensions that should be added to the editor before the cypher language support extensions. |
readOnly? | boolean | false | (Optional) Whether the editor is read only or the user can edit the editor's value |
readOnlyCursor? | boolean | false | (Optional) Whether to show the cursor when the editor readOnly is true |
schema? | EditorSupportSchema | undefined | (Optional) The schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database |
search? | boolean | true | (Optional) Whether search is enabled |
searchMatches? | number | 0 | (Optional) The max number of search matches to be included with search changed callbacks |
searchOpen? | boolean | false | (Optional) Whether the search panel is initially shown to the user |
searchText? | string | "" | (Optional) The initial search text for the search panel |
searchTop? | boolean | false | (Optional) Whether search is shown at the top of the editor window |
selection? | EditorSelection | undefined | (Optional) The initial editor text selection |
tabKey? | boolean | true | (Optional) Whether the tab key is enabled |
theme? | Theme | "light" | (Optional) Whether to use the light or dark theme for the editor |
tooltipAbsolute? | boolean | true | (Optional) Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds) |
value? | string | "" | (Optional) The initial editor value |
Whether the autocomplete feature is enabled
Signature:
autocomplete?: boolean;
Default Value:
true
Whether the autocomplete auto closes whenever the editor loses focus
Signature:
autocompleteCloseOnBlur?: boolean;
Default Value:
true
Whether the autocomplete panel is initially shown to the user
Signature:
autocompleteOpen?: boolean;
Default Value:
false
The keys that when typed will automatically open the autocomplete menu
Signature:
autocompleteTriggerStrings?: string[];
Default Value:
[".",":","[]","()","{}","[","(","{","$"]
Whether the editor should be auto focused on first creation
Signature:
autofocus?: boolean;
Default Value:
true
Whether to show matching brackets in the editor view
Signature:
bracketMatching?: boolean;
Default Value:
true
Whether to automatically close brackets or wrap selected text with quotes on quote press
Signature:
closeBrackets?: boolean;
Default Value:
true
Whether the wide cursor should be shown
Signature:
cursorWide?: boolean;
Default Value:
true
Whether or not cypher language extensions are enabled
Signature:
cypherLanguage?: boolean;
Default Value:
true
Whether the editor maintains an undo/redo history
Signature:
history?: boolean;
Default Value:
true
The indent text to use when tabKey is enabled
Signature:
indentUnit?: string;
Default Value:
" "
The formatter for the line numbers of the editor
Signature:
lineNumberFormatter?: LineNumberFormatter;
Default Value:
(line, lineCount) => lineCount === 1 ? "$" : line + "";
Whether line numbers are shown to the left of the editor ui
Signature:
lineNumbers?: boolean;
Default Value:
true
Whether the editor wraps lines vs using a horizontal scrollbar
Signature:
lineWrapping?: boolean;
Default Value:
false
Whether the editor should display lint errors to the user
Signature:
lint?: boolean;
Default Value:
false
Whether to run the cypher language parser immediately after every call to set the value
Signature:
parseOnSetValue?: boolean;
Default Value:
true
The text to be shown to the user when the editor value is empty
Signature:
placeholder?: string;
Default Value:
undefined
The initial editor cursor position
Signature:
position?: PositionAny;
Default Value:
undefined
The codemirror 6 extensions that should be added to the editor after the cypher language support extensions.
Signature:
postExtensions?: Extension[];
Default Value:
[]
The codemirror 6 extensions that should be added to the editor before the cypher language support extensions.
Signature:
preExtensions?: Extension[];
Default Value:
[]
Whether the editor is read only or the user can edit the editor's value
Signature:
readOnly?: boolean;
Default Value:
false
Whether to show the cursor when the editor readOnly is true
Signature:
readOnlyCursor?: boolean;
Default Value:
false
The schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database
Signature:
schema?: EditorSupportSchema;
Default Value:
undefined
Whether search is enabled
Signature:
search?: boolean;
Default Value:
true
The max number of search matches to be included with search changed callbacks
Signature:
searchMatches?: number;
Remarks:
Must be between 0 and 1000, 0 means no searching for matches (better for performance)
Default Value:
0
Whether the search panel is initially shown to the user
Signature:
searchOpen?: boolean;
Default Value:
false
The initial search text for the search panel
Signature:
searchText?: string;
Default Value:
""
Whether search is shown at the top of the editor window
Signature:
searchTop?: boolean;
Default Value:
false
The initial editor text selection
Signature:
selection?: EditorSelection;
Default Value:
undefined
Whether the tab key is enabled
Signature:
tabKey?: boolean;
Default Value:
true
Whether to use the light or dark theme for the editor
Signature:
theme?: Theme;
Default Value:
"light"
Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds)
Signature:
tooltipAbsolute?: boolean;
Default Value:
true
The initial editor value
Signature:
value?: string;
Default Value:
""
Partial editor cursor position with line & column only
Signature:
export interface PartialPositionObject
Property | Type | Description |
---|---|---|
column | number | The 1 based column number of the cursor position |
line | number | The 1 based line number of the cursor position |
The 1 based column number of the cursor position
Signature:
column: number;
The 1 based line number of the cursor position
Signature:
line: number;
Full editor cursor position with line, column & position
Signature:
export interface PositionObject
Property | Type | Description |
---|---|---|
column | number | The 1 based column number of the cursor position |
line | number | The 1 based line number of the cursor position |
position | number | The 0 based absolute position number of the cursor position |
The 1 based column number of the cursor position
Signature:
column: number;
The 1 based line number of the cursor position
Signature:
line: number;
The 0 based absolute position number of the cursor position
Signature:
position: number;
Information about the editor scroll position
Signature:
export interface ScrollInfo
Property | Type | Description |
---|---|---|
clientHeight | number | The clientHeight position of the editor scroll dom element |
clientWidth | number | The clientWidth position of the editor scroll dom element |
scrollHeight | number | The scrollHeight position of the editor scroll dom element |
scrollLeft | number | The scrollLeft position of the editor scroll dom element |
scrollTop | number | The scrollTop position of the editor scroll dom element |
scrollWidth | number | The scrollWidth position of the editor scroll dom element |
The clientHeight position of the editor scroll dom element
Signature:
clientHeight: number;
The clientWidth position of the editor scroll dom element
Signature:
clientWidth: number;
The scrollHeight position of the editor scroll dom element
Signature:
scrollHeight: number;
The scrollLeft position of the editor scroll dom element
Signature:
scrollLeft: number;
The scrollTop position of the editor scroll dom element
Signature:
scrollTop: number;
The scrollWidth position of the editor scroll dom element
Signature:
scrollWidth: number;
Information about a search match that was shown to the user
Signature:
export interface SearchMatch
Property | Type | Description |
---|---|---|
from | number | The position in the editor text where the search match starts |
to | number | The position in the editor text where the search match ends |
The position in the editor text where the search match starts
Signature:
from: number;
The position in the editor text where the search match ends
Signature:
to: number;
Type Alias | Description |
---|---|
AutofocusProp | The prop keys that can be used with autofocusProps |
ClearHistoryProps | The prop keys that can be used with clearHistoryProps |
PositionAny | Any supported editor cursor position |
Theme | The current editor theme |
The prop keys that can be used with autofocusProps
Signature:
export type AutofocusProp = "cursorWide" | "position" | "readOnly" | "value";
The prop keys that can be used with clearHistoryProps
Signature:
export type ClearHistoryProps =
| "cursorWide"
| "position"
| "readOnly"
| "value";
Any supported editor cursor position
Signature:
export type PositionAny = PositionObject | PartialPositionObject | number;
References: PositionObject, PartialPositionObject
The current editor theme
Signature:
export type Theme = "light" | "dark" | "auto";