@neo4j-cypher/react-codemirror 1.0.0-next.12 → 1.0.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/CypherEditor.js +28 -2
- package/lib/CypherEditor.js +28 -2
- package/package.json +2 -2
- package/src/CypherEditor.d.ts +79 -5
package/es/CypherEditor.js
CHANGED
|
@@ -59,11 +59,17 @@ class CypherEditor extends Component {
|
|
|
59
59
|
} = this.props;
|
|
60
60
|
onPositionChanged && onPositionChanged(positionObject);
|
|
61
61
|
});
|
|
62
|
-
_defineProperty(this, "autocompleteChanged", (autocompleteOpen,
|
|
62
|
+
_defineProperty(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
63
63
|
const {
|
|
64
64
|
onAutocompleteChanged
|
|
65
65
|
} = this.props;
|
|
66
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen,
|
|
66
|
+
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
67
|
+
});
|
|
68
|
+
_defineProperty(this, "searchChanged", (searchOpen, text, matches) => {
|
|
69
|
+
const {
|
|
70
|
+
onSearchChanged
|
|
71
|
+
} = this.props;
|
|
72
|
+
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
67
73
|
});
|
|
68
74
|
_defineProperty(this, "lineNumberClick", (line, event) => {
|
|
69
75
|
const {
|
|
@@ -90,6 +96,10 @@ class CypherEditor extends Component {
|
|
|
90
96
|
autocompleteOpen,
|
|
91
97
|
autocompleteTriggerStrings,
|
|
92
98
|
autofocus,
|
|
99
|
+
bracketMatching,
|
|
100
|
+
closeBrackets,
|
|
101
|
+
cursorWide,
|
|
102
|
+
cypherLanguage,
|
|
93
103
|
history,
|
|
94
104
|
indentUnit,
|
|
95
105
|
lineNumberFormatter,
|
|
@@ -102,6 +112,9 @@ class CypherEditor extends Component {
|
|
|
102
112
|
readOnlyCursor,
|
|
103
113
|
schema,
|
|
104
114
|
search,
|
|
115
|
+
searchMatches,
|
|
116
|
+
searchOpen,
|
|
117
|
+
searchText,
|
|
105
118
|
searchTop,
|
|
106
119
|
tabKey,
|
|
107
120
|
theme,
|
|
@@ -119,6 +132,10 @@ class CypherEditor extends Component {
|
|
|
119
132
|
autocompleteOpen,
|
|
120
133
|
autocompleteTriggerStrings,
|
|
121
134
|
autofocus,
|
|
135
|
+
bracketMatching,
|
|
136
|
+
closeBrackets,
|
|
137
|
+
cursorWide,
|
|
138
|
+
cypherLanguage,
|
|
122
139
|
history,
|
|
123
140
|
indentUnit,
|
|
124
141
|
lineNumberFormatter,
|
|
@@ -131,6 +148,9 @@ class CypherEditor extends Component {
|
|
|
131
148
|
readOnlyCursor,
|
|
132
149
|
schema,
|
|
133
150
|
search,
|
|
151
|
+
searchMatches,
|
|
152
|
+
searchOpen,
|
|
153
|
+
searchText,
|
|
134
154
|
searchTop,
|
|
135
155
|
tabKey,
|
|
136
156
|
theme,
|
|
@@ -144,6 +164,7 @@ class CypherEditor extends Component {
|
|
|
144
164
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
145
165
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
146
166
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
167
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
147
168
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
148
169
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
149
170
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -155,6 +176,7 @@ class CypherEditor extends Component {
|
|
|
155
176
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
156
177
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
157
178
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
179
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
158
180
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
159
181
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
160
182
|
this.cypherEditor.destroy();
|
|
@@ -204,6 +226,10 @@ class CypherEditor extends Component {
|
|
|
204
226
|
if (autofocusProps.includes(key)) {
|
|
205
227
|
this.cypherEditor.focus();
|
|
206
228
|
}
|
|
229
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : defaultOptions.clearHistoryProps;
|
|
230
|
+
if (clearHistoryProps.includes(key)) {
|
|
231
|
+
this.cypherEditor.clearHistory();
|
|
232
|
+
}
|
|
207
233
|
}
|
|
208
234
|
render() {
|
|
209
235
|
const {
|
package/lib/CypherEditor.js
CHANGED
|
@@ -68,11 +68,17 @@ class CypherEditor extends _react.Component {
|
|
|
68
68
|
} = this.props;
|
|
69
69
|
onPositionChanged && onPositionChanged(positionObject);
|
|
70
70
|
});
|
|
71
|
-
(0, _defineProperty2.default)(this, "autocompleteChanged", (autocompleteOpen,
|
|
71
|
+
(0, _defineProperty2.default)(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
72
72
|
const {
|
|
73
73
|
onAutocompleteChanged
|
|
74
74
|
} = this.props;
|
|
75
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen,
|
|
75
|
+
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
76
|
+
});
|
|
77
|
+
(0, _defineProperty2.default)(this, "searchChanged", (searchOpen, text, matches) => {
|
|
78
|
+
const {
|
|
79
|
+
onSearchChanged
|
|
80
|
+
} = this.props;
|
|
81
|
+
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
76
82
|
});
|
|
77
83
|
(0, _defineProperty2.default)(this, "lineNumberClick", (line, event) => {
|
|
78
84
|
const {
|
|
@@ -99,6 +105,10 @@ class CypherEditor extends _react.Component {
|
|
|
99
105
|
autocompleteOpen,
|
|
100
106
|
autocompleteTriggerStrings,
|
|
101
107
|
autofocus,
|
|
108
|
+
bracketMatching,
|
|
109
|
+
closeBrackets,
|
|
110
|
+
cursorWide,
|
|
111
|
+
cypherLanguage,
|
|
102
112
|
history,
|
|
103
113
|
indentUnit,
|
|
104
114
|
lineNumberFormatter,
|
|
@@ -111,6 +121,9 @@ class CypherEditor extends _react.Component {
|
|
|
111
121
|
readOnlyCursor,
|
|
112
122
|
schema,
|
|
113
123
|
search,
|
|
124
|
+
searchMatches,
|
|
125
|
+
searchOpen,
|
|
126
|
+
searchText,
|
|
114
127
|
searchTop,
|
|
115
128
|
tabKey,
|
|
116
129
|
theme,
|
|
@@ -128,6 +141,10 @@ class CypherEditor extends _react.Component {
|
|
|
128
141
|
autocompleteOpen,
|
|
129
142
|
autocompleteTriggerStrings,
|
|
130
143
|
autofocus,
|
|
144
|
+
bracketMatching,
|
|
145
|
+
closeBrackets,
|
|
146
|
+
cursorWide,
|
|
147
|
+
cypherLanguage,
|
|
131
148
|
history,
|
|
132
149
|
indentUnit,
|
|
133
150
|
lineNumberFormatter,
|
|
@@ -140,6 +157,9 @@ class CypherEditor extends _react.Component {
|
|
|
140
157
|
readOnlyCursor,
|
|
141
158
|
schema,
|
|
142
159
|
search,
|
|
160
|
+
searchMatches,
|
|
161
|
+
searchOpen,
|
|
162
|
+
searchText,
|
|
143
163
|
searchTop,
|
|
144
164
|
tabKey,
|
|
145
165
|
theme,
|
|
@@ -153,6 +173,7 @@ class CypherEditor extends _react.Component {
|
|
|
153
173
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
154
174
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
155
175
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
176
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
156
177
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
157
178
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
158
179
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -164,6 +185,7 @@ class CypherEditor extends _react.Component {
|
|
|
164
185
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
165
186
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
166
187
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
188
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
167
189
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
168
190
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
169
191
|
this.cypherEditor.destroy();
|
|
@@ -213,6 +235,10 @@ class CypherEditor extends _react.Component {
|
|
|
213
235
|
if (autofocusProps.includes(key)) {
|
|
214
236
|
this.cypherEditor.focus();
|
|
215
237
|
}
|
|
238
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : _codemirror.defaultOptions.clearHistoryProps;
|
|
239
|
+
if (clearHistoryProps.includes(key)) {
|
|
240
|
+
this.cypherEditor.clearHistory();
|
|
241
|
+
}
|
|
216
242
|
}
|
|
217
243
|
render() {
|
|
218
244
|
const {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"codemirror",
|
|
8
8
|
"codemirror 6"
|
|
9
9
|
],
|
|
10
|
-
"version": "1.0.0-next.
|
|
10
|
+
"version": "1.0.0-next.14",
|
|
11
11
|
"author": "Neo4j Inc.",
|
|
12
12
|
"license": "GPL-3.0",
|
|
13
13
|
"main": "./lib/react-codemirror.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/runtime": "^7.20.6",
|
|
41
|
-
"@neo4j-cypher/codemirror": "1.0.0-next.
|
|
41
|
+
"@neo4j-cypher/codemirror": "1.0.0-next.13",
|
|
42
42
|
"codemirror": "^6.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
package/src/CypherEditor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
import type { Extension } from "@codemirror/state";
|
|
3
3
|
import type { EditorSupportSchema } from "@neo4j-cypher/editor-support";
|
|
4
4
|
import type {
|
|
5
5
|
PositionAny,
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
PositionChangedListener,
|
|
11
11
|
FocusChangedListener,
|
|
12
12
|
ScrollChangedListener,
|
|
13
|
+
SearchChangedListener,
|
|
13
14
|
ValueChangedListener,
|
|
14
15
|
KeyDownListener,
|
|
15
16
|
LineNumberClickListener,
|
|
@@ -33,7 +34,7 @@ export interface CypherEditorProps {
|
|
|
33
34
|
*/
|
|
34
35
|
autocompleteCloseOnBlur?: boolean;
|
|
35
36
|
/**
|
|
36
|
-
* Whether the autocomplete
|
|
37
|
+
* Whether the autocomplete panel is open
|
|
37
38
|
*
|
|
38
39
|
* @remarks
|
|
39
40
|
*
|
|
@@ -60,6 +61,36 @@ export interface CypherEditorProps {
|
|
|
60
61
|
* @defaultValue ["position", "readOnly", "value"]
|
|
61
62
|
*/
|
|
62
63
|
autofocusProps?: AutofocusProp[];
|
|
64
|
+
/**
|
|
65
|
+
* Whether to show matching brackets in the editor view
|
|
66
|
+
*
|
|
67
|
+
* @defaultValue true
|
|
68
|
+
*/
|
|
69
|
+
bracketMatching?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Setting any of these props will trigger the editor to clear its undo/redo history
|
|
72
|
+
*
|
|
73
|
+
* @defaultValue ["cypherLanguage"]
|
|
74
|
+
*/
|
|
75
|
+
clearHistoryProps?: AutofocusProp[];
|
|
76
|
+
/**
|
|
77
|
+
* Whether to automatically close brackets or wrap selected text with quotes on quote press
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue true
|
|
80
|
+
*/
|
|
81
|
+
closeBrackets?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the wide cursor should be shown
|
|
84
|
+
*
|
|
85
|
+
* @defaultValue true
|
|
86
|
+
*/
|
|
87
|
+
cursorWide?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether or not cypher language extensions are enabled
|
|
90
|
+
*
|
|
91
|
+
* @defaultValue true
|
|
92
|
+
*/
|
|
93
|
+
cypherLanguage?: boolean;
|
|
63
94
|
/**
|
|
64
95
|
* Whether the editor maintains an undo/redo history
|
|
65
96
|
*
|
|
@@ -132,6 +163,36 @@ export interface CypherEditorProps {
|
|
|
132
163
|
* @defaultValue true
|
|
133
164
|
*/
|
|
134
165
|
search?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* The max number of search matches to be included with search changed callbacks
|
|
168
|
+
*
|
|
169
|
+
* @remarks
|
|
170
|
+
*
|
|
171
|
+
* Must be between 0 and 1000, 0 means no searching for matches (better for performance)
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue 0
|
|
174
|
+
*/
|
|
175
|
+
searchMatches?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Whether the search panel is open
|
|
178
|
+
*
|
|
179
|
+
* @remarks
|
|
180
|
+
*
|
|
181
|
+
* Changing this can be used to manually control the search open state
|
|
182
|
+
*
|
|
183
|
+
* @defaultValue `false`
|
|
184
|
+
*/
|
|
185
|
+
searchOpen?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* The search text for the search panel
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
*
|
|
191
|
+
* Changing this can be used to manually control the search panel text
|
|
192
|
+
*
|
|
193
|
+
* @defaultValue ""
|
|
194
|
+
*/
|
|
195
|
+
searchText?: string;
|
|
135
196
|
/**
|
|
136
197
|
* Whether search is shown at the top of the editor window
|
|
137
198
|
*
|
|
@@ -195,6 +256,10 @@ export interface CypherEditorProps {
|
|
|
195
256
|
* A listener for when the editor autocompletion state changes
|
|
196
257
|
*/
|
|
197
258
|
onAutocompleteChanged?: AutocompleteChangedListener;
|
|
259
|
+
/**
|
|
260
|
+
* A listener for when the editor search state changes
|
|
261
|
+
*/
|
|
262
|
+
onSearchChanged?: SearchChangedListener;
|
|
198
263
|
/**
|
|
199
264
|
* A listener for when the user clicks an editor line number
|
|
200
265
|
*/
|
|
@@ -204,9 +269,18 @@ export interface CypherEditorProps {
|
|
|
204
269
|
*/
|
|
205
270
|
onKeyDown?: KeyDownListener;
|
|
206
271
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
272
|
+
/**
|
|
273
|
+
* The codemirror 6 extensions that should be added to the editor before the cypher language support extensions.
|
|
274
|
+
*
|
|
275
|
+
* @defaultValue undefined
|
|
276
|
+
*/
|
|
277
|
+
preExtensions?: Extension[];
|
|
278
|
+
/**
|
|
279
|
+
* The codemirror 6 extensions that should be added to the editor after the cypher language support extensions.
|
|
280
|
+
*
|
|
281
|
+
* @defaultValue undefined
|
|
282
|
+
*/
|
|
283
|
+
postExtensions?: Extension[];
|
|
210
284
|
}
|
|
211
285
|
|
|
212
286
|
/**
|