-
Notifications
You must be signed in to change notification settings - Fork 10
Highlight works fine with the font size plugin #24
Conversation
I forgot to do some internal checks. I'm giving R- now. |
Should be fine now. Let's wait for @coveralls report. |
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
src/highlightediting.js
Outdated
definition.view[ option.model ] = ( modelAttributeValue, viewWriter ) => { | ||
const attributes = { class: option.class }; | ||
|
||
// Highlight element has to have higher priority than other view elements because it must sticks directly to the text. |
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.
must stick
Shouldn't we increase the priority of the font-size feature instead of patching the highlight? What about font-size + any other feature which changes text background? I think that this is a very similar case than the link feature. It got itself the highest priority. cc @pjasiun |
Did you mean to lower font-size priority? Here we had higher priority for Highlight so to make it work in Font feature I assume that it have to have lower priority then Highlight (or other features) to properly change wrapped elements - ie be the latest one to convert. |
TBH, I don't know the context, but if a problem can be solved by view attribute elements priorities we should do it, instead of hacking. |
The latest one to convert will be the link feature. Here, we have to decide whether the highlight feature requires a proper treatment. Or whether it's the font-size feature. My point was that I'm unsure whether highlight has to be the innermost tag. Perhaps it's the font-size which should be close-to-outermost. There's, in fact, a difference in these two solutions. This PR will make the highlight tags rendered as close to the text as possible, which also involves moving it inside |
That's exactly what's proposed ;) The question is – should we increase highlight's priority or decrease font-size's priority? |
I'm thinking that what causes problems here is font-size changing feature + background coloring feature combo. As for now I can see:
In future we might have font-background plugin that will have to behave similarly to highlight. So probably making the font-size outer most (lower its priority) will be more future proof. WDYT? |
As you said:
So in this case highlight should also get a higher priority. It should work well with all features which change formatting. |
👍 |
We agreed to first add the ability to specify the view attribute element priority in two-way converters: https://github.com/ckeditor/ckeditor5-engine/issues/1408. |
After introducing https://github.com/ckeditor/ckeditor5-engine/issues/1408, this PR is no longer valid. See ckeditor/ckeditor5-font#16. |
Suggested merge commit message (convention)
Fix: Highlight plugin will render the highlighted text properly when it's combined with the
FontSize
plugin. Closes ckeditor/ckeditor5#2605.