mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(editor): Fix Code node bug erasing and overwriting code when switching between nodes (#12637)
Co-authored-by: Elias Meire <elias@meire.dev>
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
import { Annotation } from '@codemirror/state';
|
||||
import type { EditorView } from '@codemirror/view';
|
||||
|
||||
export const ignoreUpdateAnnotation = Annotation.define<boolean>();
|
||||
|
||||
/**
|
||||
* Simulate user action to force parser to catch up during scroll.
|
||||
*/
|
||||
export function forceParse(view: EditorView) {
|
||||
view.dispatch({
|
||||
changes: { from: view.viewport.to, insert: '_' },
|
||||
annotations: [ignoreUpdateAnnotation.of(true)],
|
||||
});
|
||||
|
||||
view.dispatch({
|
||||
changes: { from: view.viewport.to - 1, to: view.viewport.to, insert: '' },
|
||||
annotations: [ignoreUpdateAnnotation.of(true)],
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user