Skip to content

Commit 782074b

Browse files
Calc: Fix read-only file opening in edit mode
The guard `!this._documentInfo` was intended to call `setPermission` only on the first status message. However, `this._documentInfo` was assigned to `textMsg` one line before the check, causing the guard to always evaluate to false and preventing `setPermission` from ever executing. Move the `_documentInfo` assignment after the read-only check so the guard functions as intended. Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com> Change-Id: Ifc9ba699eb15fb69e74776856142c6a0267f3d03
1 parent c94cd15 commit 782074b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

browser/src/layer/tile/CalcTileLayer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,14 @@ window.L.CalcTileLayer = window.L.CanvasTileLayer.extend({
427427
if (statusJSON.width && statusJSON.height && this._documentInfo !== textMsg) {
428428
const previousStatusJSON = this._lastStatusJSON ? Object.assign({}, this._lastStatusJSON): null;
429429
this._lastStatusJSON = statusJSON;
430-
this._documentInfo = textMsg;
431-
432-
var firstSelectedPart = (typeof this._selectedPart !== 'number');
433430

434431
if (statusJSON.readonly && !this._documentInfo)
435432
this._map.setPermission('readonly');
436433

434+
this._documentInfo = textMsg;
435+
436+
var firstSelectedPart = (typeof this._selectedPart !== 'number');
437+
437438
app.activeDocument.fileSize = new cool.SimplePoint(statusJSON.width, statusJSON.height);
438439
app.activeDocument.activeLayout.viewSize = app.activeDocument.fileSize.clone();
439440

0 commit comments

Comments
 (0)