-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
fixes issue #681 with pasteHtml incorrectly re-hydrating tabs. #684
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ class Toolbar extends Module { | |
option.selected = true; | ||
} | ||
} if (input.value) { | ||
input.classList.toggle('ql-active', input.value == formats[format]); // Intentional == | ||
input.classList.toggle('ql-active', input.value === formats[format]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this change allows a white list to be specified as integers instead of strings but the value "+1" actually matters for indent toolbar buttons, it needs to be ===. The way it was, an active button can't be clicked twice and the button is determined active if the value of the button is the same as the value of the format. An active button can't be activated again and the value for the button was being set to The root cause is that == will coerce a string to an integer to do a comparison, which in the case of indent means a delta with format I think this change isn't necessary if the restriction that whitelists be strings and and Attributor.value always returns a string is in place. If we allow the whitelist to contain numbers, then the attributor with a numeric whitelist's value function needs to return a number. If value can return a number instead of string then toolbar update needs strict ===. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the general case of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i don't think it does... but i'll test in the code pen. |
||
} else { | ||
input.classList.toggle('ql-active', formats[format] || false); | ||
} | ||
|
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 actually think this can and should be removed... the +1/-1 is really a function of the toolbar and is handled as such in modules/toolbar.js, with the debugger attached, this method never got hit with a value that was a string === "+1" || "-1" it was always the existing indent incremented or decremented.
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 keyboard also uses this +1/-1 functionality