diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-10-25 00:29:37 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-10-31 19:26:11 +0100 |
commit | dcbfeece5e559b60a615f0aa9b933b202d34bf8b (patch) | |
tree | afdacff7492284f5f8cc147c4b84e4ba5db259b3 /language-web/src/main/js/editor/EditorStore.ts | |
parent | test(web): more websocket integration tests (diff) | |
download | refinery-dcbfeece5e559b60a615f0aa9b933b202d34bf8b.tar.gz refinery-dcbfeece5e559b60a615f0aa9b933b202d34bf8b.tar.zst refinery-dcbfeece5e559b60a615f0aa9b933b202d34bf8b.zip |
feat(web): add xtext websocket client
Diffstat (limited to 'language-web/src/main/js/editor/EditorStore.ts')
-rw-r--r-- | language-web/src/main/js/editor/EditorStore.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/language-web/src/main/js/editor/EditorStore.ts b/language-web/src/main/js/editor/EditorStore.ts index eb358338..31bb0a11 100644 --- a/language-web/src/main/js/editor/EditorStore.ts +++ b/language-web/src/main/js/editor/EditorStore.ts | |||
@@ -41,6 +41,7 @@ import { | |||
41 | import { getLogger } from '../logging'; | 41 | import { getLogger } from '../logging'; |
42 | import { problemLanguageSupport } from './problemLanguageSupport'; | 42 | import { problemLanguageSupport } from './problemLanguageSupport'; |
43 | import type { ThemeStore } from '../theme/ThemeStore'; | 43 | import type { ThemeStore } from '../theme/ThemeStore'; |
44 | import { XtextClient } from './XtextClient'; | ||
44 | 45 | ||
45 | const log = getLogger('EditorStore'); | 46 | const log = getLogger('EditorStore'); |
46 | 47 | ||
@@ -49,7 +50,7 @@ export class EditorStore { | |||
49 | 50 | ||
50 | state: EditorState; | 51 | state: EditorState; |
51 | 52 | ||
52 | emptyHistory: unknown; | 53 | client: XtextClient; |
53 | 54 | ||
54 | showLineNumbers = false; | 55 | showLineNumbers = false; |
55 | 56 | ||
@@ -109,6 +110,7 @@ export class EditorStore { | |||
109 | problemLanguageSupport(), | 110 | problemLanguageSupport(), |
110 | ], | 111 | ], |
111 | }); | 112 | }); |
113 | this.client = new XtextClient(this); | ||
112 | reaction( | 114 | reaction( |
113 | () => this.themeStore.darkMode, | 115 | () => this.themeStore.darkMode, |
114 | (darkMode) => { | 116 | (darkMode) => { |
@@ -137,6 +139,7 @@ export class EditorStore { | |||
137 | onTransaction(tr: Transaction): void { | 139 | onTransaction(tr: Transaction): void { |
138 | log.trace('Editor transaction', tr); | 140 | log.trace('Editor transaction', tr); |
139 | this.state = tr.state; | 141 | this.state = tr.state; |
142 | this.client.onTransaction(tr); | ||
140 | } | 143 | } |
141 | 144 | ||
142 | dispatch(...specs: readonly TransactionSpec[]): void { | 145 | dispatch(...specs: readonly TransactionSpec[]): void { |