Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 19, 2024
1 parent 037e0db commit c43ea8d
Show file tree
Hide file tree
Showing 30 changed files with 1,195 additions and 468 deletions.
5 changes: 2 additions & 3 deletions apps/www/src/app/(app)/_components/installation-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ export default function InstallationTab() {
pluginsCode.push(formattedPlugin + ',');
});

const hasDraggable = components.some((comp) => comp.id === 'draggable');
const hasPlaceholder = components.some((comp) => comp.id === 'placeholder');

const usageCode = [
Expand All @@ -318,11 +317,11 @@ export default function InstallationTab() {
pluginsCode.join('\n'),
' ],',
' override: {',
` components: ${hasDraggable ? 'withDraggables(' : ''}${hasPlaceholder ? 'withPlaceholders(' : ''}({`,
` components: ${hasPlaceholder ? 'withPlaceholders(' : ''}({`,
...componentsWithPluginKey.map(
({ pluginKey, usage }) => ` [${pluginKey}]: ${usage},`
),
` })${hasPlaceholder ? ')' : ''}${hasDraggable ? ')' : ''},`,
` })${hasPlaceholder ? ')' : ''},`,
' },',
' value: [',
' {',
Expand Down
20 changes: 10 additions & 10 deletions apps/www/src/config/customizer-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ export const customizerItems: Record<string, SettingPlugin> = {
[DndPlugin.key]: {
id: DndPlugin.key,
badges: [customizerBadges.handler, customizerBadges.ui],
components: [
{
id: 'draggable',
filename: 'with-draggables',
label: 'Draggable',
registry: 'draggable',
route: getComponentNavItem('draggable').href,
usage: 'withDraggables',
},
],
// components: [
// {
// id: 'draggable',
// filename: 'with-draggables',
// label: 'Draggable',
// registry: 'draggable',
// route: getComponentNavItem('draggable').href,
// usage: 'withDraggables',
// },
// ],
customImports: [
`import { DndProvider } from 'react-dnd';`,
`import { HTML5Backend } from 'react-dnd-html5-backend';`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,59 +92,56 @@ import { TableElement } from '@/registry/default/plate-ui/table-element';
import { TableRowElement } from '@/registry/default/plate-ui/table-row-element';
import { TocElement } from '@/registry/default/plate-ui/toc-element';
import { ToggleElement } from '@/registry/default/plate-ui/toggle-element';
import { withDraggables } from '@/registry/default/plate-ui/with-draggables';

export const useCreateEditor = () => {
return usePlateEditor({
override: {
components: withDraggables(
withPlaceholders({
[AIPlugin.key]: AILeaf,
[AudioPlugin.key]: MediaAudioElement,
[BlockquotePlugin.key]: BlockquoteElement,
[BoldPlugin.key]: withProps(PlateLeaf, { as: 'strong' }),
[CodeBlockPlugin.key]: CodeBlockElement,
[CodeLinePlugin.key]: CodeLineElement,
[CodePlugin.key]: CodeLeaf,
[CodeSyntaxPlugin.key]: CodeSyntaxLeaf,
[ColumnItemPlugin.key]: ColumnElement,
[ColumnPlugin.key]: ColumnGroupElement,
[CommentsPlugin.key]: CommentLeaf,
[DatePlugin.key]: DateElement,
[EmojiInputPlugin.key]: EmojiInputElement,
[ExcalidrawPlugin.key]: ExcalidrawElement,
[FilePlugin.key]: MediaFileElement,
[HEADING_KEYS.h1]: withProps(HeadingElement, { variant: 'h1' }),
[HEADING_KEYS.h2]: withProps(HeadingElement, { variant: 'h2' }),
[HEADING_KEYS.h3]: withProps(HeadingElement, { variant: 'h3' }),
[HEADING_KEYS.h4]: withProps(HeadingElement, { variant: 'h4' }),
[HEADING_KEYS.h5]: withProps(HeadingElement, { variant: 'h5' }),
[HEADING_KEYS.h6]: withProps(HeadingElement, { variant: 'h6' }),
[HighlightPlugin.key]: HighlightLeaf,
[HorizontalRulePlugin.key]: HrElement,
[ImagePlugin.key]: ImageElement,
[ItalicPlugin.key]: withProps(PlateLeaf, { as: 'em' }),
[KbdPlugin.key]: KbdLeaf,
[LinkPlugin.key]: LinkElement,
[MediaEmbedPlugin.key]: MediaEmbedElement,
[MentionInputPlugin.key]: MentionInputElement,
[MentionPlugin.key]: MentionElement,
[ParagraphPlugin.key]: ParagraphElement,
[PlaceholderPlugin.key]: MediaPlaceholderElement,
[SlashInputPlugin.key]: SlashInputElement,
[StrikethroughPlugin.key]: withProps(PlateLeaf, { as: 's' }),
[SubscriptPlugin.key]: withProps(PlateLeaf, { as: 'sub' }),
[SuperscriptPlugin.key]: withProps(PlateLeaf, { as: 'sup' }),
[TableCellHeaderPlugin.key]: TableCellHeaderElement,
[TableCellPlugin.key]: TableCellElement,
[TablePlugin.key]: TableElement,
[TableRowPlugin.key]: TableRowElement,
[TocPlugin.key]: TocElement,
[TogglePlugin.key]: ToggleElement,
[UnderlinePlugin.key]: withProps(PlateLeaf, { as: 'u' }),
[VideoPlugin.key]: MediaVideoElement,
})
),
components: withPlaceholders({
[AIPlugin.key]: AILeaf,
[AudioPlugin.key]: MediaAudioElement,
[BlockquotePlugin.key]: BlockquoteElement,
[BoldPlugin.key]: withProps(PlateLeaf, { as: 'strong' }),
[CodeBlockPlugin.key]: CodeBlockElement,
[CodeLinePlugin.key]: CodeLineElement,
[CodePlugin.key]: CodeLeaf,
[CodeSyntaxPlugin.key]: CodeSyntaxLeaf,
[ColumnItemPlugin.key]: ColumnElement,
[ColumnPlugin.key]: ColumnGroupElement,
[CommentsPlugin.key]: CommentLeaf,
[DatePlugin.key]: DateElement,
[EmojiInputPlugin.key]: EmojiInputElement,
[ExcalidrawPlugin.key]: ExcalidrawElement,
[FilePlugin.key]: MediaFileElement,
[HEADING_KEYS.h1]: withProps(HeadingElement, { variant: 'h1' }),
[HEADING_KEYS.h2]: withProps(HeadingElement, { variant: 'h2' }),
[HEADING_KEYS.h3]: withProps(HeadingElement, { variant: 'h3' }),
[HEADING_KEYS.h4]: withProps(HeadingElement, { variant: 'h4' }),
[HEADING_KEYS.h5]: withProps(HeadingElement, { variant: 'h5' }),
[HEADING_KEYS.h6]: withProps(HeadingElement, { variant: 'h6' }),
[HighlightPlugin.key]: HighlightLeaf,
[HorizontalRulePlugin.key]: HrElement,
[ImagePlugin.key]: ImageElement,
[ItalicPlugin.key]: withProps(PlateLeaf, { as: 'em' }),
[KbdPlugin.key]: KbdLeaf,
[LinkPlugin.key]: LinkElement,
[MediaEmbedPlugin.key]: MediaEmbedElement,
[MentionInputPlugin.key]: MentionInputElement,
[MentionPlugin.key]: MentionElement,
[ParagraphPlugin.key]: ParagraphElement,
[PlaceholderPlugin.key]: MediaPlaceholderElement,
[SlashInputPlugin.key]: SlashInputElement,
[StrikethroughPlugin.key]: withProps(PlateLeaf, { as: 's' }),
[SubscriptPlugin.key]: withProps(PlateLeaf, { as: 'sub' }),
[SuperscriptPlugin.key]: withProps(PlateLeaf, { as: 'sup' }),
[TableCellHeaderPlugin.key]: TableCellHeaderElement,
[TableCellPlugin.key]: TableCellElement,
[TablePlugin.key]: TableElement,
[TableRowPlugin.key]: TableRowElement,
[TocPlugin.key]: TocElement,
[TogglePlugin.key]: ToggleElement,
[UnderlinePlugin.key]: withProps(PlateLeaf, { as: 'u' }),
[VideoPlugin.key]: MediaVideoElement,
}),
},
plugins: [
...copilotPlugins,
Expand Down
8 changes: 3 additions & 5 deletions apps/www/src/registry/default/block/slate-to-html/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import {
BaseTableRowPlugin,
} from '@udecode/plate-table';
import { BaseTogglePlugin } from '@udecode/plate-toggle';
import { cookies } from 'next/headers';
import fs from 'node:fs/promises';
import path from 'node:path';
import Prism from 'prismjs';
Expand Down Expand Up @@ -129,8 +128,6 @@ import { TableRowElementStatic } from '@/registry/default/plate-ui/table-row-ele
import { TocElementStatic } from '@/registry/default/plate-ui/toc-element-static';
import { ToggleElementStatic } from '@/registry/default/plate-ui/toggle-element-static';

export const dynamic = 'force-dynamic';

export const description = 'Slate to HTML';

export const iframeHeight = '800px';
Expand Down Expand Up @@ -303,8 +300,9 @@ export default async function SlateToHtmlBlock() {

const tailwindCss = await getCachedTailwindCss();
const prismCss = await getCachedPrismCss();
const cookieStore = await cookies();
const theme = cookieStore.get('theme')?.value;
// const cookieStore = await cookies();
// const theme = cookieStore.get('theme')?.value;
const theme = 'light';

// Get the editor content HTML using EditorStatic
const editorHtml = await serializeHtml(editor, {
Expand Down
Loading

0 comments on commit c43ea8d

Please sign in to comment.