-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
fix: fixed some read-only mode buttons bugs #832
Conversation
Fixes:
We are getting close to the reason I started this all "read-only" adjustments ;) |
if (core.hasFocus) event._applyTagEffects(); | ||
|
||
if (core.isReadOnly) util.setDisabledButtons(true, core.resizingDisabledButtons); |
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 no need in this line if you will apply the changes from #839 pull-request
@SystemChanger Thank you for your contribution.! |
@SystemChanger The 2.42.0 version has been updated. |
Fixes:
As it was: buttons were cached before being changed by this code:
As a result, they weren't disabled on the "readOnly()" invocations.
"setToolbarButtons()" now don't enable buttons disabled by "readOnly()".
As it was: On window resize (and other events with "setToolbarButtons()" invocation) buttons lost their "disabled" state.
(check the second point in "Suggestions" below)
Removed the "se-readonly-enabled" class from "Undo" and "Redo" buttons constructor.
As it was: they had this class, but anyway were "returned" in their handlers cause of readOnly.
Obviously, they don't need them.
Now, read-only mode allows hiding more layer when the "more" button is pressed. Bonus: little code refactor.
As it was: the "more" button didn't react on pressing and hiding the layer in read-only mode.
Suggestions: (#835 issue)
Why "se-resizing-enabled" class and the corresponding array "resizingDisabledButtons" are called so?
This is super strange, They should be called something like "se-readonly-enabled" and "readOnlyDisabledButtons".
Version 3.0.0 ? :)
I think that it is better to copy all properties of previous toolbar buttons to the new ones in "setToolbarButtons()" method, cause in the future there could be some other stuff besides read-only, fullscreen or codeView (or is already there).
Check the issue ToolbarButtons code and functionality enhancements #835 for more details.
In addition, it'll be good to have "onSetToolbarButtons(buttonList)" user-definable event function to declare the custom buttons css and properties (ofc we can override this method, but it'll be cleaner for users with the knowledge that they have to do this for custom buttons).
UPD. Created a separate pull request for "onSetToolbarButtons()" event:
enhancement: added "onSetToolbarButtons" event #834