-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Font color and font background color throw error while having buttons in the main toolbar and the balloon toolbar #15658
Font color and font background color throw error while having buttons in the main toolbar and the balloon toolbar #15658
Conversation
You could easily reproduce the problem by following next steps:
|
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.
Could you create a manual test that covers that case? You can place it in tests/manual/tickets/ISSUE_ID
- it will be easier to test for everyone and issue will have reference in manual test.
Other than that - solution looks 👍
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 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.
Unfortunately, this is not the correct way to fix this bug.
The staticColorsGrid
in our case is undefined
for a reason. We need to fix it so that it's not undefined
.
What happens (current implementation):
If we add more than one toolbar button with the font color (can be in the same toolbar, no need to create a separate toolbar), then in the colorui
only the last reference to colorSelectorView
is stored in this line:
this.colorSelectorView = addColorSelectorToDropdown( { |
In other words, if we have two font color buttons in a toolbar, then the first colorSelectorView
is created and stored in this.colorSelectorView
, and then the second one is created and overrides the first one.
In this case, we have two views, but only one has a reference in colorui
(which is wrong). This is an old regression introduced in ckeditor/ckeditor5-font#39. I don't think anyone noticed it until now, because it's a very rare use case to have the same button twice.
The solution would be to change the line above back to const colorSelectorView
and update the rest of the code accordingly, along with the tests that fail.
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.
Please correct the test so that it actually verifies the fix.
Suggested merge commit message (convention)
Fix (font): Font color and font background should work in both the main toolbar and the balloon toolbar. Closes #15580.
MINOR BREAKING CHANGE (font):
colorSelectorView
property will no longer accessible fromColorUI
plugin in@ckeditor/ckeditor5-font/src/ui/colorui.ts
.Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.