@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.
@@ -2136,7 +2136,9 @@ function PromQLEditor(props) {
2136
2136
  onChange = props.onChange,
2137
2137
  onEnter = props.onEnter,
2138
2138
  onBlur = props.onBlur,
2139
- editorDidMount = props.editorDidMount;
2139
+ editorDidMount = props.editorDidMount,
2140
+ _props$debugEscKey = props.debugEscKey,
2141
+ debugEscKey = _props$debugEscKey === void 0 ? false : _props$debugEscKey;
2140
2142
  var autocompleteDisposeFun = React.useRef(null);
2141
2143
  var containerRef = React.useRef(null);
2142
2144
  var dataProviderRef = React.useRef(null);
@@ -2226,6 +2228,18 @@ function PromQLEditor(props) {
2226
2228
  editor.addCommand(monaco.KeyCode.Enter, function () {
2227
2229
  onEnter == null || onEnter(editor.getValue());
2228
2230
  }, '!suggestWidgetVisible && isEditorFocused' + id);
2231
+ editor.addCommand(monaco.KeyCode.Escape, function () {
2232
+ if (debugEscKey) {
2233
+ var _editor$_contextKeySe;
2234
+ var suggestWidgetVisible = editor == null || (_editor$_contextKeySe = editor._contextKeyService) == null || _editor$_contextKeySe.getContextKeyValue == null ? void 0 : _editor$_contextKeySe.getContextKeyValue('suggestWidgetVisible');
2235
+ // eslint-disable-next-line no-console
2236
+ console.log('[PromQLEditor][ESC]', {
2237
+ suggestWidgetVisible: suggestWidgetVisible,
2238
+ valueLength: editor.getValue().length
2239
+ });
2240
+ }
2241
+ editor.trigger('keyboard', 'hideSuggestWidget', {});
2242
+ }, 'suggestWidgetVisible && isEditorFocused' + id);
2229
2243
  // Initialize previous content tracking
2230
2244
  previousContentRef.current = editor.getValue();
2231
2245
  lastDeletionTriggerTimeRef.current = 0;