@neo4j-cypher/react-codemirror 1.0.0-next.8 → 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 +69 -34
- package/es/react-codemirror.js +0 -20
- package/lib/CypherEditor.js +69 -34
- package/package.json +18 -7
- package/src/CypherEditor.d.ts +106 -8
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,12 +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
|
+
tooltipAbsolute,
|
|
101
102
|
parseOnSetValue,
|
|
102
103
|
value,
|
|
103
|
-
onEditorCreated
|
|
104
|
+
onEditorCreated,
|
|
105
|
+
preExtensions,
|
|
106
|
+
postExtensions
|
|
104
107
|
} = this.props;
|
|
105
|
-
this.value =
|
|
108
|
+
this.value = value;
|
|
106
109
|
const {
|
|
107
110
|
editor
|
|
108
111
|
} = createCypherEditor(this.editorRef, {
|
|
@@ -111,8 +114,12 @@ class CypherEditor extends Component {
|
|
|
111
114
|
autocompleteOpen,
|
|
112
115
|
autocompleteTriggerStrings,
|
|
113
116
|
autofocus,
|
|
117
|
+
bracketMatching,
|
|
118
|
+
closeBrackets,
|
|
119
|
+
cursorWide,
|
|
120
|
+
cypherLanguage,
|
|
114
121
|
history,
|
|
115
|
-
|
|
122
|
+
indentUnit,
|
|
116
123
|
lineNumberFormatter,
|
|
117
124
|
lineNumbers,
|
|
118
125
|
lineWrapping,
|
|
@@ -122,9 +129,18 @@ class CypherEditor extends Component {
|
|
|
122
129
|
readOnly,
|
|
123
130
|
readOnlyCursor,
|
|
124
131
|
schema,
|
|
132
|
+
search,
|
|
133
|
+
searchMatches,
|
|
134
|
+
searchOpen,
|
|
135
|
+
searchText,
|
|
136
|
+
searchTop,
|
|
137
|
+
tabKey,
|
|
125
138
|
theme,
|
|
139
|
+
tooltipAbsolute,
|
|
126
140
|
parseOnSetValue,
|
|
127
|
-
value
|
|
141
|
+
value,
|
|
142
|
+
preExtensions,
|
|
143
|
+
postExtensions
|
|
128
144
|
});
|
|
129
145
|
this.cypherEditor = editor;
|
|
130
146
|
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
@@ -132,6 +148,7 @@ class CypherEditor extends Component {
|
|
|
132
148
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
133
149
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
134
150
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
151
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
135
152
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
136
153
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
137
154
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -143,6 +160,7 @@ class CypherEditor extends Component {
|
|
|
143
160
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
144
161
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
145
162
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
163
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
146
164
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
147
165
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
148
166
|
this.cypherEditor.destroy();
|
|
@@ -165,12 +183,25 @@ class CypherEditor extends Component {
|
|
|
165
183
|
return;
|
|
166
184
|
}
|
|
167
185
|
const key = Object.keys(prop).pop();
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
+
}
|
|
172
204
|
}
|
|
173
|
-
|
|
174
205
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
175
206
|
if (this.cypherEditor[methodName]) {
|
|
176
207
|
this.cypherEditor[methodName](prop[key]);
|
|
@@ -179,6 +210,10 @@ class CypherEditor extends Component {
|
|
|
179
210
|
if (autofocusProps.includes(key)) {
|
|
180
211
|
this.cypherEditor.focus();
|
|
181
212
|
}
|
|
213
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : defaultOptions.clearHistoryProps;
|
|
214
|
+
if (clearHistoryProps.includes(key)) {
|
|
215
|
+
this.cypherEditor.clearHistory();
|
|
216
|
+
}
|
|
182
217
|
}
|
|
183
218
|
render() {
|
|
184
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,12 +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
|
+
tooltipAbsolute,
|
|
110
111
|
parseOnSetValue,
|
|
111
112
|
value,
|
|
112
|
-
onEditorCreated
|
|
113
|
+
onEditorCreated,
|
|
114
|
+
preExtensions,
|
|
115
|
+
postExtensions
|
|
113
116
|
} = this.props;
|
|
114
|
-
this.value =
|
|
117
|
+
this.value = value;
|
|
115
118
|
const {
|
|
116
119
|
editor
|
|
117
120
|
} = (0, _codemirror.createCypherEditor)(this.editorRef, {
|
|
@@ -120,8 +123,12 @@ class CypherEditor extends _react.Component {
|
|
|
120
123
|
autocompleteOpen,
|
|
121
124
|
autocompleteTriggerStrings,
|
|
122
125
|
autofocus,
|
|
126
|
+
bracketMatching,
|
|
127
|
+
closeBrackets,
|
|
128
|
+
cursorWide,
|
|
129
|
+
cypherLanguage,
|
|
123
130
|
history,
|
|
124
|
-
|
|
131
|
+
indentUnit,
|
|
125
132
|
lineNumberFormatter,
|
|
126
133
|
lineNumbers,
|
|
127
134
|
lineWrapping,
|
|
@@ -131,9 +138,18 @@ class CypherEditor extends _react.Component {
|
|
|
131
138
|
readOnly,
|
|
132
139
|
readOnlyCursor,
|
|
133
140
|
schema,
|
|
141
|
+
search,
|
|
142
|
+
searchMatches,
|
|
143
|
+
searchOpen,
|
|
144
|
+
searchText,
|
|
145
|
+
searchTop,
|
|
146
|
+
tabKey,
|
|
134
147
|
theme,
|
|
148
|
+
tooltipAbsolute,
|
|
135
149
|
parseOnSetValue,
|
|
136
|
-
value
|
|
150
|
+
value,
|
|
151
|
+
preExtensions,
|
|
152
|
+
postExtensions
|
|
137
153
|
});
|
|
138
154
|
this.cypherEditor = editor;
|
|
139
155
|
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
@@ -141,6 +157,7 @@ class CypherEditor extends _react.Component {
|
|
|
141
157
|
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
142
158
|
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
143
159
|
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
160
|
+
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
144
161
|
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
145
162
|
this.cypherEditor.onKeyDown(this.keyDown);
|
|
146
163
|
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
@@ -152,6 +169,7 @@ class CypherEditor extends _react.Component {
|
|
|
152
169
|
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
153
170
|
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
154
171
|
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
172
|
+
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
155
173
|
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
156
174
|
this.cypherEditor.offKeyDown(this.keyDown);
|
|
157
175
|
this.cypherEditor.destroy();
|
|
@@ -174,12 +192,25 @@ class CypherEditor extends _react.Component {
|
|
|
174
192
|
return;
|
|
175
193
|
}
|
|
176
194
|
const key = Object.keys(prop).pop();
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
+
}
|
|
181
213
|
}
|
|
182
|
-
|
|
183
214
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
184
215
|
if (this.cypherEditor[methodName]) {
|
|
185
216
|
this.cypherEditor[methodName](prop[key]);
|
|
@@ -188,6 +219,10 @@ class CypherEditor extends _react.Component {
|
|
|
188
219
|
if (autofocusProps.includes(key)) {
|
|
189
220
|
this.cypherEditor.focus();
|
|
190
221
|
}
|
|
222
|
+
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : _codemirror.defaultOptions.clearHistoryProps;
|
|
223
|
+
if (clearHistoryProps.includes(key)) {
|
|
224
|
+
this.cypherEditor.clearHistory();
|
|
225
|
+
}
|
|
191
226
|
}
|
|
192
227
|
render() {
|
|
193
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,12 +157,66 @@ 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
|
*
|
|
132
211
|
* @defaultValue "light"
|
|
133
212
|
*/
|
|
134
213
|
theme?: Theme;
|
|
214
|
+
/**
|
|
215
|
+
* Whether or not the tooltips use simple absolute position styling (vs trying to stay within bounds)
|
|
216
|
+
*
|
|
217
|
+
* @defaultValue true
|
|
218
|
+
*/
|
|
219
|
+
tooltipAbsolute?: boolean;
|
|
135
220
|
/**
|
|
136
221
|
* The editor text value
|
|
137
222
|
*
|
|
@@ -171,6 +256,10 @@ export interface CypherEditorProps {
|
|
|
171
256
|
* A listener for when the editor autocompletion state changes
|
|
172
257
|
*/
|
|
173
258
|
onAutocompleteChanged?: AutocompleteChangedListener;
|
|
259
|
+
/**
|
|
260
|
+
* A listener for when the editor search state changes
|
|
261
|
+
*/
|
|
262
|
+
onSearchChanged?: SearchChangedListener;
|
|
174
263
|
/**
|
|
175
264
|
* A listener for when the user clicks an editor line number
|
|
176
265
|
*/
|
|
@@ -180,9 +269,18 @@ export interface CypherEditorProps {
|
|
|
180
269
|
*/
|
|
181
270
|
onKeyDown?: KeyDownListener;
|
|
182
271
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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[];
|
|
186
284
|
}
|
|
187
285
|
|
|
188
286
|
/**
|