fix: add resize listener for code mirror instances (#7889)

This commit is contained in:
prateek-bruno
2026-05-15 14:40:19 +05:30
committed by GitHub
parent df06d1558b
commit a2ec2c6d56
3 changed files with 45 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ import toast from 'react-hot-toast';
import StyledWrapper from './StyledWrapper';
import onHasCompletion from './onHasCompletion';
import { setupLinkAware } from 'utils/codemirror/linkAware';
import { setupCodeMirrorResizeRefresh } from 'utils/codemirror/resize';
const CodeMirror = require('codemirror');
@@ -149,6 +150,7 @@ export default class QueryEditor extends React.Component {
this.addOverlay();
setupLinkAware(editor);
this.cleanupResizeRefresh = setupCodeMirrorResizeRefresh(editor, this._node);
// Add mousetrap class so Mousetrap captures shortcuts even when CodeMirror is focused
const cmInput = editor.getInputField();
@@ -192,6 +194,7 @@ export default class QueryEditor extends React.Component {
if (this.editor?._destroyLinkAware) {
this.editor._destroyLinkAware();
}
this.cleanupResizeRefresh?.();
this.editor.off('change', this._onEdit);
this.editor.off('keyup', this._onKeyUp);
this.editor.off('hasCompletion', this._onHasCompletion);