Skip to content

Latest commit

 

History

History
929 lines (562 loc) · 23.1 KB

neo4j-cypher_react-codemirror.md

File metadata and controls

929 lines (562 loc) · 23.1 KB

Home > @neo4j-cypher/react-codemirror

react-codemirror package

This package provides a React Cypher Editor component

Remarks:

The props for this component are defined by the CypherEditorProps interface

Example:

Here's some example code using the props:

const props = { autocomplete: false };
<CypherEditor {...props} />


Classes:

Class Description
CypherEditor Cypher Editor React Component

CypherEditor class

Cypher Editor React Component

Signature:

export default class CypherEditor extends React.Component<
  CypherEditorProps,
  any
> 

Extends: React.Component< CypherEditorProps, any >



Interfaces:

Interface Description
CypherEditorProps Interface for React Cypher Editor component props

CypherEditorProps interface

Interface for React Cypher Editor component props

Signature:

export interface CypherEditorProps 

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 open
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
autofocusProps? AutofocusProp[] ["position", "readOnly", "value"] (Optional) setting any of these props will trigger the editor gaining focus
bracketMatching? boolean true (Optional) Whether to show matching brackets in the editor view
className? string (Optional) A css class name to be added to the root editor dom element
clearHistoryProps? AutofocusProp[] ["cypherLanguage"] (Optional) Setting any of these props will trigger the editor to clear its undo/redo history
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
focusedClassName? string (Optional) A css class name to be added to the root editor dom element when it is focused
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
onAutocompleteChanged? AutocompleteChangedListener (Optional) A listener for when the editor autocompletion state changes
onEditorCreated? EditorCreatedListener (Optional) A listener for when the editor api gets created
onFocusChanged? FocusChangedListener (Optional) A listener for when the editor focus changes
onKeyDown? KeyListener (Optional) A listener for when the user performs a key down in the editor
onKeyUp? KeyListener (Optional) A listener for when the user performs a key up in the editor
onLineNumberClick? LineNumberClickListener (Optional) A listener for when the user clicks an editor line number
onPositionChanged? PositionChangedListener (Optional) A listener for when the editor cursor position changes
onScrollChanged? ScrollChangedListener (Optional) A listener for when the editor scroll position changes
onSearchChanged? SearchChangedListener (Optional) A listener for when the editor search state changes
onSelectionChanged? SelectionChangedListener (Optional) A listener for when the editor text selection changes
onValueChanged? ValueChangedListener (Optional) A listener for when the editor value changes
parseOnSetValue? boolean true (Optional) Whether to run the cypher language parser immediately after every call to set the value
placeholder? string (Optional) The text to be shown to the user when the editor value is empty
position? PositionAny (Optional) The editor cursor position
postExtensions? Extension[] undefined (Optional) The codemirror 6 extensions that should be added to the editor after the cypher language support extensions.
preExtensions? Extension[] undefined (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 (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 open
searchText? string "" (Optional) The 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 editor text selection
style? React.CSSProperties (Optional) a style prop to be applied to the root editor dom element
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 editor text value

CypherEditorProps.autocomplete property

Whether the autocomplete feature is enabled

Signature:

autocomplete?: boolean;

Default Value:

true


CypherEditorProps.autocompleteCloseOnBlur property

Whether the autocomplete auto closes whenever the editor loses focus

Signature:

autocompleteCloseOnBlur?: boolean;

Default Value:

true


CypherEditorProps.autocompleteOpen property

Whether the autocomplete panel is open

Signature:

autocompleteOpen?: boolean;

Remarks:

Changing this can be used to manually control the autocomplete open state

Default Value:

false


CypherEditorProps.autocompleteTriggerStrings property

The keys that when typed will automatically open the autocomplete menu

Signature:

autocompleteTriggerStrings?: string[];

Default Value:

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


CypherEditorProps.autofocus property

Whether the editor should be auto focused on first creation

Signature:

autofocus?: boolean;

Default Value:

true


CypherEditorProps.autofocusProps property

setting any of these props will trigger the editor gaining focus

Signature:

autofocusProps?: AutofocusProp[];

Default Value:

["position", "readOnly", "value"]


CypherEditorProps.bracketMatching property

Whether to show matching brackets in the editor view

Signature:

bracketMatching?: boolean;

Default Value:

true


CypherEditorProps.className property

A css class name to be added to the root editor dom element

Signature:

className?: string;

CypherEditorProps.clearHistoryProps property

Setting any of these props will trigger the editor to clear its undo/redo history

Signature:

clearHistoryProps?: AutofocusProp[];

Default Value:

["cypherLanguage"]


CypherEditorProps.closeBrackets property

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

Signature:

closeBrackets?: boolean;

Default Value:

true


CypherEditorProps.cursorWide property

Whether the wide cursor should be shown

Signature:

cursorWide?: boolean;

Default Value:

true


CypherEditorProps.cypherLanguage property

Whether or not cypher language extensions are enabled

Signature:

cypherLanguage?: boolean;

Default Value:

true


CypherEditorProps.focusedClassName property

A css class name to be added to the root editor dom element when it is focused

Signature:

focusedClassName?: string;

CypherEditorProps.history property

Whether the editor maintains an undo/redo history

Signature:

history?: boolean;

Default Value:

true


CypherEditorProps.indentUnit property

The indent text to use when tabKey is enabled

Signature:

indentUnit?: string;

Default Value:

" "


CypherEditorProps.lineNumberFormatter property

The formatter for the line numbers of the editor

Signature:

lineNumberFormatter?: LineNumberFormatter;

Default Value:

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


CypherEditorProps.lineNumbers property

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

Signature:

lineNumbers?: boolean;

Default Value:

true


CypherEditorProps.lineWrapping property

Whether the editor wraps lines vs using a horizontal scrollbar

Signature:

lineWrapping?: boolean;

Default Value:

false


CypherEditorProps.lint property

Whether the editor should display lint errors to the user

Signature:

lint?: boolean;

Default Value:

false


CypherEditorProps.onAutocompleteChanged property

A listener for when the editor autocompletion state changes

Signature:

onAutocompleteChanged?: AutocompleteChangedListener;

CypherEditorProps.onEditorCreated property

A listener for when the editor api gets created

Signature:

onEditorCreated?: EditorCreatedListener;

CypherEditorProps.onFocusChanged property

A listener for when the editor focus changes

Signature:

onFocusChanged?: FocusChangedListener;

CypherEditorProps.onKeyDown property

A listener for when the user performs a key down in the editor

Signature:

onKeyDown?: KeyListener;

CypherEditorProps.onKeyUp property

A listener for when the user performs a key up in the editor

Signature:

onKeyUp?: KeyListener;

CypherEditorProps.onLineNumberClick property

A listener for when the user clicks an editor line number

Signature:

onLineNumberClick?: LineNumberClickListener;

CypherEditorProps.onPositionChanged property

A listener for when the editor cursor position changes

Signature:

onPositionChanged?: PositionChangedListener;

CypherEditorProps.onScrollChanged property

A listener for when the editor scroll position changes

Signature:

onScrollChanged?: ScrollChangedListener;

CypherEditorProps.onSearchChanged property

A listener for when the editor search state changes

Signature:

onSearchChanged?: SearchChangedListener;

CypherEditorProps.onSelectionChanged property

A listener for when the editor text selection changes

Signature:

onSelectionChanged?: SelectionChangedListener;

CypherEditorProps.onValueChanged property

A listener for when the editor value changes

Signature:

onValueChanged?: ValueChangedListener;

CypherEditorProps.parseOnSetValue property

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

Signature:

parseOnSetValue?: boolean;

Default Value:

true


CypherEditorProps.placeholder property

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

Signature:

placeholder?: string;

CypherEditorProps.position property

The editor cursor position

Signature:

position?: PositionAny;

CypherEditorProps.postExtensions property

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

Signature:

postExtensions?: Extension[];

Default Value:

undefined


CypherEditorProps.preExtensions property

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

Signature:

preExtensions?: Extension[];

Default Value:

undefined


CypherEditorProps.readOnly property

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

Signature:

readOnly?: boolean;

Default Value:

false


CypherEditorProps.readOnlyCursor property

Whether to show the cursor when the editor readOnly is true

Signature:

readOnlyCursor?: boolean;

Default Value:

false


CypherEditorProps.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;

CypherEditorProps.search property

Whether search is enabled

Signature:

search?: boolean;

Default Value:

true


CypherEditorProps.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


CypherEditorProps.searchOpen property

Whether the search panel is open

Signature:

searchOpen?: boolean;

Remarks:

Changing this can be used to manually control the search open state

Default Value:

false


CypherEditorProps.searchText property

The search text for the search panel

Signature:

searchText?: string;

Remarks:

Changing this can be used to manually control the search panel text

Default Value:

""


CypherEditorProps.searchTop property

Whether search is shown at the top of the editor window

Signature:

searchTop?: boolean;

Default Value:

false


CypherEditorProps.selection property

The editor text selection

Signature:

selection?: EditorSelection;

Default Value:

undefined


CypherEditorProps.style property

a style prop to be applied to the root editor dom element

Signature:

style?: React.CSSProperties;

CypherEditorProps.tabKey property

Whether the tab key is enabled

Signature:

tabKey?: boolean;

Default Value:

true


CypherEditorProps.theme property

Whether to use the light or dark theme for the editor

Signature:

theme?: Theme;

Default Value:

"light"


CypherEditorProps.tooltipAbsolute property

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

Signature:

tooltipAbsolute?: boolean;

Default Value:

true


CypherEditorProps.value property

The editor text value

Signature:

value?: string;

Default Value:

""