From ed8f14d5733d60bb12325ddf63022e005710bad4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 14 Nov 2018 22:54:19 +0100 Subject: [PATCH] read-only: fix it !#430) --- CHANGELOG.md | 1 + src/client/app/editor/index.js | 10 +++------- src/client/app/ipc/callbacks.js | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b4d40dc..e180bd53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - bug fixes - meter's properties not accessible (overridden with fader's properties) + - `--read-only` option not properly working - mobile - button for preventing device sleep diff --git a/src/client/app/editor/index.js b/src/client/app/editor/index.js index 4cb4fed9..aced12fd 100644 --- a/src/client/app/editor/index.js +++ b/src/client/app/editor/index.js @@ -240,6 +240,8 @@ var Editor = class Editor { enable() { + if (READ_ONLY) return + EDITING = true this.enabled = true @@ -293,13 +295,6 @@ var Editor = class Editor { EDITING = false this.enabled = false - if (READ_ONLY) { - this.enable = ()=>{} - $('.editor-menu .btn').remove() - $('.editor-menu .title').html($('.editor-menu .title').html() + ' (disabled)').addClass('disabled') - return - } - this.unselect() this.selectedWidgets = [] DOM.get('.editor-root')[0].classList.add('disabled') @@ -318,6 +313,7 @@ var Editor = class Editor { } + unselect() { DOM.get('#editor')[0].innerHTML = '' diff --git a/src/client/app/ipc/callbacks.js b/src/client/app/ipc/callbacks.js index 52cd7231..e5093c6a 100644 --- a/src/client/app/ipc/callbacks.js +++ b/src/client/app/ipc/callbacks.js @@ -92,6 +92,9 @@ module.exports = { readOnly: function(){ READ_ONLY = true + $('.editor-menu .btn').remove() + $('.editor-menu .title').addClass('disabled') + if (editor.enabled) editor.disable() }, reload: function(){