Skip to content

Conversation

@ellatrix
Copy link
Member

Description

Fixes #11588. When creating a rich text value from text nodes, this branch reduces any sequence af new lines, tabs and spaces to one space. Afterwards, on a per line basis, it also trims leading and trailing whitespace, and reduces any sequence of spaces to one. This is needed because any sequence af new lines, tabs and spaces is used to format HTML, not as content. The browser will only displag it as one space, if it is used in between words.

Previously we were just removing any line breaks, which would normall still be displayed by the browser as a space.

How has this been tested?

Edit a paragraph as HTML. Remove a space and insert a line break (use ENTER). Edit visually. You should see a space where you inserted the line break. Edit as HTML. The line break should be replaced by a space.

Previously the line break would have been removed.

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.

@ellatrix ellatrix added the [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable label Nov 20, 2018
@ellatrix ellatrix added the [Status] In Progress Tracking issues with work in progress label Nov 20, 2018
@ellatrix
Copy link
Member Author

ellatrix commented Nov 20, 2018

Needs additional unit tests for create and replace.

@ellatrix
Copy link
Member Author

Superseded by #12166.

@ellatrix ellatrix closed this Nov 21, 2018
@ellatrix ellatrix deleted the fix/rich-text-replace branch November 21, 2018 10:43
@ellatrix ellatrix restored the fix/rich-text-replace branch November 22, 2018 11:27
@ellatrix ellatrix deleted the fix/rich-text-replace branch November 22, 2018 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Status] In Progress Tracking issues with work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operation on text randomly merges words

2 participants