@gravitee/ui-components 3.24.4-migrate-codemirror-1f6b324 → 3.24.4-migrate-codemirror-6261802
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/package.json
CHANGED
package/src/molecules/gv-code.js
CHANGED
|
@@ -108,10 +108,6 @@ export class GvCode extends GvInput {
|
|
|
108
108
|
dispatchCustomEvent(this, 'ready', { currentTarget: this });
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
_onChange() {
|
|
112
|
-
dispatchCustomEvent(this, 'input', this.value);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
111
|
get hasInputStyle() {
|
|
116
112
|
return this.rows === 1;
|
|
117
113
|
}
|
|
@@ -148,6 +144,7 @@ export class GvCode extends GvInput {
|
|
|
148
144
|
EditorView.updateListener.of((viewUpdate) => {
|
|
149
145
|
if (viewUpdate.docChanged) {
|
|
150
146
|
this.value = this._editorView.state.doc.toString();
|
|
147
|
+
dispatchCustomEvent(this, 'input', this.value);
|
|
151
148
|
}
|
|
152
149
|
}),
|
|
153
150
|
autocompletion({
|
|
@@ -168,19 +165,24 @@ export class GvCode extends GvInput {
|
|
|
168
165
|
|
|
169
166
|
firstUpdated() {
|
|
170
167
|
super.firstUpdated();
|
|
171
|
-
|
|
172
|
-
const parent = this.getInputElement();
|
|
173
|
-
|
|
174
168
|
this._editorState = EditorState.create({
|
|
175
169
|
doc: this.value,
|
|
176
170
|
extensions: this._getExtensions(),
|
|
177
171
|
});
|
|
172
|
+
const parent = this.getInputElement();
|
|
178
173
|
this._editorView = new EditorView({
|
|
179
174
|
root: this.shadowRoot,
|
|
180
175
|
parent,
|
|
181
176
|
state: this._editorState,
|
|
177
|
+
dispatch: (transaction) => {
|
|
178
|
+
try {
|
|
179
|
+
this._editorView.update([transaction]);
|
|
180
|
+
} catch (e) {
|
|
181
|
+
// Sometimes the default dispatch fn throws an NS_ERROR_FAILURE at runtime.
|
|
182
|
+
// It's so strange but with this catch everything is okay
|
|
183
|
+
}
|
|
184
|
+
},
|
|
182
185
|
});
|
|
183
|
-
|
|
184
186
|
parent.appendChild(this._editorView.dom);
|
|
185
187
|
}
|
|
186
188
|
|
|
@@ -67,7 +67,7 @@ export class GvExpressionLanguage extends GvCode {
|
|
|
67
67
|
view.dispatch(
|
|
68
68
|
view.state.changeByRange((range) => ({
|
|
69
69
|
changes: [{ from: range.from, to: range.to, insert: '{#}' }],
|
|
70
|
-
range: EditorSelection.range(range.from + 2, range.
|
|
70
|
+
range: EditorSelection.range(range.from + 2, range.from + 2),
|
|
71
71
|
})),
|
|
72
72
|
);
|
|
73
73
|
startCompletion(view);
|