diff --git a/packages/story-editor/src/components/panels/design/textStyle/useRichTextFormatting.js b/packages/story-editor/src/components/panels/design/textStyle/useRichTextFormatting.js index 5132ff5a6157..b27402f376a4 100644 --- a/packages/story-editor/src/components/panels/design/textStyle/useRichTextFormatting.js +++ b/packages/story-editor/src/components/panels/design/textStyle/useRichTextFormatting.js @@ -178,15 +178,12 @@ function useRichTextFormatting(selectedElements, pushUpdate) { }; }, [hasCurrentEditor, selectionActions, push, clearEditing, queuePush]); - const hasText = useCallback(() => { - const texts = selectedElements.filter(({ type }) => type === 'text'); - return texts.length > 0; - }, [selectedElements]); + const hasText = selectedElements.find(({ type }) => type === 'text'); useGlobalKeyDownEffect( { key: ['mod+b', 'mod+u', 'mod+i'] }, ({ key }) => { - if (!hasText()) { + if (!hasText) { return; } switch (key) {