Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable custom buttons save/saveAs/close/download when there is no session #893

Merged
merged 1 commit into from
May 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 10 additions & 3 deletions programs/editor/Tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The open button should perhaps be fixed as well? Currently, if I supply a link to a non-existent document, then click open it throws an assertion 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is at least one usecase where the editor is started without any session, and the open button (+ passed callback) is used to select a file that should be loaded into the editor. So it needs to be active also without a session.
So you possible found a bug in the callback handler passed for the Open button. Which code is that? localeditor.html?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Local editor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. But that is an independent error, no? No proper handling of failed loading of documents yet :/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question I haven't bothered to investigate. Just noticed whilst poking this PR 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed as #894 :)

if (button) {
button.setAttribute('disabled', !editorSession);
}
});
}

this.setEditorSession = setEditorSession;
Expand Down Expand Up @@ -171,6 +174,7 @@ define("webodf/editor/Tools", [
saveButton = new Button({
label: tr('Save'),
showLabel: false,
disabled: true,
iconClass: 'dijitEditorIcon dijitEditorIconSave',
onClick: function () {
saveOdtFile();
Expand All @@ -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();
Expand All @@ -199,6 +204,7 @@ define("webodf/editor/Tools", [
downloadButton = new Button({
label: tr('Download'),
showLabel: true,
disabled: true,
style: {
float: 'right'
},
Expand Down Expand Up @@ -267,6 +273,7 @@ define("webodf/editor/Tools", [
closeButton = new Button({
label: tr('Close'),
showLabel: false,
disabled: true,
iconClass: 'dijitEditorIcon dijitEditorIconCancel',
style: {
float: 'right'
Expand Down