diff --git a/packages/playground/admin/lib/components/richt-text-editor/plate-plugins.tsx b/packages/playground/admin/lib/components/richt-text-editor/plate-plugins.tsx index a99b6a79c..71bd695c6 100644 --- a/packages/playground/admin/lib/components/richt-text-editor/plate-plugins.tsx +++ b/packages/playground/admin/lib/components/richt-text-editor/plate-plugins.tsx @@ -1,32 +1,9 @@ import { withProps } from '@udecode/cn' -import { - autoformatArrow, - autoformatLegal, - autoformatMath, - autoformatPunctuation, - createAutoformatPlugin, -} from '@udecode/plate-autoformat' -import { - createBoldPlugin, - createItalicPlugin, - createStrikethroughPlugin, - createUnderlinePlugin, - MARK_BOLD, - MARK_ITALIC, - MARK_STRIKETHROUGH, - MARK_UNDERLINE, -} from '@udecode/plate-basic-marks' +import { autoformatArrow, autoformatLegal, autoformatMath, autoformatPunctuation, createAutoformatPlugin } from '@udecode/plate-autoformat' +import { createBoldPlugin, createItalicPlugin, createStrikethroughPlugin, createUnderlinePlugin, MARK_BOLD, MARK_ITALIC, MARK_STRIKETHROUGH, MARK_UNDERLINE } from '@udecode/plate-basic-marks' import { createPlugins, PlateElement, PlateLeaf, RenderAfterEditable } from '@udecode/plate-common' import { createDndPlugin } from '@udecode/plate-dnd' -import { - createHeadingPlugin, - ELEMENT_H1, - ELEMENT_H2, - ELEMENT_H3, - ELEMENT_H4, - ELEMENT_H5, - ELEMENT_H6, -} from '@udecode/plate-heading' +import { createHeadingPlugin, ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6 } from '@udecode/plate-heading' import { createLinkPlugin, ELEMENT_LINK } from '@udecode/plate-link' import { createListPlugin, ELEMENT_LI, ELEMENT_OL, ELEMENT_UL } from '@udecode/plate-list' import { createNodeIdPlugin } from '@udecode/plate-node-id' @@ -42,6 +19,9 @@ import { ListElement } from './plate-ui/list-element' import { ParagraphElement } from './plate-ui/paragraph-element' import { withPlaceholders } from './plate-ui/placeholder' import { withDraggables } from './plate-ui/with-draggables' +import { ELEMENT_IMAGE, ImageElement } from './references/image' +import { createExitBreakPlugin } from '@udecode/plate-break' +import { createIndentPlugin } from '@udecode/plate-indent' export const plugins = createPlugins([ // Nodes @@ -78,6 +58,40 @@ export const plugins = createPlugins([ enableUndoOnDelete: true, }, }), + createIndentPlugin({ + inject: { + props: { + validTypes: [ + ELEMENT_PARAGRAPH, + // ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK + ], + }, + }, + }), + createExitBreakPlugin({ + options: { + rules: [ + { + hotkey: 'mod+enter', + }, + { + hotkey: 'mod+shift+enter', + before: true, + }, + { + hotkey: 'enter', + query: { + start: true, + end: true, + // allow: KEYS_HEADING, + }, + relative: true, + level: 1, + }, + ], + }, + }), + dragOverCursorPlugin, // Deserialization diff --git a/packages/playground/package.json b/packages/playground/package.json index fbdb01798..f33dfdf5a 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -53,12 +53,14 @@ "@udecode/cn": "^31.0.0", "@udecode/plate-autoformat": "^31.0.0", "@udecode/plate-basic-marks": "^31.0.0", + "@udecode/plate-break": "^31.0.0", "@udecode/plate-common": "^31.0.0", "@udecode/plate-cursor": "^31.0.0", "@udecode/plate-dnd": "^31.0.0", "@udecode/plate-floating": "^31.0.0", "@udecode/plate-font": "^31.0.0", "@udecode/plate-heading": "^31.0.0", + "@udecode/plate-indent": "^31.1.0", "@udecode/plate-link": "^31.0.0", "@udecode/plate-list": "^31.1.3", "@udecode/plate-node-id": "^31.0.0", diff --git a/yarn.lock b/yarn.lock index 10c514145..0e9bd39f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1319,12 +1319,14 @@ __metadata: "@udecode/cn": ^31.0.0 "@udecode/plate-autoformat": ^31.0.0 "@udecode/plate-basic-marks": ^31.0.0 + "@udecode/plate-break": ^31.0.0 "@udecode/plate-common": ^31.0.0 "@udecode/plate-cursor": ^31.0.0 "@udecode/plate-dnd": ^31.0.0 "@udecode/plate-floating": ^31.0.0 "@udecode/plate-font": ^31.0.0 "@udecode/plate-heading": ^31.0.0 + "@udecode/plate-indent": ^31.1.0 "@udecode/plate-link": ^31.0.0 "@udecode/plate-list": ^31.1.3 "@udecode/plate-node-id": ^31.0.0 @@ -6341,6 +6343,21 @@ __metadata: languageName: node linkType: hard +"@udecode/plate-break@npm:^31.0.0": + version: 31.0.0 + resolution: "@udecode/plate-break@npm:31.0.0" + peerDependencies: + "@udecode/plate-common": ">=31.0.0" + react: ">=16.8.0" + react-dom: ">=16.8.0" + slate: ">=0.94.0" + slate-history: ">=0.93.0" + slate-hyperscript: ">=0.66.0" + slate-react: ">=0.99.0" + checksum: 1536e5f59891c68e3f40428959f38d6836f48572a568869f0eaa52f9e25cbe1fcc6042a592d4aa737151b7fc35c68f46c41ff14daf938dd1aa7ebd85deaf6b42 + languageName: node + linkType: hard + "@udecode/plate-code-block@npm:31.3.4": version: 31.3.4 resolution: "@udecode/plate-code-block@npm:31.3.4" @@ -6530,7 +6547,7 @@ __metadata: languageName: node linkType: hard -"@udecode/plate-indent@npm:31.1.0": +"@udecode/plate-indent@npm:31.1.0, @udecode/plate-indent@npm:^31.1.0": version: 31.1.0 resolution: "@udecode/plate-indent@npm:31.1.0" peerDependencies: