-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Rich Text: Remove updateContent function #7620
Conversation
|
||
this.savedContent = this.props.value; | ||
this.setContent( this.savedContent ); | ||
this.editor.selection.moveToBookmark( bookmark ); |
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.
-
Dropping the focus management breaks the "merge". The focus is not restored at the right position when merging two paragraphs.
-
I believe the undo behavior is also necessary in this case or in cases the
value
of a RichText is updated programmatically (the change is not triggered by the RichText element itself)
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.
But all tests have passed successfully!
😉
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.
hahaha :) we definitely need a test for that. I guess we only test the content and not the cursor position.
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.
Added a failing test in dd0e347.
I added back the selection setting, this time with the condition that the editor has focus when content is being set. This is in combination with a new end-to-end test which would fail without the condition (as it does in master as well, even including a ZWSP in the saved content). See 01e0501. |
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.
Looks good to me! The only thing I could find is weird undo records on split, but that's in master too.
This pull request seeks to simplify
RichText
to have a single function for setting content, vs. the currentupdateContent
andsetContent
, by removingupdateContent
.It's current implementation includes three notable differences from just calling
setContent
directly, addressed below:updateContent
is called on a block split.this.savedContent
to the current value. This should take place insetContent
if we're assuming that this value is always to be kept in sync with the current content of the editor instance.Testing instructions:
Verify that there are no regressions in the behavior of the editor, particularly when splitting content, which until the merge of #7482 causes
updateContent
to be called.