Skip to content

Files

Latest commit

26a3610 · Mar 13, 2023

History

History
2900 lines (1797 loc) · 63.8 KB

neo4j-cypher_codemirror.md

File metadata and controls

2900 lines (1797 loc) · 63.8 KB

Home > @neo4j-cypher/codemirror

codemirror package

Adds support for the cypher query language to Codemirror version 6

Remarks:

This package provides a factory function for constructing an EditorApi instance which wraps a Codemirror 6 instance with cypher language capabilities.



Functions:

Function Description
createCypherEditor(parentDOMElement, options) This function creates a codemirror cypher editor instance

createCypherEditor() function

This function creates a codemirror cypher editor instance

Signature:

export declare function createCypherEditor(
  parentDOMElement: Element | DocumentFragment,
  options: EditorOptions
): EditorApi;

Parameters:

Parameter Type Description
parentDOMElement Element | DocumentFragment the parent dom element to attach the editor to
options EditorOptions the options for the created editor

Returns:

EditorApi

An editor api that wraps the created editor instance



Call Signatures:

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

AutocompleteChangedListener call signature

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


EditorCreatedListener call signature

Listener for editor creation

Signature:

export interface EditorCreatedListener {
  (editor: EditorApi): void;
}

Parameters:

Parameter Type Description
editor EditorApi The created editor api instance

Returns:

void


FocusChangedListener call signature

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


KeyListener call signature

Listener for editor key events

Signature:

export interface KeyListener {
  (event: KeyboardEvent): void;
}

Parameters:

Parameter Type Description
event KeyboardEvent the native keyboard event

Returns:

void


LineNumberClickListener call signature

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


LineNumberFormatter call signature

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


PositionChangedListener call signature

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


ScrollChangedListener call signature

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


SearchChangedListener call signature

Listener for editor search changes

Remarks:

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


SelectionChangedListener call signature

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


ValueChangedListener call signature

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



Interfaces:

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

AutocompleteOption interface

Information about an autocomplete option that was suggested to the user

Signature:

export interface AutocompleteOption 

Properties:

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

AutocompleteOption.detail property

More detailed information about the autocomplete option

Signature:

detail?: string;

AutocompleteOption.from property

The position in the editor text where the autocompletion option will be inserted

Signature:

from: number;

AutocompleteOption.label property

The label of the autocomplete option in the list of options

Signature:

label: string;

AutocompleteOption.type property

The type of the autocomplete option

Signature:

type?: CompletionType;

EditorApi interface

This is the EditorApi interface which wraps all of the interaction with the cypher editor

Signature:

export interface EditorApi 

Remarks:

An instance of this interface is returned by the createCypherEditor function


Properties:

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

EditorApi.codemirror property

The codemirror 6 view instance representing the cypher editor

Signature:

codemirror: EditorView;

EditorApi.editorSupport property

The editor support instance used internally by the editor

Signature:

editorSupport: CypherEditorSupport;

Methods:

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

EditorApi.clearHistory() method

Clears the undo/redo history of the editor

Signature:

clearHistory(): void;

Returns:

void


EditorApi.destroy() method

Cleanup function that can be used to safely dispose of the editor

Signature:

destroy(): void;

Returns:

void


EditorApi.focus() method

Brings the browser focus to the editor

Signature:

focus(): void;

Returns:

void


EditorApi.getLineCount() method

Get the number of lines in the current editor value

Signature:

getLineCount(): number;

Returns:

number


EditorApi.getPosition() method

Get the current editor cursor position

Signature:

getPosition(): PositionObject;

Returns:

PositionObject


EditorApi.getPositionForValue() method

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


EditorApi.getSelection() method

Get the current editor text selection

Signature:

getSelection(): EditorSelection;

Returns:

EditorSelection


EditorApi.offAutocompleteChanged() method

Remove an event listener for editor autocomplete changes

Signature:

offAutocompleteChanged(listener: AutocompleteChangedListener): void;

Parameters:

Parameter Type
listener AutocompleteChangedListener

Returns:

void


EditorApi.offFocusChanged() method

Remove an event listener for editor focus changes

Signature:

offFocusChanged(listener: FocusChangedListener): void;

Parameters:

Parameter Type
listener FocusChangedListener

Returns:

void


EditorApi.offKeyDown() method

Remove an event listener for editor key down events

Signature:

offKeyDown(listener: KeyListener): void;

Parameters:

Parameter Type
listener KeyListener

Returns:

void


EditorApi.offKeyUp() method

Remove an event listener for editor key up events

Signature:

offKeyUp(listener: KeyListener): void;

Parameters:

Parameter Type
listener KeyListener

Returns:

void


EditorApi.offLineNumberClick() method

Remove an event listener for editor line number click events

Signature:

offLineNumberClick(listener: LineNumberClickListener): void;

Parameters:

Parameter Type
listener LineNumberClickListener

Returns:

void


EditorApi.offPositionChanged() method

Remove an event listener for editor curosor position changes

Signature:

offPositionChanged(listener: PositionChangedListener): void;

Parameters:

Parameter Type
listener PositionChangedListener

Returns:

void


EditorApi.offScrollChanged() method

Remove an event listener for editor scroll position changes

Signature:

offScrollChanged(listener: ScrollChangedListener): void;

Parameters:

Parameter Type
listener ScrollChangedListener

Returns:

void


EditorApi.offSearchChanged() method

Remove an event listener for editor search changes

Signature:

offSearchChanged(listener: SearchChangedListener): void;

Parameters:

Parameter Type
listener SearchChangedListener

Returns:

void


EditorApi.offSelectionChanged() method

Remove an event listener for editor text selection changes

Signature:

offSelectionChanged(listener: SelectionChangedListener): void;

Parameters:

Parameter Type
listener SelectionChangedListener

Returns:

void


EditorApi.offValueChanged() method

Remove an event listener for editor value changes

Signature:

offValueChanged(listener: ValueChangedListener): void;

Parameters:

Parameter Type
listener ValueChangedListener

Returns:

void


EditorApi.onAutocompleteChanged() method

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


EditorApi.onFocusChanged() method

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


EditorApi.onKeyDown() method

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


EditorApi.onKeyUp() method

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


EditorApi.onLineNumberClick() method

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


EditorApi.onPositionChanged() method

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


EditorApi.onScrollChanged() method

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


EditorApi.onSearchChanged() method

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


EditorApi.onSelectionChanged() method

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


EditorApi.onValueChanged() method

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


EditorApi.selectAutocompleteOption() method

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


EditorApi.setAutocomplete() method

Set whether or not the autocomplete feature is enabled

Signature:

setAutocomplete(autocomplete?: boolean): void;

Parameters:

Parameter Type Description
autocomplete boolean (Optional)

Returns:

void


EditorApi.setAutocompleteCloseOnBlur() method

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


EditorApi.setAutocompleteOpen() method

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


EditorApi.setAutocompleteTriggerStrings() method

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


EditorApi.setBracketMatching() method

Set whether to show matching brackets in the editor view

Signature:

setBracketMatching(bracketMatching?: boolean): void;

Parameters:

Parameter Type Description
bracketMatching boolean (Optional)

Returns:

void


EditorApi.setCloseBrackets() method

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


EditorApi.setCursorWide() method

Set whether the wide cursor should be shown

Signature:

setCursorWide(cursorWide?: boolean): void;

Parameters:

Parameter Type Description
cursorWide boolean (Optional)

Returns:

void


EditorApi.setCypherLanguage() method

Set whether or not cypher language extensions are enabled

Signature:

setCypherLanguage(cypherLanguage?: boolean): void;

Parameters:

Parameter Type Description
cypherLanguage boolean (Optional)

Returns:

void


EditorApi.setHistory() method

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


EditorApi.setIndentUnit() method

Set the indent text to use when tabKey is enabled

Signature:

setIndentUnit(indentUnit?: string): void;

Parameters:

Parameter Type Description
indentUnit string (Optional)

Returns:

void


EditorApi.setLineNumberFormatter() method

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


EditorApi.setLineNumbers() method

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


EditorApi.setLineWrapping() method

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


EditorApi.setLint() method

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


EditorApi.setPlaceholder() method

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


EditorApi.setPosition() method

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


EditorApi.setPostExtensions() method

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


EditorApi.setPreExtensions() method

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


EditorApi.setReadOnly() method

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


EditorApi.setReadOnlyCursor() method

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


EditorApi.setSchema() method

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


EditorApi.setSearch() method

Set whether search is enabled

Signature:

setSearch(search?: boolean): void;

Parameters:

Parameter Type Description
search boolean (Optional)

Returns:

void


EditorApi.setSearchMatches() method

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


EditorApi.setSearchOpen() method

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


EditorApi.setSearchText() method

Set the search text value in the search panel

Signature:

setSearchText(searchText?: string): void;

Parameters:

Parameter Type Description
searchText string (Optional)

Returns:

void


EditorApi.setSearchTop() method

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


EditorApi.setSelection() method

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


EditorApi.setTabKey() method

Set whether the tab key is enabled

Signature:

setTabKey(tabKey?: boolean): void;

Parameters:

Parameter Type Description
tabKey boolean (Optional)

Returns:

void


EditorApi.setTheme() method

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


EditorApi.setTooltipAbsolute() method

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


EditorApi.setValue() method

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


EditorOptions interface

These are the options for the createCypherEditor function

Signature:

export interface EditorOptions 

Properties:

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

EditorOptions.autocomplete property

Whether the autocomplete feature is enabled

Signature:

autocomplete?: boolean;

Default Value:

true


EditorOptions.autocompleteCloseOnBlur property

Whether the autocomplete auto closes whenever the editor loses focus

Signature:

autocompleteCloseOnBlur?: boolean;

Default Value:

true


EditorOptions.autocompleteOpen property

Whether the autocomplete panel is initially shown to the user

Signature:

autocompleteOpen?: boolean;

Default Value:

false


EditorOptions.autocompleteTriggerStrings property

The keys that when typed will automatically open the autocomplete menu

Signature:

autocompleteTriggerStrings?: string[];

Default Value:

[".",":","[]","()","{}","[","(","{","$"]


EditorOptions.autofocus property

Whether the editor should be auto focused on first creation

Signature:

autofocus?: boolean;

Default Value:

true


EditorOptions.bracketMatching property

Whether to show matching brackets in the editor view

Signature:

bracketMatching?: boolean;

Default Value:

true


EditorOptions.closeBrackets property

Whether to automatically close brackets or wrap selected text with quotes on quote press

Signature:

closeBrackets?: boolean;

Default Value:

true


EditorOptions.cursorWide property

Whether the wide cursor should be shown

Signature:

cursorWide?: boolean;

Default Value:

true


EditorOptions.cypherLanguage property

Whether or not cypher language extensions are enabled

Signature:

cypherLanguage?: boolean;

Default Value:

true


EditorOptions.history property

Whether the editor maintains an undo/redo history

Signature:

history?: boolean;

Default Value:

true


EditorOptions.indentUnit property

The indent text to use when tabKey is enabled

Signature:

indentUnit?: string;

Default Value:

" "


EditorOptions.lineNumberFormatter property

The formatter for the line numbers of the editor

Signature:

lineNumberFormatter?: LineNumberFormatter;

Default Value:

(line, lineCount) => lineCount === 1 ? "$" : line + "";


EditorOptions.lineNumbers property

Whether line numbers are shown to the left of the editor ui

Signature:

lineNumbers?: boolean;

Default Value:

true


EditorOptions.lineWrapping property

Whether the editor wraps lines vs using a horizontal scrollbar

Signature:

lineWrapping?: boolean;

Default Value:

false


EditorOptions.lint property

Whether the editor should display lint errors to the user

Signature:

lint?: boolean;

Default Value:

false


EditorOptions.parseOnSetValue property

Whether to run the cypher language parser immediately after every call to set the value

Signature:

parseOnSetValue?: boolean;

Default Value:

true


EditorOptions.placeholder property

The text to be shown to the user when the editor value is empty

Signature:

placeholder?: string;

Default Value:

undefined


EditorOptions.position property

The initial editor cursor position

Signature:

position?: PositionAny;

Default Value:

undefined


EditorOptions.postExtensions property

The codemirror 6 extensions that should be added to the editor after the cypher language support extensions.

Signature:

postExtensions?: Extension[];

Default Value:

[]


EditorOptions.preExtensions property

The codemirror 6 extensions that should be added to the editor before the cypher language support extensions.

Signature:

preExtensions?: Extension[];

Default Value:

[]


EditorOptions.readOnly property

Whether the editor is read only or the user can edit the editor's value

Signature:

readOnly?: boolean;

Default Value:

false


EditorOptions.readOnlyCursor property

Whether to show the cursor when the editor readOnly is true

Signature:

readOnlyCursor?: boolean;

Default Value:

false


EditorOptions.schema property

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


EditorOptions.search property

Whether search is enabled

Signature:

search?: boolean;

Default Value:

true


EditorOptions.searchMatches property

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


EditorOptions.searchOpen property

Whether the search panel is initially shown to the user

Signature:

searchOpen?: boolean;

Default Value:

false


EditorOptions.searchText property

The initial search text for the search panel

Signature:

searchText?: string;

Default Value:

""


EditorOptions.searchTop property

Whether search is shown at the top of the editor window

Signature:

searchTop?: boolean;

Default Value:

false


EditorOptions.selection property

The initial editor text selection

Signature:

selection?: EditorSelection;

Default Value:

undefined


EditorOptions.tabKey property

Whether the tab key is enabled

Signature:

tabKey?: boolean;

Default Value:

true


EditorOptions.theme property

Whether to use the light or dark theme for the editor

Signature:

theme?: Theme;

Default Value:

"light"


EditorOptions.tooltipAbsolute property

Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds)

Signature:

tooltipAbsolute?: boolean;

Default Value:

true


EditorOptions.value property

The initial editor value

Signature:

value?: string;

Default Value:

""


PartialPositionObject interface

Partial editor cursor position with line & column only

Signature:

export interface PartialPositionObject 

Properties:

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

PartialPositionObject.column property

The 1 based column number of the cursor position

Signature:

column: number;

PartialPositionObject.line property

The 1 based line number of the cursor position

Signature:

line: number;

PositionObject interface

Full editor cursor position with line, column & position

Signature:

export interface PositionObject 

Properties:

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

PositionObject.column property

The 1 based column number of the cursor position

Signature:

column: number;

PositionObject.line property

The 1 based line number of the cursor position

Signature:

line: number;

PositionObject.position property

The 0 based absolute position number of the cursor position

Signature:

position: number;

ScrollInfo interface

Information about the editor scroll position

Signature:

export interface ScrollInfo 

Properties:

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

ScrollInfo.clientHeight property

The clientHeight position of the editor scroll dom element

Signature:

clientHeight: number;

ScrollInfo.clientWidth property

The clientWidth position of the editor scroll dom element

Signature:

clientWidth: number;

ScrollInfo.scrollHeight property

The scrollHeight position of the editor scroll dom element

Signature:

scrollHeight: number;

ScrollInfo.scrollLeft property

The scrollLeft position of the editor scroll dom element

Signature:

scrollLeft: number;

ScrollInfo.scrollTop property

The scrollTop position of the editor scroll dom element

Signature:

scrollTop: number;

ScrollInfo.scrollWidth property

The scrollWidth position of the editor scroll dom element

Signature:

scrollWidth: number;

SearchMatch interface

Information about a search match that was shown to the user

Signature:

export interface SearchMatch 

Properties:

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

SearchMatch.from property

The position in the editor text where the search match starts

Signature:

from: number;

SearchMatch.to property

The position in the editor text where the search match ends

Signature:

to: number;


Type Aliases:

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

AutofocusProp type

The prop keys that can be used with autofocusProps

Signature:

export type AutofocusProp = "cursorWide" | "position" | "readOnly" | "value";

ClearHistoryProps type

The prop keys that can be used with clearHistoryProps

Signature:

export type ClearHistoryProps =
  | "cursorWide"
  | "position"
  | "readOnly"
  | "value";

PositionAny type

Any supported editor cursor position

Signature:

export type PositionAny = PositionObject | PartialPositionObject | number;

References: PositionObject, PartialPositionObject


Theme type

The current editor theme

Signature:

export type Theme = "light" | "dark" | "auto";