diff --git a/apps/www/src/components/plate-ui/playground-turn-into-dropdown-menu.tsx b/apps/www/src/components/plate-ui/playground-turn-into-dropdown-menu.tsx index 1eccfdbc94..214aef2ebc 100644 --- a/apps/www/src/components/plate-ui/playground-turn-into-dropdown-menu.tsx +++ b/apps/www/src/components/plate-ui/playground-turn-into-dropdown-menu.tsx @@ -107,8 +107,8 @@ const defaultItem = items.find((item) => item.value === ELEMENT_PARAGRAPH)!; export function PlaygroundTurnIntoDropdownMenu(props: DropdownMenuProps) { const value: string = useEditorSelector((editor) => { - let firstNodeType: string = ELEMENT_PARAGRAPH; - let allNodesMatchFirstNode = false; + let initialNodeType: string = ELEMENT_PARAGRAPH; + let allNodesMatchInitialNodeType = false; const codeBlockEntries = getNodeEntries(editor, { match: (n) => isBlock(editor, n), mode: 'highest', @@ -116,15 +116,15 @@ export function PlaygroundTurnIntoDropdownMenu(props: DropdownMenuProps) { const nodes = Array.from(codeBlockEntries); if (nodes.length > 0) { - firstNodeType = nodes[0][0].type as string; - allNodesMatchFirstNode = nodes.every(([node]) => { + initialNodeType = nodes[0][0].type as string; + allNodesMatchInitialNodeType = nodes.every(([node]) => { const type: string = (node?.type as string) || ELEMENT_PARAGRAPH; - return type === firstNodeType; + return type === initialNodeType; }); } - return allNodesMatchFirstNode ? firstNodeType : ELEMENT_PARAGRAPH; + return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH; }, []); const editor = useEditorRef(); diff --git a/apps/www/src/registry/default/plate-ui/turn-into-dropdown-menu.tsx b/apps/www/src/registry/default/plate-ui/turn-into-dropdown-menu.tsx index db4d3cf3e5..3d0819b775 100644 --- a/apps/www/src/registry/default/plate-ui/turn-into-dropdown-menu.tsx +++ b/apps/www/src/registry/default/plate-ui/turn-into-dropdown-menu.tsx @@ -77,8 +77,8 @@ const defaultItem = items.find((item) => item.value === ELEMENT_PARAGRAPH)!; export function TurnIntoDropdownMenu(props: DropdownMenuProps) { const value: string = useEditorSelector((editor) => { - let firstNodeType: string = ELEMENT_PARAGRAPH; - let allNodesMatchFirstNode = false; + let initialNodeType: string = ELEMENT_PARAGRAPH; + let allNodesMatchInitialNodeType = false; const codeBlockEntries = getNodeEntries(editor, { match: (n) => isBlock(editor, n), mode: 'highest', @@ -86,15 +86,15 @@ export function TurnIntoDropdownMenu(props: DropdownMenuProps) { const nodes = Array.from(codeBlockEntries); if (nodes.length > 0) { - firstNodeType = nodes[0][0].type as string; - allNodesMatchFirstNode = nodes.every(([node]) => { + initialNodeType = nodes[0][0].type as string; + allNodesMatchInitialNodeType = nodes.every(([node]) => { const type: string = (node?.type as string) || ELEMENT_PARAGRAPH; - return type === firstNodeType; + return type === initialNodeType; }); } - return allNodesMatchFirstNode ? firstNodeType : ELEMENT_PARAGRAPH; + return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH; }, []); const editor = useEditorRef(); diff --git a/templates/plate-playground-template/src/components/plate-ui/turn-into-dropdown-menu.tsx b/templates/plate-playground-template/src/components/plate-ui/turn-into-dropdown-menu.tsx index dd8f40223c..1eca1e4d50 100644 --- a/templates/plate-playground-template/src/components/plate-ui/turn-into-dropdown-menu.tsx +++ b/templates/plate-playground-template/src/components/plate-ui/turn-into-dropdown-menu.tsx @@ -75,8 +75,8 @@ const defaultItem = items.find((item) => item.value === ELEMENT_PARAGRAPH)!; export function TurnIntoDropdownMenu(props: DropdownMenuProps) { const value: string = useEditorSelector((editor) => { - let firstNodeType: string = ELEMENT_PARAGRAPH; - let allNodesMatchFirstNode = false; + let initialNodeType: string = ELEMENT_PARAGRAPH; + let allNodesMatchInitialNodeType = false; const codeBlockEntries = getNodeEntries(editor, { match: (n) => isBlock(editor, n), mode: 'highest', @@ -84,15 +84,15 @@ export function TurnIntoDropdownMenu(props: DropdownMenuProps) { const nodes = Array.from(codeBlockEntries); if (nodes.length > 0) { - firstNodeType = nodes[0][0].type as string; - allNodesMatchFirstNode = nodes.every(([node]) => { + initialNodeType = nodes[0][0].type as string; + allNodesMatchInitialNodeType = nodes.every(([node]) => { const type: string = (node?.type as string) || ELEMENT_PARAGRAPH; - return type === firstNodeType; + return type === initialNodeType; }); } - return allNodesMatchFirstNode ? firstNodeType : ELEMENT_PARAGRAPH; + return allNodesMatchInitialNodeType ? initialNodeType : ELEMENT_PARAGRAPH; }, []); const editor = useEditorRef();