Skip to content

Commit 09cbb82

Browse files
committed
Fix selection attribute lookup for inline boundaries
1 parent a44d705 commit 09cbb82

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

‎packages/ckeditor5-engine/src/model/documentselection.ts‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,26 +1278,27 @@ function getTextAttributes(
12781278
return node.getAttributes();
12791279
}
12801280

1281-
if ( node.is( 'element', 'softBreak' ) ) {
1281+
if ( !schema.isInline( node ) ) {
1282+
return null;
1283+
}
1284+
1285+
if ( !schema.isObject( node ) ) {
12821286
const attributes: Array<[ string, unknown ]> = [];
12831287

1288+
// Inline non-object elements create a "soft" attribute boundary and can optionally carry over
1289+
// text attributes marked as copyOnEnter.
12841290
for ( const [ key, value ] of node.getAttributes() ) {
1285-
if ( schema.checkAttribute( '$text', key ) ) {
1291+
if (
1292+
schema.checkAttribute( '$text', key ) &&
1293+
schema.getAttributeProperties( key ).copyOnEnter
1294+
) {
12861295
attributes.push( [ key, value ] );
12871296
}
12881297
}
12891298

12901299
return attributes;
12911300
}
12921301

1293-
if ( !schema.isInline( node ) ) {
1294-
return null;
1295-
}
1296-
1297-
if ( !schema.isObject( node ) ) {
1298-
return [];
1299-
}
1300-
13011302
const attributes: Array<[string, unknown]> = [];
13021303

13031304
// Collect all attributes that can be applied to the text node.

0 commit comments

Comments
 (0)