From fbfe5db64914adcdcd7addcaa4d3e6e1c2fa9215 Mon Sep 17 00:00:00 2001 From: Felix Feng Date: Fri, 20 Dec 2024 19:53:46 +0800 Subject: [PATCH] fix --- apps/www/public/r/styles/default/column-group-element.json | 2 +- apps/www/src/registry/default/plate-ui/column-group-element.tsx | 2 +- .../src/components/plate-ui/column-group-element.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/www/public/r/styles/default/column-group-element.json b/apps/www/public/r/styles/default/column-group-element.json index 28c522a9f..025eebf65 100644 --- a/apps/www/public/r/styles/default/column-group-element.json +++ b/apps/www/public/r/styles/default/column-group-element.json @@ -18,7 +18,7 @@ }, "files": [ { - "content": "'use client';\n\nimport React from 'react';\n\nimport { cn, withRef } from '@udecode/cn';\nimport {\n useEditorRef,\n useElement,\n useRemoveNodeButton,\n} from '@udecode/plate-common/react';\nimport {\n type TColumnElement,\n type TColumnGroupElement,\n setColumns,\n} from '@udecode/plate-layout';\nimport {\n ColumnItemPlugin,\n ColumnPlugin,\n useDebouncePopoverOpen,\n} from '@udecode/plate-layout/react';\nimport { findNodePath } from '@udecode/slate';\nimport { type LucideProps, Trash2Icon } from 'lucide-react';\nimport { useReadOnly } from 'slate-react';\n\nimport { Button } from './button';\nimport { PlateElement } from './plate-element';\nimport { Popover, PopoverAnchor, PopoverContent } from './popover';\nimport { Separator } from './separator';\n\nexport const ColumnGroupElement = withRef(\n ({ children, className, ...props }, ref) => {\n return (\n \n \n
{children}
\n
\n
\n );\n }\n);\n\nexport function ColumnFloatingToolbar({ children }: React.PropsWithChildren) {\n const editor = useEditorRef();\n const readOnly = useReadOnly();\n\n const element = useElement(ColumnItemPlugin.key);\n const columnGroupElement = useElement(ColumnPlugin.key);\n\n const { props: buttonProps } = useRemoveNodeButton({ element });\n\n const isOpen = useDebouncePopoverOpen();\n\n const onColumnChange = (widths: string[]) => {\n setColumns(editor, {\n at: findNodePath(editor, columnGroupElement),\n widths,\n });\n };\n\n if (readOnly) return <>{children};\n\n return (\n \n {children}\n e.preventDefault()}\n align=\"center\"\n side=\"top\"\n sideOffset={10}\n >\n
\n onColumnChange(['50%', '50%'])}\n >\n \n \n onColumnChange(['33%', '33%', '33%'])}\n >\n \n \n onColumnChange(['70%', '30%'])}\n >\n \n \n onColumnChange(['30%', '70%'])}\n >\n \n \n onColumnChange(['25%', '50%', '25%'])}\n >\n \n \n\n \n \n
\n \n
\n );\n}\n\nconst DoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst ThreeColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst RightSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst LeftSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst DoubleSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n", + "content": "'use client';\n\nimport React from 'react';\n\nimport { cn, withRef } from '@udecode/cn';\nimport {\n useEditorRef,\n useElement,\n useRemoveNodeButton,\n} from '@udecode/plate-common/react';\nimport {\n type TColumnElement,\n type TColumnGroupElement,\n setColumns,\n} from '@udecode/plate-layout';\nimport {\n ColumnItemPlugin,\n ColumnPlugin,\n useDebouncePopoverOpen,\n} from '@udecode/plate-layout/react';\nimport { findNodePath } from '@udecode/plate-common';\nimport { type LucideProps, Trash2Icon } from 'lucide-react';\nimport { useReadOnly } from 'slate-react';\n\nimport { Button } from './button';\nimport { PlateElement } from './plate-element';\nimport { Popover, PopoverAnchor, PopoverContent } from './popover';\nimport { Separator } from './separator';\n\nexport const ColumnGroupElement = withRef(\n ({ children, className, ...props }, ref) => {\n return (\n \n \n
{children}
\n
\n
\n );\n }\n);\n\nexport function ColumnFloatingToolbar({ children }: React.PropsWithChildren) {\n const editor = useEditorRef();\n const readOnly = useReadOnly();\n\n const element = useElement(ColumnItemPlugin.key);\n const columnGroupElement = useElement(ColumnPlugin.key);\n\n const { props: buttonProps } = useRemoveNodeButton({ element });\n\n const isOpen = useDebouncePopoverOpen();\n\n const onColumnChange = (widths: string[]) => {\n setColumns(editor, {\n at: findNodePath(editor, columnGroupElement),\n widths,\n });\n };\n\n if (readOnly) return <>{children};\n\n return (\n \n {children}\n e.preventDefault()}\n align=\"center\"\n side=\"top\"\n sideOffset={10}\n >\n
\n onColumnChange(['50%', '50%'])}\n >\n \n \n onColumnChange(['33%', '33%', '33%'])}\n >\n \n \n onColumnChange(['70%', '30%'])}\n >\n \n \n onColumnChange(['30%', '70%'])}\n >\n \n \n onColumnChange(['25%', '50%', '25%'])}\n >\n \n \n\n \n \n
\n \n
\n );\n}\n\nconst DoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst ThreeColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst RightSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst LeftSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n\nconst DoubleSideDoubleColumnOutlined = (props: LucideProps) => (\n \n \n \n);\n", "path": "plate-ui/column-group-element.tsx", "target": "components/plate-ui/column-group-element.tsx", "type": "registry:ui" diff --git a/apps/www/src/registry/default/plate-ui/column-group-element.tsx b/apps/www/src/registry/default/plate-ui/column-group-element.tsx index 1e8fb6aff..d66ef57fa 100644 --- a/apps/www/src/registry/default/plate-ui/column-group-element.tsx +++ b/apps/www/src/registry/default/plate-ui/column-group-element.tsx @@ -18,7 +18,7 @@ import { ColumnPlugin, useDebouncePopoverOpen, } from '@udecode/plate-layout/react'; -import { findNodePath } from '@udecode/slate'; +import { findNodePath } from '@udecode/plate-common'; import { type LucideProps, Trash2Icon } from 'lucide-react'; import { useReadOnly } from 'slate-react'; diff --git a/templates/plate-playground-template/src/components/plate-ui/column-group-element.tsx b/templates/plate-playground-template/src/components/plate-ui/column-group-element.tsx index 1e8fb6aff..d66ef57fa 100644 --- a/templates/plate-playground-template/src/components/plate-ui/column-group-element.tsx +++ b/templates/plate-playground-template/src/components/plate-ui/column-group-element.tsx @@ -18,7 +18,7 @@ import { ColumnPlugin, useDebouncePopoverOpen, } from '@udecode/plate-layout/react'; -import { findNodePath } from '@udecode/slate'; +import { findNodePath } from '@udecode/plate-common'; import { type LucideProps, Trash2Icon } from 'lucide-react'; import { useReadOnly } from 'slate-react';