-
-
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
Rendering improvements #4303
Comments
One thing regarding Avoid unnecessary structure updates, I noticed. Having content like:
and then typing something (let's say And then rendering goes as follows:
As for 2, It's just an observation, haven't analyzed it in depth, and I'm not sure if it is intended behaviour or if we could/should optimize something here. |
Extracted renderer task to ckeditor/ckeditor5-engine#1417. |
After reviewing and revisiting inline fillers PR (issue #4033, PR ckeditor/ckeditor5-engine#1355) we have reached some interesting conclusions. The fact that inline filler is removed while typing inside empty text nodes is in fact caused by two things:
1. Broken mappingsThere is a moment between start of rendering (actually between updating the 2. Unnecessary elements rerenderingIt is covered in ckeditor/ckeditor5-engine#1417 and the proposed solution will basically try to avoid elements rerendering by fixing mappings of elements, which in fact did not change, instead of rerendering them (see https://github.com/ckeditor/ckeditor5-engine/issues/1417#issuecomment-390615612 and https://github.com/ckeditor/ckeditor5-engine/issues/1417#issuecomment-390948118). So there are two ways to approach the inline filler issue. Go with #4033 and ckeditor/ckeditor5-engine#1417 which means adding additional logic which in fact covers the issue caused by outdated mappings. Or try to approach it from a different angle and implement mappings updating at the beginning of the rendering. It should cover both #4033 and ckeditor/ckeditor5-engine#1417 which means quite a big improvement. We agreed with @Reinmar during F2F talk that it seems like a valid approach for both issues (see ckeditor/ckeditor5-engine#1355 (comment) for his comment). |
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue. |
We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it). |
The below is an overview of possible rendering improvement. Most of them are related to IME handling, but we also have other issues (like #4174).
Avoid unnecessary structure updates (#1417)
Background: #4296.
How does selection conversion work?
<p><$text bold=true>xx</text></p>
+selection[bold=true]
<p><b>xx</b></p>
<p>[]<b>xx</b></p>
(after position conversion)<p><B>[]</B><b>xx</b></p>
(duringwriter.wrap( selection )
)<p><B>[]xx</B></p>
(after attribute conversion; we're merging to the left, so a new element<B>
is left)<p><b>xx</b></p>
<p><B>XX</B></p>
(we need to replace the entire<b>
element; IDEA: don't replace<b>
with<B>
because they are similar!)BUT... WHAT IF SOMETHING ELSE HAS CHANGED?
<p><b>xx</b></p>
<p><B>XXY</B></p>
(don't replace<b>
with<B>
but recursively go deeper to apply other possible changes, see Rendering deeper changes fails to update text nodes #4174)Possible solution:
diff( actual, expected, sameNode )
skip elements which have the same names and attributes (seeview.Element#isSimilar()
).<b>
with<B>
, which means that the view to DOM mapping will be outdated – the new view<B>
element will be mapped to the new DOM<B>
element which is not in the tree (because the old DOM<b>
element was left there). Which means that we should update bindings after skipping such replacements. How to do that? Perhaps we can simply and blindly set new mappings after rendering: purge existing bindngs (in a limited scope),updatedDomElements.forEach( mapToUpdatedViewElement )
.Deep structure updates
Background: https://github.com/ckeditor/ckeditor5-engine/issues/1125
<p><a>Text<b>X[]</b></a></p>
<p><a>Text<b>X</b></a><b>Y[]</b></p>
(after typing "Y"; a lot mutations)<p><a>Text<b>XY</b></a></p>
(the model and the view after inserting "Y")<p><a>Text<b>X</b></a><b>Y[]</b></p>
<p><a>Text<b>XY</b></a></p>
Fillers
Insert the inline filler when selection is at an inline element boundary. Makes sure that typed text will be inserted into the element we want it to be. Case: typing at the end of a link natively inserts text outside that link.
<p>x<a>[]ZWS</a>x</p>
<p>x<a>yyyy[]ZWS</a>x</p>
<p>x<a>ZWS[]yyyy</a>x</p>
It's still unclear where should be selection – on the left or on the right side of the filler. Perhaps, it will depend on a case.
Do not touch fillers when composition takes place. Case: typing in empty
<b>
. Assuming that we don't do unnecessary DOM changes, removing the filler immediately after a letter was typed will always break the composition - https://github.com/ckeditor/ckeditor5-engine/issues/898.Misc
The text was updated successfully, but these errors were encountered: