Skip to content
Merged
Show file tree
Hide file tree
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: 12 additions & 0 deletions packages/dom/src/dom/is-entirely-selected.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ function isDeepChild( query, container, propName ) {
return true;
}
candidate = candidate[ propName ];
// There may be empty text nodes between the first/last child, so ignore
// them.
while (
candidate &&
candidate.nodeType === candidate.TEXT_NODE &&
candidate.nodeValue === ''
) {
candidate =
candidate[
propName === 'lastChild' ? 'previousSibling' : 'nextSibling'
];
}
} while ( candidate );
return false;
}
25 changes: 25 additions & 0 deletions test/e2e/specs/editor/various/multi-block-selection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1372,6 +1372,31 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => {
.poll( multiBlockSelectionUtils.getSelectedFlatIndices )
.toEqual( [ 1, 2 ] );
} );

test( 'should select all with formatting', async ( {
pageUtils,
editor,
multiBlockSelectionUtils,
} ) => {
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: '<strong>a</strong>' },
} );
await editor.insertBlock( {
name: 'core/paragraph',
attributes: { content: '<strong>b</strong>' },
} );

await pageUtils.pressKeys( 'primary+a' );
await pageUtils.pressKeys( 'primary+a' );

await expect
.poll( multiBlockSelectionUtils.getSelectedBlocks )
.toMatchObject( [
{ name: 'core/paragraph' },
{ name: 'core/paragraph' },
] );
} );
} );

class MultiBlockSelectionUtils {
Expand Down
Loading