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

Rich text: fix typing into empty flex element #59473

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/rich-text/src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,9 @@ function createFromElement( { element, range, isEditableTree } ) {

if (
isEditableTree &&
// Ignore any placeholders.
( node.getAttribute( 'data-rich-text-placeholder' ) ||
// Ignore any line breaks that are not inserted by us.
( tagName === 'br' &&
! node.getAttribute( 'data-rich-text-line-break' ) ) )
// Ignore any line breaks that are not inserted by us.
tagName === 'br' &&
! node.getAttribute( 'data-rich-text-line-break' )
) {
accumulateSelection( accumulator, node, range, createEmptyValue() );
continue;
Expand Down Expand Up @@ -541,7 +539,9 @@ function createFromElement( { element, range, isEditableTree } ) {

accumulateSelection( accumulator, node, range, value );

if ( ! format ) {
// Ignore any placeholders, but keep their content since the browser
// might insert text inside them when the editable element is flex.
if ( ! format || node.getAttribute( 'data-rich-text-placeholder' ) ) {
mergePair( accumulator, value );
} else if ( value.text.length === 0 ) {
if ( format.attributes ) {
Expand Down
Loading