@neo4j-cypher/react-codemirror 1.0.0-next.9 → 1.0.0
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 +67 -34
- package/es/react-codemirror.js +0 -20
- package/lib/CypherEditor.js +67 -34
- package/package.json +18 -7
- package/src/CypherEditor.d.ts +101 -9
package/es/CypherEditor.js
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) "Neo4j"
|
|
4
|
-
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
-
*
|
|
6
|
-
* This file is part of Neo4j.
|
|
7
|
-
*
|
|
8
|
-
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU General Public License as published by
|
|
10
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
* (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU General Public License
|
|
19
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
2
|
import React, { Component } from "react";
|
|
23
3
|
import { createCypherEditor, reactiveOptionKeys, defaultOptions } from "@neo4j-cypher/codemirror";
|
|
24
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -29,8 +9,7 @@ class CypherEditor extends Component {
|
|
|
29
9
|
this.editorRef = ref;
|
|
30
10
|
});
|
|
31
11
|
_defineProperty(this, "valueChanged", (value, changes) => {
|
|
32
|
-
this.
|
|
33
|
-
this.value = value;
|
|
12
|
+
this.lastValue = value;
|
|
34
13
|
const {
|
|
35
14
|
onValueChanged
|
|
36
15
|
} = this.props;
|
|
@@ -52,16 +31,25 @@ class CypherEditor extends Component {
|
|
|
52
31
|
onScrollChanged && onScrollChanged(scrollInfo);
|
|
53
32
|
});
|
|
54
33
|
_defineProperty(this, "positionChanged", positionObject => {
|
|
34
|
+
this.lastPosition = (positionObject || {
|
|
35
|
+
position: null
|
|
36
|
+
}).position;
|
|
55
37
|
const {
|
|
56
38
|
onPositionChanged
|
|
57
39
|
} = this.props;
|
|
58
40
|
onPositionChanged && onPositionChanged(positionObject);
|
|
59
41
|
});
|
|
60
|
-
_defineProperty(this, "autocompleteChanged", (autocompleteOpen,
|
|
42
|
+
_defineProperty(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
61
43
|
const {
|
|
62
44
|
onAutocompleteChanged
|
|
63
45
|
} = this.props;
|
|
64
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen,
|
|
46
|
+
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
47
|
+
});
|
|
48
|
+
_defineProperty(this, "searchChanged", (searchOpen, text, matches) => {
|
|
49
|
+
const {
|
|
50
|
+
onSearchChanged
|
|
51
|
+
} = this.props;
|
|
52
|
+
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
65
53
|
});
|
|
66
54
|
_defineProperty(this, "lineNumberClick", (line, event) => {
|
|
67
55
|
const {
|
|
@@ -78,6 +66,8 @@ class CypherEditor extends Component {
|
|
|
78
66
|
this.state = {
|
|
79
67
|
focused: false
|
|
80
68
|
};
|
|
69
|
+
this.lastValue = null;
|
|
70
|
+
this.lastPosition = null;
|
|
81
71
|
}
|
|
82
72
|
componentDidMount() {
|
|
83
73
|
const {
|
|
@@ -86,8 +76,12 @@ class CypherEditor extends Component {
|
|
|
86
76
|
autocompleteOpen,
|
|
87
77
|
autocompleteTriggerStrings,
|
|
88
78
|
autofocus,
|
|
79
|
+
bracketMatching,
|
|
80
|
+
closeBrackets,
|
|
81
|
+
cursorWide,
|
|
82
|
+
cypherLanguage,
|
|
89
83
|
history,
|
|
90
|
-
|
|
84
|
+
indentUnit,
|
|
91
85
|
lineNumberFormatter,
|
|
92
86
|
lineNumbers,
|
|
93
87
|
lineWrapping,
|
|
@@ -97,13 +91,21 @@ class CypherEditor extends Component {
|
|
|
97
91
|
readOnly,
|
|
98
92
|
readOnlyCursor,
|
|
99
93
|
schema,
|
|
94
|
+
search,
|
|
95
|
+
searchMatches,
|
|
96
|
+
searchOpen,
|
|
97
|
+
searchText,
|
|
98
|
+
searchTop,
|
|
99
|
+
tabKey,
|
|
100
100
|
theme,
|
|
101
101
|
tooltipAbsolute,
|
|
102
102
|
parseOnSetValue,
|
|
103
103
|
value,
|
|
104
|
-
onEditorCreated
|
|
104
|
+
onEditorCreated,
|
|
105
|
+
preExtensions,
|
|
106
|
+
postExtensions
|
|
105
107
|
} = this.props;
|
|
106
|
-
this.value =
|
|
108
|
+
this.value = value;
|
|
107
109
|
const {
|
|
108
110
|
editor
|
|
109
111
|
} = createCypherEditor(this.editorRef, {
|
|
@@ -112,8 +114,12 @@ class CypherEditor extends Component {
|
|
|
112
114
|
autocompleteOpen,
|
|
113
115
|
autocompleteTriggerStrings,
|
|
114
116
|
autofocus,
|
|
117
|
+
bracketMatching,
|
|
118
|
+
closeBrackets,
|
|
119
|
+
cursorWide,
|
|
120
|
+
cypherLanguage,
|
|
115
121
|
history,
|
|
116
|
-
|
|
122
|
+
indentUnit,
|
|
117
123
|
lineNumberFormatter,
|
|
118
124
|
lineNumbers,
|
|
119
125
|
lineWrapping,
|
|
@@ -123,10 +129,18 @@ class CypherEditor extends Component {
|
|
|
123
129
|
readOnly,
|
|
124
130
|
readOnlyCursor,
|
|
125
131
|
schema,
|
|
132
|
+
search,
|
|
133
|
+
searchMatches,
|
|
134
|
+
searchOpen,
|
|
135
|
+
searchText,
|
|
136
|
+
searchTop,
|
|
137
|
+
tabKey,
|
|
126
138
|
theme,
|
|
127
139
|
tooltipAbsolute,
|
|
128
140
|
parseOnSetValue,
|
|
129
|
-
value
|
|
141
|
+
value,
|
|
142
|
+
preExtensions,
|
|
143
|
+
postExtensions
|
|
130
144
|
});
|
|
131
145
|
this.cypherEditor = editor;
|
|
132
146
|
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
@@ -134,6 +148,7 @@ class CypherEditor extends Component {
|
|
|
134
148
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
135
149
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
136
150
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
151
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
137
152
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
138
153
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
139
154
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -145,6 +160,7 @@ class CypherEditor extends Component {
|
|
|
145
160
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
146
161
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
147
162
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
163
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
148
164
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
149
165
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
150
166
|
this.cypherEditor.destroy();
|
|
@@ -167,12 +183,25 @@ class CypherEditor extends Component {
|
|
|
167
183
|
return;
|
|
168
184
|
}
|
|
169
185
|
const key = Object.keys(prop).pop();
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
186
|
+
if (key === "value") {
|
|
187
|
+
if (prop[key] === this.lastValue) {
|
|
188
|
+
return;
|
|
189
|
+
} else {
|
|
190
|
+
this.lastValue = prop[key];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (key === "position") {
|
|
194
|
+
const {
|
|
195
|
+
position
|
|
196
|
+
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
197
|
+
position: null
|
|
198
|
+
};
|
|
199
|
+
if (position === this.lastPosition) {
|
|
200
|
+
return;
|
|
201
|
+
} else {
|
|
202
|
+
this.lastPosition = position;
|
|
203
|
+
}
|
|
174
204
|
}
|
|
175
|
-
|
|
176
205
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
177
206
|
if (this.cypherEditor[methodName]) {
|
|
178
207
|
this.cypherEditor[methodName](prop[key]);
|
|
@@ -181,6 +210,10 @@ class CypherEditor extends Component {
|
|
|
181
210
|
if (autofocusProps.includes(key)) {
|
|
182
211
|
this.cypherEditor.focus();
|
|
183
212
|
}
|
|
213
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : defaultOptions.clearHistoryProps;
|
|
214
|
+
if (clearHistoryProps.includes(key)) {
|
|
215
|
+
this.cypherEditor.clearHistory();
|
|
216
|
+
}
|
|
184
217
|
}
|
|
185
218
|
render() {
|
|
186
219
|
const {
|
package/es/react-codemirror.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) "Neo4j"
|
|
3
|
-
* Neo4j Sweden AB [http://neo4j.com]
|
|
4
|
-
*
|
|
5
|
-
* This file is part of Neo4j.
|
|
6
|
-
*
|
|
7
|
-
* Neo4j is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU General Public License
|
|
18
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
1
|
export { default as CypherEditor } from "./CypherEditor";
|
package/lib/CypherEditor.js
CHANGED
|
@@ -11,26 +11,6 @@ var _codemirror = require("@neo4j-cypher/codemirror");
|
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
/*
|
|
15
|
-
* Copyright (c) "Neo4j"
|
|
16
|
-
* Neo4j Sweden AB [http://neo4j.com]
|
|
17
|
-
*
|
|
18
|
-
* This file is part of Neo4j.
|
|
19
|
-
*
|
|
20
|
-
* Neo4j is free software: you can redistribute it and/or modify
|
|
21
|
-
* it under the terms of the GNU General Public License as published by
|
|
22
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
23
|
-
* (at your option) any later version.
|
|
24
|
-
*
|
|
25
|
-
* This program is distributed in the hope that it will be useful,
|
|
26
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
27
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
28
|
-
* GNU General Public License for more details.
|
|
29
|
-
*
|
|
30
|
-
* You should have received a copy of the GNU General Public License
|
|
31
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
14
|
class CypherEditor extends _react.Component {
|
|
35
15
|
constructor(props) {
|
|
36
16
|
super(props);
|
|
@@ -38,8 +18,7 @@ class CypherEditor extends _react.Component {
|
|
|
38
18
|
this.editorRef = ref;
|
|
39
19
|
});
|
|
40
20
|
(0, _defineProperty2.default)(this, "valueChanged", (value, changes) => {
|
|
41
|
-
this.
|
|
42
|
-
this.value = value;
|
|
21
|
+
this.lastValue = value;
|
|
43
22
|
const {
|
|
44
23
|
onValueChanged
|
|
45
24
|
} = this.props;
|
|
@@ -61,16 +40,25 @@ class CypherEditor extends _react.Component {
|
|
|
61
40
|
onScrollChanged && onScrollChanged(scrollInfo);
|
|
62
41
|
});
|
|
63
42
|
(0, _defineProperty2.default)(this, "positionChanged", positionObject => {
|
|
43
|
+
this.lastPosition = (positionObject || {
|
|
44
|
+
position: null
|
|
45
|
+
}).position;
|
|
64
46
|
const {
|
|
65
47
|
onPositionChanged
|
|
66
48
|
} = this.props;
|
|
67
49
|
onPositionChanged && onPositionChanged(positionObject);
|
|
68
50
|
});
|
|
69
|
-
(0, _defineProperty2.default)(this, "autocompleteChanged", (autocompleteOpen,
|
|
51
|
+
(0, _defineProperty2.default)(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
70
52
|
const {
|
|
71
53
|
onAutocompleteChanged
|
|
72
54
|
} = this.props;
|
|
73
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen,
|
|
55
|
+
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
56
|
+
});
|
|
57
|
+
(0, _defineProperty2.default)(this, "searchChanged", (searchOpen, text, matches) => {
|
|
58
|
+
const {
|
|
59
|
+
onSearchChanged
|
|
60
|
+
} = this.props;
|
|
61
|
+
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
74
62
|
});
|
|
75
63
|
(0, _defineProperty2.default)(this, "lineNumberClick", (line, event) => {
|
|
76
64
|
const {
|
|
@@ -87,6 +75,8 @@ class CypherEditor extends _react.Component {
|
|
|
87
75
|
this.state = {
|
|
88
76
|
focused: false
|
|
89
77
|
};
|
|
78
|
+
this.lastValue = null;
|
|
79
|
+
this.lastPosition = null;
|
|
90
80
|
}
|
|
91
81
|
componentDidMount() {
|
|
92
82
|
const {
|
|
@@ -95,8 +85,12 @@ class CypherEditor extends _react.Component {
|
|
|
95
85
|
autocompleteOpen,
|
|
96
86
|
autocompleteTriggerStrings,
|
|
97
87
|
autofocus,
|
|
88
|
+
bracketMatching,
|
|
89
|
+
closeBrackets,
|
|
90
|
+
cursorWide,
|
|
91
|
+
cypherLanguage,
|
|
98
92
|
history,
|
|
99
|
-
|
|
93
|
+
indentUnit,
|
|
100
94
|
lineNumberFormatter,
|
|
101
95
|
lineNumbers,
|
|
102
96
|
lineWrapping,
|
|
@@ -106,13 +100,21 @@ class CypherEditor extends _react.Component {
|
|
|
106
100
|
readOnly,
|
|
107
101
|
readOnlyCursor,
|
|
108
102
|
schema,
|
|
103
|
+
search,
|
|
104
|
+
searchMatches,
|
|
105
|
+
searchOpen,
|
|
106
|
+
searchText,
|
|
107
|
+
searchTop,
|
|
108
|
+
tabKey,
|
|
109
109
|
theme,
|
|
110
110
|
tooltipAbsolute,
|
|
111
111
|
parseOnSetValue,
|
|
112
112
|
value,
|
|
113
|
-
onEditorCreated
|
|
113
|
+
onEditorCreated,
|
|
114
|
+
preExtensions,
|
|
115
|
+
postExtensions
|
|
114
116
|
} = this.props;
|
|
115
|
-
this.value =
|
|
117
|
+
this.value = value;
|
|
116
118
|
const {
|
|
117
119
|
editor
|
|
118
120
|
} = (0, _codemirror.createCypherEditor)(this.editorRef, {
|
|
@@ -121,8 +123,12 @@ class CypherEditor extends _react.Component {
|
|
|
121
123
|
autocompleteOpen,
|
|
122
124
|
autocompleteTriggerStrings,
|
|
123
125
|
autofocus,
|
|
126
|
+
bracketMatching,
|
|
127
|
+
closeBrackets,
|
|
128
|
+
cursorWide,
|
|
129
|
+
cypherLanguage,
|
|
124
130
|
history,
|
|
125
|
-
|
|
131
|
+
indentUnit,
|
|
126
132
|
lineNumberFormatter,
|
|
127
133
|
lineNumbers,
|
|
128
134
|
lineWrapping,
|
|
@@ -132,10 +138,18 @@ class CypherEditor extends _react.Component {
|
|
|
132
138
|
readOnly,
|
|
133
139
|
readOnlyCursor,
|
|
134
140
|
schema,
|
|
141
|
+
search,
|
|
142
|
+
searchMatches,
|
|
143
|
+
searchOpen,
|
|
144
|
+
searchText,
|
|
145
|
+
searchTop,
|
|
146
|
+
tabKey,
|
|
135
147
|
theme,
|
|
136
148
|
tooltipAbsolute,
|
|
137
149
|
parseOnSetValue,
|
|
138
|
-
value
|
|
150
|
+
value,
|
|
151
|
+
preExtensions,
|
|
152
|
+
postExtensions
|
|
139
153
|
});
|
|
140
154
|
this.cypherEditor = editor;
|
|
141
155
|
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
@@ -143,6 +157,7 @@ class CypherEditor extends _react.Component {
|
|
|
143
157
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
144
158
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
145
159
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
160
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
146
161
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
147
162
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
148
163
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -154,6 +169,7 @@ class CypherEditor extends _react.Component {
|
|
|
154
169
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
155
170
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
156
171
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
172
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
157
173
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
158
174
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
159
175
|
this.cypherEditor.destroy();
|
|
@@ -176,12 +192,25 @@ class CypherEditor extends _react.Component {
|
|
|
176
192
|
return;
|
|
177
193
|
}
|
|
178
194
|
const key = Object.keys(prop).pop();
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
195
|
+
if (key === "value") {
|
|
196
|
+
if (prop[key] === this.lastValue) {
|
|
197
|
+
return;
|
|
198
|
+
} else {
|
|
199
|
+
this.lastValue = prop[key];
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (key === "position") {
|
|
203
|
+
const {
|
|
204
|
+
position
|
|
205
|
+
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
206
|
+
position: null
|
|
207
|
+
};
|
|
208
|
+
if (position === this.lastPosition) {
|
|
209
|
+
return;
|
|
210
|
+
} else {
|
|
211
|
+
this.lastPosition = position;
|
|
212
|
+
}
|
|
183
213
|
}
|
|
184
|
-
|
|
185
214
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
186
215
|
if (this.cypherEditor[methodName]) {
|
|
187
216
|
this.cypherEditor[methodName](prop[key]);
|
|
@@ -190,6 +219,10 @@ class CypherEditor extends _react.Component {
|
|
|
190
219
|
if (autofocusProps.includes(key)) {
|
|
191
220
|
this.cypherEditor.focus();
|
|
192
221
|
}
|
|
222
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : _codemirror.defaultOptions.clearHistoryProps;
|
|
223
|
+
if (clearHistoryProps.includes(key)) {
|
|
224
|
+
this.cypherEditor.clearHistory();
|
|
225
|
+
}
|
|
193
226
|
}
|
|
194
227
|
render() {
|
|
195
228
|
const {
|
package/package.json
CHANGED
|
@@ -7,18 +7,30 @@
|
|
|
7
7
|
"codemirror",
|
|
8
8
|
"codemirror 6"
|
|
9
9
|
],
|
|
10
|
-
"version": "1.0.0
|
|
10
|
+
"version": "1.0.0",
|
|
11
11
|
"author": "Neo4j Inc.",
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
13
|
"main": "./lib/react-codemirror.js",
|
|
14
14
|
"module": "./es/react-codemirror.js",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./es/react-codemirror.js",
|
|
18
|
+
"require": "./lib/react-codemirror.js"
|
|
19
|
+
},
|
|
20
|
+
"./src/react-codemirror.d.ts": {
|
|
21
|
+
"import": "./src/react-codemirror.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./src/react-codemirror.js": {
|
|
24
|
+
"import": "./src/react-codemirror.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
15
27
|
"types": "src/react-codemirror.d.ts",
|
|
16
28
|
"repository": {
|
|
17
29
|
"type": "git",
|
|
18
|
-
"url": "git://github.com/neo4j
|
|
30
|
+
"url": "git://github.com/neo4j/cypher-editor.git"
|
|
19
31
|
},
|
|
20
32
|
"bugs": {
|
|
21
|
-
"url": "https://github.com/neo4j
|
|
33
|
+
"url": "https://github.com/neo4j/cypher-editor/issues"
|
|
22
34
|
},
|
|
23
35
|
"scripts": {
|
|
24
36
|
"build-lib": "babel --config-file ../../babel.react.config.js --extensions \".js\" --out-dir lib ./src",
|
|
@@ -37,9 +49,8 @@
|
|
|
37
49
|
"node": ">=16"
|
|
38
50
|
},
|
|
39
51
|
"dependencies": {
|
|
40
|
-
"@babel/runtime": "^7.20.
|
|
41
|
-
"@neo4j-cypher/codemirror": "1.0.0
|
|
42
|
-
"codemirror": "^6.0.1"
|
|
52
|
+
"@babel/runtime": "^7.20.13",
|
|
53
|
+
"@neo4j-cypher/codemirror": "1.0.0"
|
|
43
54
|
},
|
|
44
55
|
"peerDependencies": {
|
|
45
56
|
"react": ">=16"
|
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
|
*
|
|
@@ -67,11 +98,11 @@ export interface CypherEditorProps {
|
|
|
67
98
|
*/
|
|
68
99
|
history?: boolean;
|
|
69
100
|
/**
|
|
70
|
-
*
|
|
101
|
+
* The indent text to use when tabKey is enabled
|
|
71
102
|
*
|
|
72
|
-
* @defaultValue
|
|
103
|
+
* @defaultValue " "
|
|
73
104
|
*/
|
|
74
|
-
|
|
105
|
+
indentUnit?: string;
|
|
75
106
|
/**
|
|
76
107
|
* The formatter for the line numbers of the editor
|
|
77
108
|
*
|
|
@@ -126,6 +157,54 @@ export interface CypherEditorProps {
|
|
|
126
157
|
* The schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database
|
|
127
158
|
*/
|
|
128
159
|
schema?: EditorSupportSchema;
|
|
160
|
+
/**
|
|
161
|
+
* Whether search is enabled
|
|
162
|
+
*
|
|
163
|
+
* @defaultValue true
|
|
164
|
+
*/
|
|
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;
|
|
196
|
+
/**
|
|
197
|
+
* Whether search is shown at the top of the editor window
|
|
198
|
+
*
|
|
199
|
+
* @defaultValue false
|
|
200
|
+
*/
|
|
201
|
+
searchTop?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Whether the tab key is enabled
|
|
204
|
+
*
|
|
205
|
+
* @defaultValue true
|
|
206
|
+
*/
|
|
207
|
+
tabKey?: boolean;
|
|
129
208
|
/**
|
|
130
209
|
* Whether to use the light or dark theme for the editor
|
|
131
210
|
*
|
|
@@ -135,7 +214,7 @@ export interface CypherEditorProps {
|
|
|
135
214
|
/**
|
|
136
215
|
* Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds)
|
|
137
216
|
*
|
|
138
|
-
* @defaultValue
|
|
217
|
+
* @defaultValue true
|
|
139
218
|
*/
|
|
140
219
|
tooltipAbsolute?: boolean;
|
|
141
220
|
/**
|
|
@@ -177,6 +256,10 @@ export interface CypherEditorProps {
|
|
|
177
256
|
* A listener for when the editor autocompletion state changes
|
|
178
257
|
*/
|
|
179
258
|
onAutocompleteChanged?: AutocompleteChangedListener;
|
|
259
|
+
/**
|
|
260
|
+
* A listener for when the editor search state changes
|
|
261
|
+
*/
|
|
262
|
+
onSearchChanged?: SearchChangedListener;
|
|
180
263
|
/**
|
|
181
264
|
* A listener for when the user clicks an editor line number
|
|
182
265
|
*/
|
|
@@ -186,9 +269,18 @@ export interface CypherEditorProps {
|
|
|
186
269
|
*/
|
|
187
270
|
onKeyDown?: KeyDownListener;
|
|
188
271
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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[];
|
|
192
284
|
}
|
|
193
285
|
|
|
194
286
|
/**
|