@fc-components/monaco-editor 0.1.25 → 0.1.26
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/dist/monaco-editor.cjs.development.js +15 -1
- package/dist/monaco-editor.cjs.development.js.map +1 -1
- package/dist/monaco-editor.cjs.production.min.js +1 -1
- package/dist/monaco-editor.cjs.production.min.js.map +1 -1
- package/dist/monaco-editor.esm.js +15 -1
- package/dist/monaco-editor.esm.js.map +1 -1
- package/dist/promql/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/promql/index.tsx +18 -0
package/dist/promql/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface PromQLEditorProps {
|
|
|
17
17
|
onEnter?: (value: string) => void;
|
|
18
18
|
onBlur?: (value: string) => void;
|
|
19
19
|
editorDidMount?: (editor: monacoTypes.editor.IStandaloneCodeEditor) => void;
|
|
20
|
+
debugEscKey?: boolean;
|
|
20
21
|
}
|
|
21
22
|
export default function PromQLEditor(props: PromQLEditorProps & DataProviderParams): React.JSX.Element;
|
|
22
23
|
export {};
|
package/package.json
CHANGED
package/src/promql/index.tsx
CHANGED
|
@@ -30,6 +30,7 @@ interface PromQLEditorProps {
|
|
|
30
30
|
onEnter?: (value: string) => void;
|
|
31
31
|
onBlur?: (value: string) => void;
|
|
32
32
|
editorDidMount?: (editor: monacoTypes.editor.IStandaloneCodeEditor) => void;
|
|
33
|
+
debugEscKey?: boolean;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
const PROMQL_LANG_ID = promLanguageDefinition.id;
|
|
@@ -103,6 +104,7 @@ export default function PromQLEditor(props: PromQLEditorProps & DataProviderPara
|
|
|
103
104
|
onEnter,
|
|
104
105
|
onBlur,
|
|
105
106
|
editorDidMount,
|
|
107
|
+
debugEscKey = false,
|
|
106
108
|
} = props;
|
|
107
109
|
const autocompleteDisposeFun = useRef<(() => void) | null>(null);
|
|
108
110
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
@@ -211,6 +213,22 @@ export default function PromQLEditor(props: PromQLEditorProps & DataProviderPara
|
|
|
211
213
|
'!suggestWidgetVisible && isEditorFocused' + id,
|
|
212
214
|
);
|
|
213
215
|
|
|
216
|
+
editor.addCommand(
|
|
217
|
+
monaco.KeyCode.Escape,
|
|
218
|
+
() => {
|
|
219
|
+
if (debugEscKey) {
|
|
220
|
+
const suggestWidgetVisible = (editor as any)?._contextKeyService?.getContextKeyValue?.('suggestWidgetVisible');
|
|
221
|
+
// eslint-disable-next-line no-console
|
|
222
|
+
console.log('[PromQLEditor][ESC]', {
|
|
223
|
+
suggestWidgetVisible,
|
|
224
|
+
valueLength: editor.getValue().length,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
editor.trigger('keyboard', 'hideSuggestWidget', {});
|
|
228
|
+
},
|
|
229
|
+
'suggestWidgetVisible && isEditorFocused' + id,
|
|
230
|
+
);
|
|
231
|
+
|
|
214
232
|
// Initialize previous content tracking
|
|
215
233
|
previousContentRef.current = editor.getValue();
|
|
216
234
|
lastDeletionTriggerTimeRef.current = 0;
|