Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Nov 26, 2024
1 parent 4f03068 commit 38da129
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 21 deletions.
10 changes: 7 additions & 3 deletions apps/www/public/r/styles/default/editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
"route": "https://pro.platejs.org/docs/components/editor"
}
],
"examples": ["editor-default", "editor-disabled", "editor-full-width"]
"examples": [
"editor-default",
"editor-disabled",
"editor-full-width"
]
},
"files": [
{
"content": "'use client';\n\nimport React from 'react';\n\nimport type { PlateContentProps } from '@udecode/plate-common/react';\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@udecode/cn';\nimport {\n PlateContent,\n useEditorContainerRef,\n useEditorRef,\n} from '@udecode/plate-common/react';\nimport { cva } from 'class-variance-authority';\n\nconst editorContainerVariants = cva(\n 'relative w-full cursor-text overflow-y-auto caret-primary selection:bg-brand/25 [&_.slate-selection-area]:border [&_.slate-selection-area]:border-brand/25 [&_.slate-selection-area]:bg-brand/15',\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n variant: {\n default: 'h-full',\n demo: 'h-[650px]',\n },\n },\n }\n);\n\nexport const EditorContainer = ({\n className,\n variant,\n ...props\n}: React.HTMLAttributes<HTMLDivElement> &\n VariantProps<typeof editorContainerVariants>) => {\n const editor = useEditorRef();\n const containerRef = useEditorContainerRef();\n\n return (\n <div\n id={editor.uid}\n ref={containerRef}\n className={cn(\n 'ignore-click-outside/toolbar',\n editorContainerVariants({ variant }),\n className\n )}\n role=\"button\"\n {...props}\n />\n );\n};\n\nEditorContainer.displayName = 'EditorContainer';\n\nconst editorVariants = cva(\n cn(\n 'group/editor',\n 'relative w-full overflow-x-hidden whitespace-pre-wrap break-words',\n 'rounded-md ring-offset-background placeholder:text-muted-foreground/80 focus-visible:outline-none',\n '[&_[data-slate-placeholder]]:text-muted-foreground/80 [&_[data-slate-placeholder]]:!opacity-100',\n '[&_[data-slate-placeholder]]:top-[auto_!important]',\n '[&_strong]:font-bold'\n ),\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n },\n focused: {\n true: 'ring-2 ring-ring ring-offset-2',\n },\n variant: {\n ai: 'w-full px-0 text-base md:text-sm',\n aiChat:\n 'max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-3 py-2 text-base md:text-sm',\n default:\n 'size-full px-16 pb-72 pt-4 text-base sm:px-[max(64px,calc(50%-350px))]',\n demo: 'size-full px-16 pb-72 pt-4 text-base sm:px-[max(64px,calc(50%-350px))]',\n fullWidth: 'size-full px-16 pb-72 pt-4 text-base sm:px-24',\n none: '',\n },\n },\n }\n);\n\nexport type EditorProps = PlateContentProps &\n VariantProps<typeof editorVariants>;\n\nexport const Editor = React.forwardRef<HTMLDivElement, EditorProps>(\n ({ className, disabled, focused, variant, ...props }, ref) => {\n return (\n <PlateContent\n ref={ref}\n className={cn(\n editorVariants({\n disabled,\n focused,\n variant,\n }),\n className\n )}\n disabled={disabled}\n disableDefaultStyles\n {...props}\n />\n );\n }\n);\n\nEditor.displayName = 'Editor';\n",
"content": "'use client';\n\nimport React from 'react';\n\nimport type { PlateContentProps } from '@udecode/plate-common/react';\nimport type { VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@udecode/cn';\nimport {\n PlateContent,\n useEditorContainerRef,\n useEditorRef,\n} from '@udecode/plate-common/react';\nimport { cva } from 'class-variance-authority';\n\nconst editorContainerVariants = cva(\n 'relative w-full cursor-text overflow-y-auto caret-primary selection:bg-brand/25 [&_.slate-selection-area]:border [&_.slate-selection-area]:border-brand/25 [&_.slate-selection-area]:bg-brand/15',\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n variant: {\n default: 'h-full',\n demo: 'h-[650px]',\n select: cn(\n 'group rounded-md border border-input ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2',\n 'has-[[data-readonly]]:w-fit has-[[data-readonly]]:cursor-default has-[[data-readonly]]:border-transparent has-[[data-readonly]]:focus-within:ring-0'\n ),\n },\n },\n }\n);\n\nexport const EditorContainer = ({\n className,\n variant,\n ...props\n}: React.HTMLAttributes<HTMLDivElement> &\n VariantProps<typeof editorContainerVariants>) => {\n const editor = useEditorRef();\n const containerRef = useEditorContainerRef();\n\n return (\n <div\n id={editor.uid}\n ref={containerRef}\n className={cn(\n 'ignore-click-outside/toolbar',\n editorContainerVariants({ variant }),\n className\n )}\n role=\"button\"\n {...props}\n />\n );\n};\n\nEditorContainer.displayName = 'EditorContainer';\n\nconst editorVariants = cva(\n cn(\n 'group/editor',\n 'relative w-full overflow-x-hidden whitespace-pre-wrap break-words',\n 'rounded-md ring-offset-background placeholder:text-muted-foreground/80 focus-visible:outline-none',\n '[&_[data-slate-placeholder]]:text-muted-foreground/80 [&_[data-slate-placeholder]]:!opacity-100',\n '[&_[data-slate-placeholder]]:top-[auto_!important]',\n '[&_strong]:font-bold'\n ),\n {\n defaultVariants: {\n variant: 'default',\n },\n variants: {\n disabled: {\n true: 'cursor-not-allowed opacity-50',\n },\n focused: {\n true: 'ring-2 ring-ring ring-offset-2',\n },\n variant: {\n ai: 'w-full px-0 text-base md:text-sm',\n aiChat:\n 'max-h-[min(70vh,320px)] w-full max-w-[700px] overflow-y-auto px-3 py-2 text-base md:text-sm',\n default:\n 'size-full px-16 pb-72 pt-4 text-base sm:px-[max(64px,calc(50%-350px))]',\n demo: 'size-full px-16 pb-72 pt-4 text-base sm:px-[max(64px,calc(50%-350px))]',\n fullWidth: 'size-full px-16 pb-72 pt-4 text-base sm:px-24',\n none: '',\n select: 'px-3 py-2 text-base data-[readonly]:w-fit',\n },\n },\n }\n);\n\nexport type EditorProps = PlateContentProps &\n VariantProps<typeof editorVariants>;\n\nexport const Editor = React.forwardRef<HTMLDivElement, EditorProps>(\n ({ className, disabled, focused, variant, ...props }, ref) => {\n return (\n <PlateContent\n ref={ref}\n className={cn(\n editorVariants({\n disabled,\n focused,\n variant,\n }),\n className\n )}\n disabled={disabled}\n disableDefaultStyles\n {...props}\n />\n );\n }\n);\n\nEditor.displayName = 'Editor';\n",
"path": "plate-ui/editor.tsx",
"target": "components/plate-ui/editor.tsx",
"type": "registry:ui"
Expand All @@ -20,4 +24,4 @@
"name": "editor",
"registryDependencies": [],
"type": "registry:ui"
}
}
30 changes: 25 additions & 5 deletions apps/www/src/__registry__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,11 @@ export const Index: Record<string, any> = {
description: "",
type: "registry:ui",
registryDependencies: ["plate-element"],
files: ["registry/default/plate-ui/tag-element.tsx"],
files: [{
path: "src/registry/default/plate-ui/tag-element.tsx",
type: "registry:ui",
target: ""
}],
component: React.lazy(() => import("@/registry/default/plate-ui/tag-element.tsx")),
source: "",
category: "",
Expand Down Expand Up @@ -750,7 +754,11 @@ export const Index: Record<string, any> = {
description: "",
type: "registry:ui",
registryDependencies: ["label"],
files: ["registry/default/plate-ui/form.tsx"],
files: [{
path: "src/registry/default/plate-ui/form.tsx",
type: "registry:ui",
target: ""
}],
component: React.lazy(() => import("@/registry/default/plate-ui/form.tsx")),
source: "",
category: "",
Expand Down Expand Up @@ -778,7 +786,11 @@ export const Index: Record<string, any> = {
description: "",
type: "registry:ui",
registryDependencies: [],
files: ["registry/default/plate-ui/label.tsx"],
files: [{
path: "src/registry/default/plate-ui/label.tsx",
type: "registry:ui",
target: ""
}],
component: React.lazy(() => import("@/registry/default/plate-ui/label.tsx")),
source: "",
category: "",
Expand Down Expand Up @@ -1122,7 +1134,11 @@ export const Index: Record<string, any> = {
description: "",
type: "registry:ui",
registryDependencies: ["editor","command","popover","tag-element"],
files: ["registry/default/plate-ui/select-editor.tsx"],
files: [{
path: "src/registry/default/plate-ui/select-editor.tsx",
type: "registry:ui",
target: ""
}],
component: React.lazy(() => import("@/registry/default/plate-ui/select-editor.tsx")),
source: "",
category: "",
Expand Down Expand Up @@ -3190,7 +3206,11 @@ export const Index: Record<string, any> = {
description: "",
type: "registry:example",
registryDependencies: ["form","button","select-editor"],
files: ["registry/default/example/select-editor-demo.tsx"],
files: [{
path: "src/registry/default/example/select-editor-demo.tsx",
type: "registry:example",
target: ""
}],
component: React.lazy(() => import("@/registry/default/example/select-editor-demo.tsx")),
source: "",
category: "",
Expand Down
4 changes: 3 additions & 1 deletion apps/www/src/registry/registry-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,9 @@ export const docExamples: Registry = [
description: 'A form with a select editor component for managing labels.',
title: 'Select Editor Form',
},
files: ['example/select-editor-demo.tsx'],
files: [
{ path: 'example/select-editor-demo.tsx', type: 'registry:example' },
],
name: 'select-editor-demo',
registryDependencies: ['form', 'button', 'select-editor'],
type: 'registry:example',
Expand Down
8 changes: 4 additions & 4 deletions apps/www/src/registry/registry-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ import { withDraggables } from './withDraggables';`,
examples: ['select-editor-demo'],
label: 'New',
},
files: ['plate-ui/select-editor.tsx'],
files: [{ path: 'plate-ui/select-editor.tsx', type: 'registry:ui' }],
name: 'select-editor',
registryDependencies: ['editor', 'command', 'popover', 'tag-element'],
type: 'registry:ui',
Expand Down Expand Up @@ -1421,7 +1421,7 @@ export const uiNodes: Registry = [
],
examples: ['select-editor-demo'],
},
files: ['plate-ui/tag-element.tsx'],
files: [{ path: 'plate-ui/tag-element.tsx', type: 'registry:ui' }],
name: 'tag-element',
registryDependencies: ['plate-element'],
type: 'registry:ui',
Expand Down Expand Up @@ -1613,7 +1613,7 @@ export const uiPrimitives: Registry = [
doc: 'https://ui.shadcn.com/docs/components/form',
},
},
files: ['plate-ui/form.tsx'],
files: [{ path: 'plate-ui/form.tsx', type: 'registry:ui' }],
name: 'form',
registryDependencies: ['label'],
type: 'registry:ui',
Expand All @@ -1640,7 +1640,7 @@ export const uiPrimitives: Registry = [
doc: 'https://ui.shadcn.com/docs/components/label',
},
},
files: ['plate-ui/label.tsx'],
files: [{ path: 'plate-ui/label.tsx', type: 'registry:ui' }],
name: 'label',
registryDependencies: [],
type: 'registry:ui',
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6088,14 +6088,14 @@ __metadata:
languageName: unknown
linkType: soft

"@udecode/plate-basic-elements@npm:40.0.2, @udecode/plate-basic-elements@workspace:^, @udecode/plate-basic-elements@workspace:packages/basic-elements":
"@udecode/plate-basic-elements@npm:40.2.6, @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:40.0.0"
"@udecode/plate-code-block": "npm:40.0.0"
"@udecode/plate-common": "workspace:^"
"@udecode/plate-heading": "npm:40.0.2"
"@udecode/plate-heading": "npm:40.2.6"
peerDependencies:
"@udecode/plate-common": ">=40.0.3"
react: ">=16.8.0"
Expand Down Expand Up @@ -6415,12 +6415,12 @@ __metadata:
languageName: unknown
linkType: soft

"@udecode/plate-docx@npm:40.2.4, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx":
"@udecode/plate-docx@npm:40.2.6, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx":
version: 0.0.0-use.local
resolution: "@udecode/plate-docx@workspace:packages/docx"
dependencies:
"@udecode/plate-common": "workspace:^"
"@udecode/plate-heading": "npm:40.0.2"
"@udecode/plate-heading": "npm:40.2.6"
"@udecode/plate-indent": "npm:40.0.0"
"@udecode/plate-indent-list": "npm:40.0.0"
"@udecode/plate-media": "npm:40.2.4"
Expand Down Expand Up @@ -6529,7 +6529,7 @@ __metadata:
languageName: unknown
linkType: soft

"@udecode/plate-heading@npm:40.0.2, @udecode/plate-heading@workspace:^, @udecode/plate-heading@workspace:packages/heading":
"@udecode/plate-heading@npm:40.2.6, @udecode/plate-heading@workspace:^, @udecode/plate-heading@workspace:packages/heading":
version: 0.0.0-use.local
resolution: "@udecode/plate-heading@workspace:packages/heading"
dependencies:
Expand Down Expand Up @@ -7126,7 +7126,7 @@ __metadata:
dependencies:
"@udecode/plate-alignment": "npm:40.0.0"
"@udecode/plate-autoformat": "npm:40.0.0"
"@udecode/plate-basic-elements": "npm:40.0.2"
"@udecode/plate-basic-elements": "npm:40.2.6"
"@udecode/plate-basic-marks": "npm:40.0.0"
"@udecode/plate-block-quote": "npm:40.0.0"
"@udecode/plate-break": "npm:40.0.0"
Expand All @@ -7136,11 +7136,11 @@ __metadata:
"@udecode/plate-common": "npm:40.0.3"
"@udecode/plate-csv": "npm:40.0.0"
"@udecode/plate-diff": "npm:40.0.0"
"@udecode/plate-docx": "npm:40.2.4"
"@udecode/plate-docx": "npm:40.2.6"
"@udecode/plate-find-replace": "npm:40.0.0"
"@udecode/plate-floating": "npm:40.0.0"
"@udecode/plate-font": "npm:40.0.0"
"@udecode/plate-heading": "npm:40.0.2"
"@udecode/plate-heading": "npm:40.2.6"
"@udecode/plate-highlight": "npm:40.0.0"
"@udecode/plate-horizontal-rule": "npm:40.0.0"
"@udecode/plate-html": "npm:40.0.0"
Expand Down

0 comments on commit 38da129

Please sign in to comment.