diff --git a/apps/www/public/registry/styles/default/draggable.json b/apps/www/public/registry/styles/default/draggable.json index 026499f5a2..2a5309b712 100644 --- a/apps/www/public/registry/styles/default/draggable.json +++ b/apps/www/public/registry/styles/default/draggable.json @@ -11,7 +11,7 @@ "files": [ { "name": "draggable.tsx", - "content": "'use client';\n\nimport React, { forwardRef } from 'react';\nimport { ClassNames, PlateElementProps, TEditor } from '@udecode/plate-common';\nimport {\n DragItemNode,\n useDraggable,\n useDraggableState,\n} from '@udecode/plate-dnd';\nimport { DropTargetMonitor } from 'react-dnd';\n\nimport { cn } from '@/lib/utils';\nimport { Icons } from '@/components/icons';\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';\n\nexport interface DraggableProps\n extends PlateElementProps,\n ClassNames<{\n /**\n * Block and gutter.\n */\n blockAndGutter: string;\n\n /**\n * Block.\n */\n block: string;\n\n /**\n * Gutter at the left side of the editor.\n * It has the height of the block\n */\n gutterLeft: string;\n\n /**\n * Block toolbar wrapper in the gutter left.\n * It has the height of a line of the block.\n */\n blockToolbarWrapper: string;\n\n /**\n * Block toolbar in the gutter.\n */\n blockToolbar: string;\n\n blockWrapper: string;\n\n /**\n * Button to dnd the block, in the block toolbar.\n */\n dragHandle: string;\n\n /**\n * Icon of the drag button, in the drag icon.\n */\n dragIcon: string;\n\n /**\n * Show a dropline above or below the block when dragging a block.\n */\n dropLine: string;\n }> {\n /**\n * Intercepts the drop handling.\n * If `false` is returned, the default drop behavior is called after.\n * If `true` is returned, the default behavior is not called.\n */\n onDropHandler?: (\n editor: TEditor,\n props: {\n monitor: DropTargetMonitor;\n dragItem: DragItemNode;\n nodeRef: any;\n id: string;\n }\n ) => boolean;\n}\n\nconst Draggable = forwardRef(\n ({ className, classNames = {}, onDropHandler, ...props }, ref) => {\n const { children, element } = props;\n\n const state = useDraggableState({ element, onDropHandler });\n const { dropLine, isDragging } = state;\n const { droplineProps, gutterLeftProps, previewRef, handleRef } =\n useDraggable(state);\n\n return (\n \n \n
\n \n \n \n \n \n Drag to move\n \n
\n \n \n\n
\n {children}\n\n {!!dropLine && (\n \n )}\n
\n \n );\n }\n);\nDraggable.displayName = 'Draggable';\n\nexport { Draggable };\n" + "content": "'use client';\n\nimport React, { forwardRef } from 'react';\nimport { ClassNames, PlateElementProps, TEditor } from '@udecode/plate-common';\nimport {\n DragItemNode,\n useDraggable,\n useDraggableState,\n} from '@udecode/plate-dnd';\nimport { DropTargetMonitor } from 'react-dnd';\n\nimport { cn } from '@/lib/utils';\nimport { Icons } from '@/components/icons';\n\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';\n\nexport interface DraggableProps\n extends PlateElementProps,\n ClassNames<{\n /**\n * Block and gutter.\n */\n blockAndGutter: string;\n\n /**\n * Block.\n */\n block: string;\n\n /**\n * Gutter at the left side of the editor.\n * It has the height of the block\n */\n gutterLeft: string;\n\n /**\n * Block toolbar wrapper in the gutter left.\n * It has the height of a line of the block.\n */\n blockToolbarWrapper: string;\n\n /**\n * Block toolbar in the gutter.\n */\n blockToolbar: string;\n\n blockWrapper: string;\n\n /**\n * Button to dnd the block, in the block toolbar.\n */\n dragHandle: string;\n\n /**\n * Icon of the drag button, in the drag icon.\n */\n dragIcon: string;\n\n /**\n * Show a dropline above or below the block when dragging a block.\n */\n dropLine: string;\n }> {\n /**\n * Intercepts the drop handling.\n * If `false` is returned, the default drop behavior is called after.\n * If `true` is returned, the default behavior is not called.\n */\n onDropHandler?: (\n editor: TEditor,\n props: {\n monitor: DropTargetMonitor;\n dragItem: DragItemNode;\n nodeRef: any;\n id: string;\n }\n ) => boolean;\n}\n\nconst dragHandle = (\n \n \n \n \n Drag to move\n \n);\n\nconst Draggable = forwardRef(\n ({ className, classNames = {}, onDropHandler, ...props }, ref) => {\n const { children, element } = props;\n\n const state = useDraggableState({ element, onDropHandler });\n const { dropLine, isDragging, isHovered } = state;\n const {\n groupProps,\n droplineProps,\n gutterLeftProps,\n previewRef,\n handleRef,\n } = useDraggable(state);\n\n return (\n \n \n
\n \n
\n {isHovered && dragHandle}\n
\n
\n \n \n\n
\n {children}\n\n {!!dropLine && (\n \n )}\n
\n \n );\n }\n);\nDraggable.displayName = 'Draggable';\n\nexport { Draggable };\n" }, { "name": "with-draggables.tsx", diff --git a/yarn.lock b/yarn.lock index 9e0251f647..c4f6c49286 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7139,12 +7139,12 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-basic-elements@npm:24.4.0, @udecode/plate-basic-elements@workspace:^, @udecode/plate-basic-elements@workspace:packages/basic-elements": +"@udecode/plate-basic-elements@npm:24.4.3, @udecode/plate-basic-elements@workspace:^, @udecode/plate-basic-elements@workspace:packages/basic-elements": version: 0.0.0-use.local resolution: "@udecode/plate-basic-elements@workspace:packages/basic-elements" dependencies: "@udecode/plate-block-quote": "npm:24.4.0" - "@udecode/plate-code-block": "npm:24.4.0" + "@udecode/plate-code-block": "npm:24.4.3" "@udecode/plate-common": "npm:24.4.0" "@udecode/plate-heading": "npm:24.4.0" "@udecode/plate-paragraph": "npm:24.4.0" @@ -7237,7 +7237,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-code-block@npm:24.4.0, @udecode/plate-code-block@workspace:^, @udecode/plate-code-block@workspace:packages/code-block": +"@udecode/plate-code-block@npm:24.4.3, @udecode/plate-code-block@workspace:^, @udecode/plate-code-block@workspace:packages/code-block": version: 0.0.0-use.local resolution: "@udecode/plate-code-block@workspace:packages/code-block" dependencies: @@ -7572,7 +7572,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-link@npm:24.4.0, @udecode/plate-link@workspace:^, @udecode/plate-link@workspace:packages/link": +"@udecode/plate-link@npm:24.5.1, @udecode/plate-link@workspace:^, @udecode/plate-link@workspace:packages/link": version: 0.0.0-use.local resolution: "@udecode/plate-link@workspace:packages/link" dependencies: @@ -7715,7 +7715,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-select@npm:24.4.0, @udecode/plate-select@workspace:^, @udecode/plate-select@workspace:packages/select": +"@udecode/plate-select@npm:24.5.0, @udecode/plate-select@workspace:^, @udecode/plate-select@workspace:packages/select": version: 0.0.0-use.local resolution: "@udecode/plate-select@workspace:packages/select" dependencies: @@ -7747,13 +7747,13 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-csv@npm:24.4.0, @udecode/plate-serializer-csv@workspace:^, @udecode/plate-serializer-csv@workspace:packages/serializer-csv": +"@udecode/plate-serializer-csv@npm:24.5.0, @udecode/plate-serializer-csv@workspace:^, @udecode/plate-serializer-csv@workspace:packages/serializer-csv": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-csv@workspace:packages/serializer-csv" dependencies: "@types/papaparse": "npm:^5.3.7" "@udecode/plate-common": "npm:24.4.0" - "@udecode/plate-table": "npm:24.4.0" + "@udecode/plate-table": "npm:24.4.2" papaparse: "npm:^5.4.1" peerDependencies: react: ">=16.8.0" @@ -7765,7 +7765,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-docx@npm:24.4.0, @udecode/plate-serializer-docx@workspace:^, @udecode/plate-serializer-docx@workspace:packages/serializer-docx": +"@udecode/plate-serializer-docx@npm:24.4.2, @udecode/plate-serializer-docx@workspace:^, @udecode/plate-serializer-docx@workspace:packages/serializer-docx": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-docx@workspace:packages/serializer-docx" dependencies: @@ -7775,7 +7775,7 @@ __metadata: "@udecode/plate-indent-list": "npm:24.4.0" "@udecode/plate-media": "npm:24.4.0" "@udecode/plate-paragraph": "npm:24.4.0" - "@udecode/plate-table": "npm:24.4.0" + "@udecode/plate-table": "npm:24.4.2" validator: "npm:^13.9.0" peerDependencies: react: ">=16.8.0" @@ -7804,17 +7804,17 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-serializer-md@npm:24.4.0, @udecode/plate-serializer-md@workspace:^, @udecode/plate-serializer-md@workspace:packages/serializer-md": +"@udecode/plate-serializer-md@npm:24.5.1, @udecode/plate-serializer-md@workspace:^, @udecode/plate-serializer-md@workspace:packages/serializer-md": version: 0.0.0-use.local resolution: "@udecode/plate-serializer-md@workspace:packages/serializer-md" dependencies: "@udecode/plate-basic-marks": "npm:24.4.0" "@udecode/plate-block-quote": "npm:24.4.0" - "@udecode/plate-code-block": "npm:24.4.0" + "@udecode/plate-code-block": "npm:24.4.3" "@udecode/plate-common": "npm:24.4.0" "@udecode/plate-heading": "npm:24.4.0" "@udecode/plate-horizontal-rule": "npm:24.4.0" - "@udecode/plate-link": "npm:24.4.0" + "@udecode/plate-link": "npm:24.5.1" "@udecode/plate-list": "npm:24.4.0" "@udecode/plate-media": "npm:24.4.0" "@udecode/plate-paragraph": "npm:24.4.0" @@ -7861,7 +7861,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-table@npm:24.4.0, @udecode/plate-table@workspace:^, @udecode/plate-table@workspace:packages/table": +"@udecode/plate-table@npm:24.4.2, @udecode/plate-table@workspace:^, @udecode/plate-table@workspace:packages/table": version: 0.0.0-use.local resolution: "@udecode/plate-table@workspace:packages/table" dependencies: @@ -7976,11 +7976,11 @@ __metadata: dependencies: "@udecode/plate-alignment": "npm:24.4.0" "@udecode/plate-autoformat": "npm:24.4.0" - "@udecode/plate-basic-elements": "npm:24.4.0" + "@udecode/plate-basic-elements": "npm:24.4.3" "@udecode/plate-basic-marks": "npm:24.4.0" "@udecode/plate-block-quote": "npm:24.4.0" "@udecode/plate-break": "npm:24.4.0" - "@udecode/plate-code-block": "npm:24.4.0" + "@udecode/plate-code-block": "npm:24.4.3" "@udecode/plate-combobox": "npm:24.4.0" "@udecode/plate-comments": "npm:24.4.0" "@udecode/plate-common": "npm:24.4.0" @@ -7994,7 +7994,7 @@ __metadata: "@udecode/plate-indent-list": "npm:24.4.0" "@udecode/plate-kbd": "npm:24.4.0" "@udecode/plate-line-height": "npm:24.4.0" - "@udecode/plate-link": "npm:24.4.0" + "@udecode/plate-link": "npm:24.5.1" "@udecode/plate-list": "npm:24.4.0" "@udecode/plate-media": "npm:24.4.0" "@udecode/plate-mention": "npm:24.4.0" @@ -8003,14 +8003,14 @@ __metadata: "@udecode/plate-paragraph": "npm:24.4.0" "@udecode/plate-reset-node": "npm:24.4.0" "@udecode/plate-resizable": "npm:24.4.0" - "@udecode/plate-select": "npm:24.4.0" - "@udecode/plate-serializer-csv": "npm:24.4.0" - "@udecode/plate-serializer-docx": "npm:24.4.0" + "@udecode/plate-select": "npm:24.5.0" + "@udecode/plate-serializer-csv": "npm:24.5.0" + "@udecode/plate-serializer-docx": "npm:24.4.2" "@udecode/plate-serializer-html": "npm:24.4.0" - "@udecode/plate-serializer-md": "npm:24.4.0" + "@udecode/plate-serializer-md": "npm:24.5.1" "@udecode/plate-suggestion": "npm:24.4.0" "@udecode/plate-tabbable": "npm:24.4.0" - "@udecode/plate-table": "npm:24.4.0" + "@udecode/plate-table": "npm:24.4.2" "@udecode/plate-trailing-block": "npm:24.4.0" peerDependencies: react: ">=16.8.0"