Skip to content

Commit

Permalink
Fix applying formats on multiline values without wrapper tags (#11500)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and youknowriad committed Nov 6, 2018
1 parent c444f24 commit 62c4f80
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
16 changes: 16 additions & 0 deletions packages/rich-text/src/test/__snapshots__/to-dom.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,22 @@ exports[`recordToDom should handle selection before br 1`] = `
</body>
`;

exports[`recordToDom should ignore formats at line separator 1`] = `
<body>
<p>
<em>
one
</em>
</p>
<p>
<em>
two
</em>
</p>
</body>
`;

exports[`recordToDom should ignore line breaks to format HTML 1`] = `
<body>
Expand Down
4 changes: 4 additions & 0 deletions packages/rich-text/src/test/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ describe( 'create', () => {
createRange,
record,
} ) => {
if ( html === undefined ) {
return;
}

it( description, () => {
const element = createElement( document, html );
const range = createRange( element );
Expand Down
10 changes: 10 additions & 0 deletions packages/rich-text/src/test/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,16 @@ export const spec = [
text: '',
},
},
{
description: 'should ignore formats at line separator',
multilineTag: 'p',
startPath: [],
endPath: [],
record: {
formats: [ [ em ], [ em ], [ em ], [ em ], [ em ], [ em ], [ em ] ],
text: 'one\u2028two',
},
},
{
description: 'should remove br with settings',
settings: {
Expand Down
2 changes: 1 addition & 1 deletion packages/rich-text/src/to-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function fromFormat( { type, attributes, object } ) {
export function toTree( {
value,
multilineTag,
multilineWrapperTags,
multilineWrapperTags = [],
createEmpty,
append,
getLastChild,
Expand Down

0 comments on commit 62c4f80

Please sign in to comment.