Skip to content

Commit

Permalink
feat(playground): add more plate plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Apr 26, 2024
1 parent 2c51f5f commit 2a6abed
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -42,6 +19,8 @@ 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 { createExitBreakPlugin } from '@udecode/plate-break'
import { createIndentPlugin } from '@udecode/plate-indent'

export const plugins = createPlugins([
// Nodes
Expand Down Expand Up @@ -78,6 +57,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
Expand Down
2 changes: 2 additions & 0 deletions packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 18 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2a6abed

Please sign in to comment.