aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/editor/EditorStore.ts
diff options
context:
space:
mode:
Diffstat (limited to 'subprojects/frontend/src/editor/EditorStore.ts')
-rw-r--r--subprojects/frontend/src/editor/EditorStore.ts42
1 files changed, 13 insertions, 29 deletions
diff --git a/subprojects/frontend/src/editor/EditorStore.ts b/subprojects/frontend/src/editor/EditorStore.ts
index b634a427..4407376b 100644
--- a/subprojects/frontend/src/editor/EditorStore.ts
+++ b/subprojects/frontend/src/editor/EditorStore.ts
@@ -13,7 +13,7 @@ import {
13 type EditorState, 13 type EditorState,
14} from '@codemirror/state'; 14} from '@codemirror/state';
15import { type Command, EditorView } from '@codemirror/view'; 15import { type Command, EditorView } from '@codemirror/view';
16import { action, computed, makeObservable, observable } from 'mobx'; 16import { makeAutoObservable, observable } from 'mobx';
17import { nanoid } from 'nanoid'; 17import { nanoid } from 'nanoid';
18 18
19import getLogger from '../utils/getLogger'; 19import getLogger from '../utils/getLogger';
@@ -57,29 +57,15 @@ export default class EditorStore {
57 this.client = new XtextClient(this); 57 this.client = new XtextClient(this);
58 this.searchPanel = new SearchPanelStore(this); 58 this.searchPanel = new SearchPanelStore(this);
59 this.lintPanel = new LintPanelStore(this); 59 this.lintPanel = new LintPanelStore(this);
60 makeObservable(this, { 60 makeAutoObservable<EditorStore, 'client'>(this, {
61 id: false,
61 state: observable.ref, 62 state: observable.ref,
63 client: false,
62 view: observable.ref, 64 view: observable.ref,
63 showLineNumbers: observable, 65 searchPanel: false,
64 errorCount: observable, 66 lintPanel: false,
65 warningCount: observable, 67 contentAssist: false,
66 infoCount: observable, 68 formatText: false,
67 highestDiagnosticLevel: computed,
68 canUndo: computed,
69 canRedo: computed,
70 setDarkMode: action,
71 setEditorParent: action,
72 dispatch: action,
73 dispatchTransaction: action,
74 doCommand: action,
75 doStateCommand: action,
76 updateDiagnostics: action,
77 nextDiagnostic: action,
78 updateOccurrences: action,
79 updateSemanticHighlighting: action,
80 undo: action,
81 redo: action,
82 toggleLineNumbers: action,
83 }); 69 });
84 } 70 }
85 71
@@ -141,13 +127,11 @@ export default class EditorStore {
141 } 127 }
142 } 128 }
143 129
144 private readonly dispatchTransactionWithoutView = action( 130 private dispatchTransactionWithoutView(tr: Transaction): void {
145 (tr: Transaction) => { 131 log.trace('Editor transaction', tr);
146 log.trace('Editor transaction', tr); 132 this.state = tr.state;
147 this.state = tr.state; 133 this.client.onTransaction(tr);
148 this.client.onTransaction(tr); 134 }
149 },
150 );
151 135
152 doCommand(command: Command): boolean { 136 doCommand(command: Command): boolean {
153 if (this.view === undefined) { 137 if (this.view === undefined) {