From 4ed6c507053788969df296b60295c9973a8cfdf4 Mon Sep 17 00:00:00 2001 From: "Friedrich W. H. Kossebau" Date: Wed, 20 May 2015 13:52:05 +0200 Subject: [PATCH] Disable custom buttons save/saveAs/close/download when there is no session --- ChangeLog.md | 9 +++++++++ programs/editor/Tools.js | 13 ++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e9f4d9c99..edacf9da1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,12 @@ +# Changes between 0.5.7 and 0.5.8 + +## Wodo.TextEditor + +### Fixes + +* Disable custom buttons save/saveAs/close/download when there is no session ([#893](https://github.com/kogmbh/WebODF/pull/893)) + + # Changes between 0.5.6 and 0.5.7 ## WebODF diff --git a/programs/editor/Tools.js b/programs/editor/Tools.js index fe279dd0a..f97a97338 100644 --- a/programs/editor/Tools.js +++ b/programs/editor/Tools.js @@ -105,9 +105,12 @@ define("webodf/editor/Tools", [ sessionSubscribers.forEach(function (subscriber) { subscriber.setEditorSession(editorSession); }); - if (formatMenuButton) { - formatMenuButton.setAttribute('disabled', !editorSession); - } + + [saveButton, saveAsButton, downloadButton, closeButton, formatMenuButton].forEach(function (button) { + if (button) { + button.setAttribute('disabled', !editorSession); + } + }); } this.setEditorSession = setEditorSession; @@ -171,6 +174,7 @@ define("webodf/editor/Tools", [ saveButton = new Button({ label: tr('Save'), showLabel: false, + disabled: true, iconClass: 'dijitEditorIcon dijitEditorIconSave', onClick: function () { saveOdtFile(); @@ -185,6 +189,7 @@ define("webodf/editor/Tools", [ saveAsButton = new Button({ label: tr('Save as...'), showLabel: false, + disabled: true, iconClass: 'webodfeditor-dijitSaveAsIcon', onClick: function () { saveAsOdtFile(); @@ -199,6 +204,7 @@ define("webodf/editor/Tools", [ downloadButton = new Button({ label: tr('Download'), showLabel: true, + disabled: true, style: { float: 'right' }, @@ -267,6 +273,7 @@ define("webodf/editor/Tools", [ closeButton = new Button({ label: tr('Close'), showLabel: false, + disabled: true, iconClass: 'dijitEditorIcon dijitEditorIconCancel', style: { float: 'right'