From efc5fa6b2c78babb64f3feab1a7716ee64797f1e Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 22 Aug 2024 14:24:14 +0200 Subject: [PATCH] Fix RO mode --- web/client.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/client.ts b/web/client.ts index 6d91e7e6..3da1e70a 100644 --- a/web/client.ts +++ b/web/client.ts @@ -1132,7 +1132,8 @@ export class Client implements ConfigContainer { }); }).catch(console.error); - if (loadingDifferentPage) { + // When loading a different page OR if the page is read-only (in which case we don't want to apply local patches, because there's no point) + if (loadingDifferentPage || doc.meta.perm === "ro") { const editorState = createEditorState( this, pageName, @@ -1145,6 +1146,7 @@ export class Client implements ConfigContainer { } this.space.watchPage(pageName); } else { + // Just apply minimal patches so that the cursor is preserved await editor.setText(doc.text); }