fix: Description field duplicating content when editing Event Types (#24233)
* fix: description field duplicating content when editing Event Types Signed-off-by: Parship Chowdhury <i.am.parship@gmail.com> * optimal approach Signed-off-by: Parship Chowdhury <i.am.parship@gmail.com> * rm dead code Signed-off-by: Parship Chowdhury <i.am.parship@gmail.com> --------- Signed-off-by: Parship Chowdhury <i.am.parship@gmail.com>
This commit is contained in:
1 parent
5e5e77236a
commit
f8614f11ff
1 file changed
+5
-3
@@ -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 (
|
||||
<div className="toolbar flex" ref={toolbarRef}>
|
||||
<>
|
||||
{!props.excludedToolbarItems?.includes("blockType") && supportedBlockTypes.has(blockType) && (
|
||||
{!props.excludedToolbarItems?.includes("blockType") && (
|
||||
<>
|
||||
<Dropdown>
|
||||
<DropdownMenuTrigger className="text-subtle">
|
||||
|
||||
Reference in new issue
Block a user