loleaflet/src/control/Permission.js | 9 +++++---- loleaflet/src/core/Socket.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-)
New commits: commit 21b6e15c03b4c7fd33d58e6523b90e06f35fd820 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Jun 24 16:00:58 2020 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sun Jun 28 00:37:08 2020 +0200 Wrong "perm" value when setting permission, works by accident When "perm:" message is sent, in case of PDF we send the payload "perm: readonly", which is then parsed as " readonly" (with extra space). If a proper "readonly" value would be parsed, JS would get stuck, because the code assumes that "doclayer" is available, which is not the case. So this fixes that the command is correctly parsed and that it doesn't get stuck by not running the code that assumes doclayer is available. Change-Id: I35b6cc25209b4ed259f33f7fb77bc0be7a69033e Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97331 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/loleaflet/src/control/Permission.js b/loleaflet/src/control/Permission.js index e8fe959ca..3c1f5e172 100644 --- a/loleaflet/src/control/Permission.js +++ b/loleaflet/src/control/Permission.js @@ -62,10 +62,11 @@ L.Map.include({ this.dragging.enable(); // disable all user interaction, will need to add keyboard too - this._docLayer._onUpdateCursor(); - this._docLayer._clearSelections(); - this._docLayer._onUpdateTextSelection(); - + if (this._docLayer) { + this._docLayer._onUpdateCursor(); + this._docLayer._clearSelections(); + this._docLayer._onUpdateTextSelection(); + } this.fire('updatepermission', {perm : perm}); }, diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index 80decbee2..5a5568424 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -322,7 +322,7 @@ L.Socket = L.Class.extend({ this._map._clip.setKey(key); } else if (textMsg.startsWith('perm:')) { - var perm = textMsg.substring('perm:'.length); + var perm = textMsg.substring('perm:'.length).trim(); // This message is often received very early before doclayer is initialized // Change options.permission so that when docLayer is initialized, it _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits