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
Disable custom buttons save/saveAs/close/download when there is no session #893
Conversation
Build succeeded. |
formatMenuButton.setAttribute('disabled', !editorSession); | ||
} | ||
|
||
[saveButton, saveAsButton, downloadButton, closeButton, formatMenuButton].forEach(function (button) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Local editor.
There was a problem hiding this comment.
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 :/
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as #894 :)
Buttons appear to disable and enable fine for me. |
Thanks for review, @peitschie ! |
Disable custom buttons save/saveAs/close/download when there is no session
Makes at least sense for all use cases I know currently.
Future versions of Wodo UI (as planned with closure lib) should give more control of those buttons to the developers, of course. But for now this is a small but useful fix with the current simple support for those custom buttons.