Skip to content

Commit

Permalink
Merge pull request #2695 from udecode/registry
Browse files Browse the repository at this point in the history
Update Registry
  • Loading branch information
zbeyens authored Oct 19, 2023
2 parents 95bd7bb + 9eed3a8 commit 603b677
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/www/public/registry/styles/default/draggable.json
Original file line number Diff line number Diff line change
Expand Up @@ -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<DragItemNode, unknown>;\n dragItem: DragItemNode;\n nodeRef: any;\n id: string;\n }\n ) => boolean;\n}\n\nconst Draggable = forwardRef<HTMLDivElement, DraggableProps>(\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 <div\n className={cn(\n 'relative',\n isDragging && 'opacity-50',\n 'group',\n className\n )}\n ref={ref}\n >\n <div\n className={cn(\n 'pointer-events-none absolute top-0 flex h-full -translate-x-full cursor-text opacity-0 group-hover:opacity-100',\n classNames.gutterLeft\n )}\n {...gutterLeftProps}\n >\n <div className={cn('flex h-[1.5em]', classNames.blockToolbarWrapper)}>\n <div\n className={cn(\n 'pointer-events-auto mr-1 flex items-center',\n classNames.blockToolbar\n )}\n >\n <Tooltip>\n <TooltipTrigger ref={handleRef}>\n <Icons.dragHandle className=\"h-4 w-4 text-muted-foreground\" />\n </TooltipTrigger>\n <TooltipContent>Drag to move</TooltipContent>\n </Tooltip>\n </div>\n </div>\n </div>\n\n <div className={cn('', classNames.blockWrapper)} ref={previewRef}>\n {children}\n\n {!!dropLine && (\n <div\n className={cn(\n 'absolute inset-x-0 h-0.5 opacity-100',\n 'bg-ring',\n dropLine === 'top' && '-top-px',\n dropLine === 'bottom' && '-bottom-px',\n classNames.dropLine\n )}\n {...droplineProps}\n />\n )}\n </div>\n </div>\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<DragItemNode, unknown>;\n dragItem: DragItemNode;\n nodeRef: any;\n id: string;\n }\n ) => boolean;\n}\n\nconst dragHandle = (\n <Tooltip>\n <TooltipTrigger>\n <Icons.dragHandle className=\"h-4 w-4 text-muted-foreground\" />\n </TooltipTrigger>\n <TooltipContent>Drag to move</TooltipContent>\n </Tooltip>\n);\n\nconst Draggable = forwardRef<HTMLDivElement, DraggableProps>(\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 <div\n className={cn(\n 'relative',\n isDragging && 'opacity-50',\n 'group',\n className\n )}\n ref={ref}\n {...groupProps}\n >\n <div\n className={cn(\n 'pointer-events-none absolute top-0 flex h-full -translate-x-full cursor-text opacity-0 group-hover:opacity-100',\n classNames.gutterLeft\n )}\n {...gutterLeftProps}\n >\n <div className={cn('flex h-[1.5em]', classNames.blockToolbarWrapper)}>\n <div\n className={cn(\n 'pointer-events-auto mr-1 flex items-center',\n classNames.blockToolbar\n )}\n >\n <div ref={handleRef} className=\"h-4 w-4\">\n {isHovered && dragHandle}\n </div>\n </div>\n </div>\n </div>\n\n <div className={cn('', classNames.blockWrapper)} ref={previewRef}>\n {children}\n\n {!!dropLine && (\n <div\n className={cn(\n 'absolute inset-x-0 h-0.5 opacity-100',\n 'bg-ring',\n dropLine === 'top' && '-top-px',\n dropLine === 'bottom' && '-bottom-px',\n classNames.dropLine\n )}\n {...droplineProps}\n />\n )}\n </div>\n </div>\n );\n }\n);\nDraggable.displayName = 'Draggable';\n\nexport { Draggable };\n"
},
{
"name": "with-draggables.tsx",
Expand Down
42 changes: 21 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 603b677

Please sign in to comment.