Skip to content

Commit 6b8c209

Browse files
committed
Filter out core annotations from active formats in format-boundaries.js
- Updated the logic in the format-boundaries event listener to exclude formats of type 'core/annotation' from both `formatsBefore` and `formatsAfter`. This ensures that editor-only formats do not interfere with user selections during formatting operations. These changes enhance the accuracy of active format management in the editor. Refs #71698
1 parent ecdce70 commit 6b8c209

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/rich-text/src/component/event-listeners/format-boundaries.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ export default ( props ) => ( element ) => {
6262
return;
6363
}
6464

65-
const formatsBefore = formats[ start - 1 ] || EMPTY_ACTIVE_FORMATS;
66-
const formatsAfter = formats[ start ] || EMPTY_ACTIVE_FORMATS;
65+
const formatsBefore = (
66+
formats[ start - 1 ] || EMPTY_ACTIVE_FORMATS
67+
).filter( ( format ) => format.type !== 'core/annotation' );
68+
const formatsAfter = (
69+
formats[ start ] || EMPTY_ACTIVE_FORMATS
70+
).filter( ( format ) => format.type !== 'core/annotation' );
6771
const destination = isReverse ? formatsBefore : formatsAfter;
6872
const isIncreasing = currentActiveFormats.every(
6973
( format, index ) => format === destination[ index ]

0 commit comments

Comments
 (0)