Skip to content

Commit

Permalink
Revert "fix"
Browse files Browse the repository at this point in the history
This reverts commit c43ea8d.
  • Loading branch information
zbeyens committed Dec 19, 2024
1 parent c43ea8d commit 778cb4b
Show file tree
Hide file tree
Showing 30 changed files with 468 additions and 1,195 deletions.
5 changes: 3 additions & 2 deletions apps/www/src/app/(app)/_components/installation-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ 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 @@ -317,11 +318,11 @@ export default function InstallationTab() {
pluginsCode.join('\n'),
' ],',
' override: {',
` components: ${hasPlaceholder ? 'withPlaceholders(' : ''}({`,
` components: ${hasDraggable ? 'withDraggables(' : ''}${hasPlaceholder ? 'withPlaceholders(' : ''}({`,
...componentsWithPluginKey.map(
({ pluginKey, usage }) => ` [${pluginKey}]: ${usage},`
),
` })${hasPlaceholder ? ')' : ''},`,
` })${hasPlaceholder ? ')' : ''}${hasDraggable ? ')' : ''},`,
' },',
' 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,56 +92,59 @@ 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: 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: 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,
})
),
},
plugins: [
...copilotPlugins,
Expand Down
8 changes: 5 additions & 3 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,6 +60,7 @@ 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 @@ -128,6 +129,8 @@ 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 @@ -300,9 +303,8 @@ export default async function SlateToHtmlBlock() {

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

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

0 comments on commit 778cb4b

Please sign in to comment.