diff --git a/packages/ui/components/editor/plugins/ToolbarPlugin.tsx b/packages/ui/components/editor/plugins/ToolbarPlugin.tsx index 24cb75e303..58ab9f9b76 100644 --- a/packages/ui/components/editor/plugins/ToolbarPlugin.tsx +++ b/packages/ui/components/editor/plugins/ToolbarPlugin.tsx @@ -35,8 +35,6 @@ import { AddVariablesDropdown } from "./AddVariablesDropdown"; const LowPriority = 1; -const supportedBlockTypes = new Set(["paragraph", "h1", "h2", "ul", "ol"]); - interface BlockType { [key: string]: string; } @@ -366,6 +364,10 @@ export default function ToolbarPlugin(props: TextEditorProps) { if (props.setFirstRender) { props.setFirstRender(false); editor.update(() => { + const currentContent = $getRoot().getTextContent().trim(); + if (currentContent) { + return; + } const parser = new DOMParser(); const dom = parser.parseFromString(props.getText(), "text/html"); @@ -428,7 +430,7 @@ export default function ToolbarPlugin(props: TextEditorProps) { return (
<> - {!props.excludedToolbarItems?.includes("blockType") && supportedBlockTypes.has(blockType) && ( + {!props.excludedToolbarItems?.includes("blockType") && ( <>