-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Show current color in the Color Dialog #2934
Conversation
Remember that you can always create Draft PR for such cases. Please see
Did you encountered issues with other plugins, what approach was problematic? |
I thought reviewers do not look at drafts, sorry, should've ask about it before.
This is obviously a much better way to do this. Great to know we have such an awesome API for events - I didn't know I can edit event before passing it to another listener, lesson learned, thanks!
I found out
there should be no issues. I will use your PoC and come up with a better solution. |
I implemented solution according to suggestion and manual tests covering all changes. |
PR is ready for review. |
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'm not sure if we should show default font color (not applied with color button) inside the dialog (colorbutton
shows it as "automatic"). I think that we should show only the ones actually applied by the plugin. IMO showing default styles (not only colors, but also font families and sizes etc.) should be extracted to separate issue.
I'm also not sure if we should consider text in whole selection (however it seems to be implemented this way in colorbutton
). Most of our plugins use info from the beginning of the selection only (see #745).
There are no unit tests for this changes. It should be easy to use bot.dialog
API to simulate opening of the dialog and checking what color is selected.
I also don't understand why tests/plugins/colordialog/colordialog.js
was renamed?
Sometimes focus is inconsistent with the value in the input:
Do you suggest focusing color in the top left corner and leaving
I didn't change logic here, so if it should be changed I think we should create a separate task to avoid overlooking this later.
You're right, I will add unit test here.
I changed it because the name
It happens in case of choosing color from outside a palette, i.e. by typing it's hex code. We discussed this case with @f1ames and decided it's better to focus default palette color than not set focus and highlight at all. |
Yes, that's exactly what I'm proposing. |
@Dumluregn please fix failing test (see CI): |
Rebased onto latest |
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.
The mentioned issue is still present, this time if color is not set (e.g. in the second case in manual test).
Additionally please rebase the branch onto latest major
.
Ok, so there are two questions about colordialog look. The first one is directly connected with this PR. What should be the colors of UI elements on dialog show if you selected text with inconsistent color, e.g.
Of course if you have different ideas please give them. The second question is about colordialog layout and do we want to change it (in the other PR then). We could go even further and try to add some sample text (like WDYT? |
I'm for this. To solve problem with selected color I'd consider just hiding it from dialog when no single color can be detected. Alternatively replace hash with |
Co-Authored-By: Tomasz Jakut <[email protected]>
Yeah, that git history was odd indeed. I fixed it, rebased onto the latest |
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.
LGTM!
What is the purpose of this pull request?
New feature
Does your PR contain necessary tests?
This PR contains
What changes did you make?
I added a new function to colordialog plugin (not changing dialog definition as it is used in other plugins). Right now it sets selection color as selected and shows its #code in color dialog. It does not change highlight or select color on palette yet, but besides that it works as intended. The code needs a lot of refactoring too. I just want to know if my proposal logic is valid and I can continue or I should find another way.
Closes #2639.