@neo4j-cypher/react-codemirror 1.0.0-next.11 → 1.0.0-next.12
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 +31 -8
- package/lib/CypherEditor.js +31 -8
- package/package.json +2 -2
- package/src/CypherEditor.d.ts +18 -0
package/es/CypherEditor.js
CHANGED
|
@@ -29,8 +29,7 @@ class CypherEditor extends Component {
|
|
|
29
29
|
this.editorRef = ref;
|
|
30
30
|
});
|
|
31
31
|
_defineProperty(this, "valueChanged", (value, changes) => {
|
|
32
|
-
this.
|
|
33
|
-
this.value = value;
|
|
32
|
+
this.lastValue = value;
|
|
34
33
|
const {
|
|
35
34
|
onValueChanged
|
|
36
35
|
} = this.props;
|
|
@@ -52,6 +51,9 @@ class CypherEditor extends Component {
|
|
|
52
51
|
onScrollChanged && onScrollChanged(scrollInfo);
|
|
53
52
|
});
|
|
54
53
|
_defineProperty(this, "positionChanged", positionObject => {
|
|
54
|
+
this.lastPosition = (positionObject || {
|
|
55
|
+
position: null
|
|
56
|
+
}).position;
|
|
55
57
|
const {
|
|
56
58
|
onPositionChanged
|
|
57
59
|
} = this.props;
|
|
@@ -78,6 +80,8 @@ class CypherEditor extends Component {
|
|
|
78
80
|
this.state = {
|
|
79
81
|
focused: false
|
|
80
82
|
};
|
|
83
|
+
this.lastValue = null;
|
|
84
|
+
this.lastPosition = null;
|
|
81
85
|
}
|
|
82
86
|
componentDidMount() {
|
|
83
87
|
const {
|
|
@@ -87,6 +91,7 @@ class CypherEditor extends Component {
|
|
|
87
91
|
autocompleteTriggerStrings,
|
|
88
92
|
autofocus,
|
|
89
93
|
history,
|
|
94
|
+
indentUnit,
|
|
90
95
|
lineNumberFormatter,
|
|
91
96
|
lineNumbers,
|
|
92
97
|
lineWrapping,
|
|
@@ -96,6 +101,8 @@ class CypherEditor extends Component {
|
|
|
96
101
|
readOnly,
|
|
97
102
|
readOnlyCursor,
|
|
98
103
|
schema,
|
|
104
|
+
search,
|
|
105
|
+
searchTop,
|
|
99
106
|
tabKey,
|
|
100
107
|
theme,
|
|
101
108
|
tooltipAbsolute,
|
|
@@ -103,7 +110,7 @@ class CypherEditor extends Component {
|
|
|
103
110
|
value,
|
|
104
111
|
onEditorCreated
|
|
105
112
|
} = this.props;
|
|
106
|
-
this.value =
|
|
113
|
+
this.value = value;
|
|
107
114
|
const {
|
|
108
115
|
editor
|
|
109
116
|
} = createCypherEditor(this.editorRef, {
|
|
@@ -113,6 +120,7 @@ class CypherEditor extends Component {
|
|
|
113
120
|
autocompleteTriggerStrings,
|
|
114
121
|
autofocus,
|
|
115
122
|
history,
|
|
123
|
+
indentUnit,
|
|
116
124
|
lineNumberFormatter,
|
|
117
125
|
lineNumbers,
|
|
118
126
|
lineWrapping,
|
|
@@ -122,6 +130,8 @@ class CypherEditor extends Component {
|
|
|
122
130
|
readOnly,
|
|
123
131
|
readOnlyCursor,
|
|
124
132
|
schema,
|
|
133
|
+
search,
|
|
134
|
+
searchTop,
|
|
125
135
|
tabKey,
|
|
126
136
|
theme,
|
|
127
137
|
tooltipAbsolute,
|
|
@@ -167,12 +177,25 @@ class CypherEditor extends Component {
|
|
|
167
177
|
return;
|
|
168
178
|
}
|
|
169
179
|
const key = Object.keys(prop).pop();
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
if (key === "value") {
|
|
181
|
+
if (prop[key] === this.lastValue) {
|
|
182
|
+
return;
|
|
183
|
+
} else {
|
|
184
|
+
this.lastValue = prop[key];
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (key === "position") {
|
|
188
|
+
const {
|
|
189
|
+
position
|
|
190
|
+
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
191
|
+
position: null
|
|
192
|
+
};
|
|
193
|
+
if (position === this.lastPosition) {
|
|
194
|
+
return;
|
|
195
|
+
} else {
|
|
196
|
+
this.lastPosition = position;
|
|
197
|
+
}
|
|
174
198
|
}
|
|
175
|
-
|
|
176
199
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
177
200
|
if (this.cypherEditor[methodName]) {
|
|
178
201
|
this.cypherEditor[methodName](prop[key]);
|
package/lib/CypherEditor.js
CHANGED
|
@@ -38,8 +38,7 @@ class CypherEditor extends _react.Component {
|
|
|
38
38
|
this.editorRef = ref;
|
|
39
39
|
});
|
|
40
40
|
(0, _defineProperty2.default)(this, "valueChanged", (value, changes) => {
|
|
41
|
-
this.
|
|
42
|
-
this.value = value;
|
|
41
|
+
this.lastValue = value;
|
|
43
42
|
const {
|
|
44
43
|
onValueChanged
|
|
45
44
|
} = this.props;
|
|
@@ -61,6 +60,9 @@ class CypherEditor extends _react.Component {
|
|
|
61
60
|
onScrollChanged && onScrollChanged(scrollInfo);
|
|
62
61
|
});
|
|
63
62
|
(0, _defineProperty2.default)(this, "positionChanged", positionObject => {
|
|
63
|
+
this.lastPosition = (positionObject || {
|
|
64
|
+
position: null
|
|
65
|
+
}).position;
|
|
64
66
|
const {
|
|
65
67
|
onPositionChanged
|
|
66
68
|
} = this.props;
|
|
@@ -87,6 +89,8 @@ class CypherEditor extends _react.Component {
|
|
|
87
89
|
this.state = {
|
|
88
90
|
focused: false
|
|
89
91
|
};
|
|
92
|
+
this.lastValue = null;
|
|
93
|
+
this.lastPosition = null;
|
|
90
94
|
}
|
|
91
95
|
componentDidMount() {
|
|
92
96
|
const {
|
|
@@ -96,6 +100,7 @@ class CypherEditor extends _react.Component {
|
|
|
96
100
|
autocompleteTriggerStrings,
|
|
97
101
|
autofocus,
|
|
98
102
|
history,
|
|
103
|
+
indentUnit,
|
|
99
104
|
lineNumberFormatter,
|
|
100
105
|
lineNumbers,
|
|
101
106
|
lineWrapping,
|
|
@@ -105,6 +110,8 @@ class CypherEditor extends _react.Component {
|
|
|
105
110
|
readOnly,
|
|
106
111
|
readOnlyCursor,
|
|
107
112
|
schema,
|
|
113
|
+
search,
|
|
114
|
+
searchTop,
|
|
108
115
|
tabKey,
|
|
109
116
|
theme,
|
|
110
117
|
tooltipAbsolute,
|
|
@@ -112,7 +119,7 @@ class CypherEditor extends _react.Component {
|
|
|
112
119
|
value,
|
|
113
120
|
onEditorCreated
|
|
114
121
|
} = this.props;
|
|
115
|
-
this.value =
|
|
122
|
+
this.value = value;
|
|
116
123
|
const {
|
|
117
124
|
editor
|
|
118
125
|
} = (0, _codemirror.createCypherEditor)(this.editorRef, {
|
|
@@ -122,6 +129,7 @@ class CypherEditor extends _react.Component {
|
|
|
122
129
|
autocompleteTriggerStrings,
|
|
123
130
|
autofocus,
|
|
124
131
|
history,
|
|
132
|
+
indentUnit,
|
|
125
133
|
lineNumberFormatter,
|
|
126
134
|
lineNumbers,
|
|
127
135
|
lineWrapping,
|
|
@@ -131,6 +139,8 @@ class CypherEditor extends _react.Component {
|
|
|
131
139
|
readOnly,
|
|
132
140
|
readOnlyCursor,
|
|
133
141
|
schema,
|
|
142
|
+
search,
|
|
143
|
+
searchTop,
|
|
134
144
|
tabKey,
|
|
135
145
|
theme,
|
|
136
146
|
tooltipAbsolute,
|
|
@@ -176,12 +186,25 @@ class CypherEditor extends _react.Component {
|
|
|
176
186
|
return;
|
|
177
187
|
}
|
|
178
188
|
const key = Object.keys(prop).pop();
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
189
|
+
if (key === "value") {
|
|
190
|
+
if (prop[key] === this.lastValue) {
|
|
191
|
+
return;
|
|
192
|
+
} else {
|
|
193
|
+
this.lastValue = prop[key];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (key === "position") {
|
|
197
|
+
const {
|
|
198
|
+
position
|
|
199
|
+
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
200
|
+
position: null
|
|
201
|
+
};
|
|
202
|
+
if (position === this.lastPosition) {
|
|
203
|
+
return;
|
|
204
|
+
} else {
|
|
205
|
+
this.lastPosition = position;
|
|
206
|
+
}
|
|
183
207
|
}
|
|
184
|
-
|
|
185
208
|
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
186
209
|
if (this.cypherEditor[methodName]) {
|
|
187
210
|
this.cypherEditor[methodName](prop[key]);
|
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.12",
|
|
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.11",
|
|
42
42
|
"codemirror": "^6.0.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
package/src/CypherEditor.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export interface CypherEditorProps {
|
|
|
66
66
|
* @defaultValue true
|
|
67
67
|
*/
|
|
68
68
|
history?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The indent text to use when tabKey is enabled
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue " "
|
|
73
|
+
*/
|
|
74
|
+
indentUnit?: string;
|
|
69
75
|
/**
|
|
70
76
|
* The formatter for the line numbers of the editor
|
|
71
77
|
*
|
|
@@ -120,6 +126,18 @@ export interface CypherEditorProps {
|
|
|
120
126
|
* The schema making the editor aware of things such as node labels & relationship types & procedures in the current graph database
|
|
121
127
|
*/
|
|
122
128
|
schema?: EditorSupportSchema;
|
|
129
|
+
/**
|
|
130
|
+
* Whether search is enabled
|
|
131
|
+
*
|
|
132
|
+
* @defaultValue true
|
|
133
|
+
*/
|
|
134
|
+
search?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Whether search is shown at the top of the editor window
|
|
137
|
+
*
|
|
138
|
+
* @defaultValue false
|
|
139
|
+
*/
|
|
140
|
+
searchTop?: boolean;
|
|
123
141
|
/**
|
|
124
142
|
* Whether the tab key is enabled
|
|
125
143
|
*
|