Skip to content

Commit 99ade24

Browse files
pattonwebzCopilot
andauthored
Iterate formatters for setting of state for formatters
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent df5e7b1 commit 99ade24

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/issueModal/components/RichTextarea.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ export const RichTextarea = ( { value, onChange, label, help, rows = 3, disabled
7474
editorRef.current?.contains( document.activeElement )
7575
) {
7676
saveSelection();
77-
setIsBold( document.queryCommandState( 'bold' ) );
78-
setIsItalic( document.queryCommandState( 'italic' ) );
79-
setIsUnderline( document.queryCommandState( 'underline' ) );
77+
Object.entries( FORMAT_SETTERS ).forEach(
78+
( [ command, setter ] ) => {
79+
setter( document.queryCommandState( command ) );
80+
}
81+
);
8082
}
8183
};
8284
document.addEventListener( 'selectionchange', onSelectionChange );

0 commit comments

Comments
 (0)