From 7f08934cf00b74c84dbf32c6737a872da7f9896c Mon Sep 17 00:00:00 2001 From: George Gevoian Date: Sun, 5 Dec 2021 13:43:47 -0800 Subject: [PATCH] (core) Skip saving layout resizes in read-only mode Summary: This change causes a notification about missing write access to no longer be shown when resizing layouts as a viewer. Test Plan: Browser test. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3167 --- app/client/components/ViewLayout.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/client/components/ViewLayout.ts b/app/client/components/ViewLayout.ts index b18ac14a..53cff819 100644 --- a/app/client/components/ViewLayout.ts +++ b/app/client/components/ViewLayout.ts @@ -106,7 +106,11 @@ export class ViewLayout extends DisposableWithEvents implements IDomComponent { this._isResizing.set(false); layoutSaveDelay.schedule(1000, () => { if (!this._layout) { return; } - (this.viewModel.layoutSpecObj as any).setAndSave(this._layout.getLayoutSpec()); + + // Only save layout changes when the document isn't read-only. + if (!this.gristDoc.isReadonly.get()) { + (this.viewModel.layoutSpecObj as any).setAndSave(this._layout.getLayoutSpec()); + } this._onResize(); }); });