Skip to content
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

[Tiny PR] RichText: correctly update value after undo #17840

Merged
merged 2 commits into from Oct 14, 2019
Merged

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Oct 8, 2019

Description

See #17839. RichText is not removing formatting after undo. This is caused by updateFormats, which seems to be called in that place for no reason. Looks like I made a mistake calling it there.

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 8, 2019

Seems to be an issue with RichText not applying the change.

@ellatrix
Copy link
Member Author

ellatrix commented Oct 8, 2019

Seems to be introduced in #15496.

@ellatrix ellatrix changed the title E2e test for 'Undoing formatting fails' RichText: correctly update value after undo Oct 8, 2019
@ellatrix ellatrix changed the title RichText: correctly update value after undo [Tiny PR] RichText: correctly update value after undo Oct 8, 2019
@ellatrix ellatrix added this to In progress in WordPress 5.3 Must Have via automation Oct 8, 2019
@ellatrix ellatrix added [Package] Rich text /packages/rich-text [Type] Bug An existing feature does not function as intended labels Oct 8, 2019
Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested this extensively, but it does the job for me.

if ( shouldReapply ) {
this.value = value;
this.record = this.formatToValue( value );
this.record.start = selectionStart;
this.record.end = selectionEnd;

updateFormats( {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So was updateFormats mutating the record back to a state with the previous formats? Is that it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's it. :) I'm not sure why it's here, I probably made a mistake.

@youknowriad youknowriad merged commit 5fa67b1 into master Oct 14, 2019
WordPress 5.3 Must Have automation moved this from In progress to Done Oct 14, 2019
@youknowriad youknowriad deleted the test/17839 branch October 14, 2019 09:09
@youknowriad youknowriad added this to the Gutenberg 6.7 milestone Oct 14, 2019
@ellatrix
Copy link
Member Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Rich text /packages/rich-text [Type] Bug An existing feature does not function as intended
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants