aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-26 03:29:51 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-26 16:11:32 +0200
commit3ba6f8fba9dbd6e479f4297a5a05b51273e461a3 (patch)
tree66c0d598fdcf93db51cf988547c4417bf80906a7 /subprojects/frontend/src/xtext
parentfix(query-interpreter): functional dependencies (diff)
downloadrefinery-3ba6f8fba9dbd6e479f4297a5a05b51273e461a3.tar.gz
refinery-3ba6f8fba9dbd6e479f4297a5a05b51273e461a3.tar.zst
refinery-3ba6f8fba9dbd6e479f4297a5a05b51273e461a3.zip
feat(frontend): save in URL fragment
Diffstat (limited to 'subprojects/frontend/src/xtext')
-rw-r--r--subprojects/frontend/src/xtext/UpdateService.ts2
-rw-r--r--subprojects/frontend/src/xtext/XtextClient.ts7
2 files changed, 8 insertions, 1 deletions
diff --git a/subprojects/frontend/src/xtext/UpdateService.ts b/subprojects/frontend/src/xtext/UpdateService.ts
index 70e79764..0532f8df 100644
--- a/subprojects/frontend/src/xtext/UpdateService.ts
+++ b/subprojects/frontend/src/xtext/UpdateService.ts
@@ -56,6 +56,7 @@ export default class UpdateService {
56 constructor( 56 constructor(
57 private readonly store: EditorStore, 57 private readonly store: EditorStore,
58 private readonly webSocketClient: XtextWebSocketClient, 58 private readonly webSocketClient: XtextWebSocketClient,
59 private readonly onUpdate: (text: string) => void,
59 ) { 60 ) {
60 this.resourceName = `${nanoid(7)}.problem`; 61 this.resourceName = `${nanoid(7)}.problem`;
61 this.tracker = new UpdateStateTracker(store); 62 this.tracker = new UpdateStateTracker(store);
@@ -122,6 +123,7 @@ export default class UpdateService {
122 if (!this.tracker.needsUpdate) { 123 if (!this.tracker.needsUpdate) {
123 return; 124 return;
124 } 125 }
126 this.onUpdate(this.store.state.sliceDoc());
125 await this.tracker.runExclusive(() => this.updateExclusive()); 127 await this.tracker.runExclusive(() => this.updateExclusive());
126 } 128 }
127 129
diff --git a/subprojects/frontend/src/xtext/XtextClient.ts b/subprojects/frontend/src/xtext/XtextClient.ts
index 7486d737..21ac5750 100644
--- a/subprojects/frontend/src/xtext/XtextClient.ts
+++ b/subprojects/frontend/src/xtext/XtextClient.ts
@@ -49,13 +49,18 @@ export default class XtextClient {
49 constructor( 49 constructor(
50 private readonly store: EditorStore, 50 private readonly store: EditorStore,
51 private readonly pwaStore: PWAStore, 51 private readonly pwaStore: PWAStore,
52 onUpdate: (text: string) => void,
52 ) { 53 ) {
53 this.webSocketClient = new XtextWebSocketClient( 54 this.webSocketClient = new XtextWebSocketClient(
54 () => this.onReconnect(), 55 () => this.onReconnect(),
55 () => this.onDisconnect(), 56 () => this.onDisconnect(),
56 this.onPush.bind(this), 57 this.onPush.bind(this),
57 ); 58 );
58 this.updateService = new UpdateService(store, this.webSocketClient); 59 this.updateService = new UpdateService(
60 store,
61 this.webSocketClient,
62 onUpdate,
63 );
59 this.contentAssistService = new ContentAssistService(this.updateService); 64 this.contentAssistService = new ContentAssistService(this.updateService);
60 this.highlightingService = new HighlightingService( 65 this.highlightingService = new HighlightingService(
61 store, 66 store,