-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
WIP: absorb format boundaries into RichText toTree #11322
Conversation
5ab1d62
to
fbeb0e3
Compare
It's still in progress, I'm removing it from 4.5 milestone. |
e064508
to
718b4fe
Compare
851cfb4
to
e269593
Compare
7463176
to
86de3a9
Compare
30aba75
to
421876c
Compare
First impressions: It seems to work fairly well. Bug encountered for now: "Backspacing at the beginning of a paragraph with a format applied" don't merge blocks. |
Another small bug but I believe this one is also an existing bug in master:
|
Closing in favour of #13697. |
@youknowriad That last issue you're describing is currently an issue as well I think. See #11743. |
Description
Related: #13153, #12973, #12978, #11091, #12966, #11178, #11276, #11743.
This PR adds boundary logic to the Rich Text package.
How is it done? Zero width non breaking spaces are being added in front of the text inside the format element, and in front of the text after the format element. These are used the trick the browser to move the caret next to them. This basic addition already fully enables inserting text in any position. Of course the zero width characters are only added to the editable tree, not the saved one.
Next, we look at the deepest selected format, which receives a class to style the selected element. To know the selected format, the state must have some additional information about which format is selected at a certain index. We need add an extra property to the value
selectedFormat
:0
for outside,1
for inside the first format,2
for inside the second format, if any, etc. This information is derived from the DOM duringcreate
.To do:
getActiveFormat
unit tests.How has this been tested?
Screenshots
Types of changes
Checklist: