platejs 54.0.0-beta.2 → 54.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +36 -8
- package/dist/EditorStatic-BTyhgdYL.d.ts +792 -0
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.js +4 -2
- package/dist/ai/lib/aiDraftSession.js +1081 -0
- package/dist/ai/{react → lib}/aiOutputLanding.internal.js +90 -96
- package/dist/ai/lib/aiPolicy.internal.js +471 -0
- package/dist/ai/lib/editorAgent.js +3441 -0
- package/dist/ai/lib/editorAgentDispatcher.internal.js +205 -0
- package/dist/ai/lib/editorAgentPresence.internal.js +114 -0
- package/dist/ai/lib/editorAgentSync.internal.js +306 -0
- package/dist/ai/lib/inkRuntime.internal.js +8 -0
- package/dist/ai/lib/lockedContext.internal.js +144 -0
- package/dist/ai/lib/lockedContext.js +272 -0
- package/dist/ai/lib/registerEditorTools.js +311 -0
- package/dist/ai/lib/webmcpConfinement.internal.js +8 -0
- package/dist/ai/react/AIPlugin.js +246 -0
- package/dist/ai/react/CopilotPlugin.js +359 -191
- package/dist/ai/react/copilotInline.internal.js +359 -0
- package/dist/ai/react/index.d.ts +327 -1007
- package/dist/ai/react/index.js +3 -3
- package/dist/ai/react/useEditorAgent.js +514 -0
- package/dist/authored/AuthoredPlugin.js +35 -3
- package/dist/authored/index.d.ts +5 -4
- package/dist/authored/index.js +3 -2
- package/dist/authored/suggestionColorOf.js +20 -0
- package/dist/{index-hsC_sOn2.d.ts → authored-CYoZAxr--Ba0JwRbO.d.ts} +198 -87
- package/dist/clipboard-format-key-CMZ3jPZO-DEODtsVZ.d.ts +1 -0
- package/dist/code-block/codemirror/createCodeMirrorAdapter.js +236 -67
- package/dist/code-block/codemirror/index.d.ts +2 -1
- package/dist/comment-anchor.internal-DQfEtr1Z.d.ts +28 -0
- package/dist/compiler/index.d.ts +9 -3
- package/dist/compiler/index.js +3 -1
- package/dist/{core-BJG8l_mk.d.ts → core-ClO5Umhx.d.ts} +5480 -7255
- package/dist/core.js +3 -12
- package/dist/diff/index.d.ts +3 -30
- package/dist/docs/agents/mcp.md +131 -0
- package/dist/docs/agents/skills.md +71 -0
- package/dist/docs/agents.md +79 -0
- package/dist/docs/ai-agents.md +80 -0
- package/dist/docs/ai.md +622 -387
- package/dist/docs/annotations.md +41 -122
- package/dist/docs/api/anchor.md +17 -2
- package/dist/docs/api/core/plate-components.md +78 -196
- package/dist/docs/api/core/plate-controller.md +6 -4
- package/dist/docs/api/core/plate-editor.md +35 -132
- package/dist/docs/api/core/plate-plugin.md +429 -560
- package/dist/docs/api/core/plate-store.md +21 -20
- package/dist/docs/api/core.md +261 -441
- package/dist/docs/api/document-change.md +60 -28
- package/dist/docs/api/dom.md +82 -107
- package/dist/docs/api/editor-api.md +86 -51
- package/dist/docs/api/editor-transforms.md +52 -51
- package/dist/docs/api/element.md +3 -3
- package/dist/docs/api/location.md +7 -14
- package/dist/docs/api/node.md +6 -7
- package/dist/docs/api/path.md +3 -3
- package/dist/docs/api/plate.md +21 -13
- package/dist/docs/api/point.md +4 -3
- package/dist/docs/api/range.md +21 -2
- package/dist/docs/api/react-hooks.md +288 -188
- package/dist/docs/api/resizable.md +20 -42
- package/dist/docs/api/selection.md +12 -4
- package/dist/docs/api/text.md +3 -3
- package/dist/docs/api/utils.md +23 -25
- package/dist/docs/authored-changes.md +66 -51
- package/dist/docs/autoformat.md +24 -13
- package/dist/docs/basic-blocks.md +55 -59
- package/dist/docs/basic-marks.md +11 -48
- package/dist/docs/block-menu.md +26 -19
- package/dist/docs/block-placeholder.md +59 -64
- package/dist/docs/blockquote.md +31 -19
- package/dist/docs/board.md +187 -73
- package/dist/docs/bold.md +1 -9
- package/dist/docs/browser.md +6 -17
- package/dist/docs/business/compliance-pdf.md +54 -0
- package/dist/docs/business/security-kernel.md +57 -0
- package/dist/docs/business/security-proof.md +61 -0
- package/dist/docs/business/verify.md +78 -0
- package/dist/docs/business.md +143 -0
- package/dist/docs/callout.md +130 -52
- package/dist/docs/clear-formatting.md +5 -15
- package/dist/docs/clipboard.md +48 -28
- package/dist/docs/code-block.md +168 -68
- package/dist/docs/code.md +1 -7
- package/dist/docs/collaboration.md +127 -0
- package/dist/docs/column.md +36 -31
- package/dist/docs/combobox.md +65 -100
- package/dist/docs/comment.md +219 -158
- package/dist/docs/comparison.md +128 -0
- package/dist/docs/components/toolbar-buttons.md +38 -0
- package/dist/docs/controlled.md +36 -22
- package/dist/docs/copilot.md +215 -203
- package/dist/docs/date.md +20 -20
- package/dist/docs/debugging.md +5 -14
- package/dist/docs/deck.md +173 -0
- package/dist/docs/decorations.md +3 -4
- package/dist/docs/details.md +69 -17
- package/dist/docs/diff.md +109 -0
- package/dist/docs/discussion.md +45 -31
- package/dist/docs/dnd.md +66 -68
- package/dist/docs/document-meta.md +36 -30
- package/dist/docs/document-model.md +26 -13
- package/dist/docs/docx.md +211 -151
- package/dist/docs/dom-coverage.md +6 -1
- package/dist/docs/editing-behavior.md +5 -8
- package/dist/docs/editor-methods.md +50 -26
- package/dist/docs/editor.md +149 -158
- package/dist/docs/emoji.md +56 -52
- package/dist/docs/equation.md +48 -26
- package/dist/docs/examples/collaboration-example.md +21 -30
- package/dist/docs/examples/editable-voids.md +4 -3
- package/dist/docs/examples/export.md +56 -39
- package/dist/docs/examples/huge-document.md +8 -0
- package/dist/docs/examples/hundreds-editors.md +2 -0
- package/dist/docs/examples/merge.md +50 -0
- package/dist/docs/examples/preview-markdown.md +2 -0
- package/dist/docs/examples/version-history.md +35 -13
- package/dist/docs/exit-break.md +39 -74
- package/dist/docs/external-text.md +28 -13
- package/dist/docs/field.md +683 -0
- package/dist/docs/find.md +110 -97
- package/dist/docs/font.md +26 -42
- package/dist/docs/footnote.md +252 -242
- package/dist/docs/form.md +4 -2
- package/dist/docs/format-painter.md +6 -16
- package/dist/docs/heading.md +20 -11
- package/dist/docs/highlight.md +2 -8
- package/dist/docs/history.md +216 -76
- package/dist/docs/horizontal-rule.md +22 -34
- package/dist/docs/html.md +79 -37
- package/dist/docs/indent.md +41 -80
- package/dist/docs/index.md +47 -72
- package/dist/docs/ink.md +275 -0
- package/dist/docs/installation/manual.md +27 -36
- package/dist/docs/installation/next.md +23 -24
- package/dist/docs/installation/node.md +17 -17
- package/dist/docs/installation/plate-ui.md +90 -54
- package/dist/docs/installation/react.md +56 -20
- package/dist/docs/installation/rsc.md +9 -15
- package/dist/docs/installation.md +11 -32
- package/dist/docs/italic.md +1 -7
- package/dist/docs/kbd.md +1 -7
- package/dist/docs/license.md +59 -0
- package/dist/docs/line-height.md +2 -12
- package/dist/docs/link.md +120 -147
- package/dist/docs/lint.md +181 -132
- package/dist/docs/list.md +146 -50
- package/dist/docs/live-block.md +189 -0
- package/dist/docs/llms.txt +102 -80
- package/dist/docs/lock.md +298 -0
- package/dist/docs/markdown.md +299 -99
- package/dist/docs/media.md +240 -219
- package/dist/docs/mention.md +46 -44
- package/dist/docs/migration-v54.md +361 -0
- package/dist/docs/mobile.md +415 -0
- package/dist/docs/multi-select.md +30 -34
- package/dist/docs/navigation-feedback.md +23 -40
- package/dist/docs/pagination.md +151 -128
- package/dist/docs/performance.md +13 -17
- package/dist/docs/plugin-components.md +23 -20
- package/dist/docs/plugin-context.md +18 -13
- package/dist/docs/plugin-input-rules.md +169 -171
- package/dist/docs/plugin-methods.md +74 -28
- package/dist/docs/plugin-rules.md +23 -47
- package/dist/docs/plugin-shortcuts.md +70 -14
- package/dist/docs/plugin.md +59 -8
- package/dist/docs/prompt-editor.md +334 -0
- package/dist/docs/reference.md +192 -0
- package/dist/docs/releases.md +3 -1
- package/dist/docs/roots.md +157 -35
- package/dist/docs/rtl.md +8 -4
- package/dist/docs/schema.md +18 -7
- package/dist/docs/selection.md +17 -5
- package/dist/docs/serializing.md +102 -15
- package/dist/docs/single-block.md +1 -3
- package/dist/docs/slash-command.md +78 -35
- package/dist/docs/static.md +122 -54
- package/dist/docs/strikethrough.md +1 -7
- package/dist/docs/subscript.md +1 -7
- package/dist/docs/suggestion.md +96 -92
- package/dist/docs/superscript.md +1 -7
- package/dist/docs/sync.md +358 -0
- package/dist/docs/tabbable.md +56 -93
- package/dist/docs/table.md +166 -50
- package/dist/docs/text-align.md +8 -18
- package/dist/docs/toc.md +48 -72
- package/dist/docs/toolbar.md +102 -92
- package/dist/docs/trailing-block.md +19 -50
- package/dist/docs/transactions.md +2 -2
- package/dist/docs/troubleshooting.md +5 -5
- package/dist/docs/underline.md +3 -9
- package/dist/docs/unit-testing.md +37 -6
- package/dist/docs/upload.md +183 -58
- package/dist/docx/export/index.d.ts +212 -59
- package/dist/docx/export/index.js +2 -1
- package/dist/docx/export/lib/compileAst.js +2552 -0
- package/dist/docx/export/lib/docxComments.js +153 -0
- package/dist/docx/export/lib/exportDocx.js +585 -229
- package/dist/docx/export/lib/mathOmml.js +232 -0
- package/dist/docx/export/lib/ooxmlBuilder.js +2596 -0
- package/dist/docx/export/lib/outputSafety.js +241 -84
- package/dist/docx/export/lib/reviewProjection.js +332 -120
- package/dist/docx/export/lib/sourceEnvelopePatcher.js +1169 -0
- package/dist/docx/export/lib/sourcePreservation.js +233 -110
- package/dist/docx/export/lib/wordStyles.js +450 -0
- package/dist/docx/html/cleanWordHtml.internal.js +398 -115
- package/dist/docx/html/domParser.internal.js +4 -0
- package/dist/docx/import/index.d.ts +37 -5
- package/dist/docx/import/index.js +2 -1
- package/dist/docx/import/lib/docxComments.js +151 -0
- package/dist/docx/import/lib/importDocx.js +3516 -1082
- package/dist/docx/import/lib/opcRelationships.js +88 -0
- package/dist/docx/import/lib/readWordDocument.js +2534 -0
- package/dist/docx/import/lib/wordStyles.js +638 -0
- package/dist/docx/internal/abort.js +3 -3
- package/dist/docx/internal/colors.js +307 -0
- package/dist/docx/internal/diagnostics.js +68 -0
- package/dist/docx/internal/docxComments.js +34 -0
- package/dist/docx/internal/docxPackage.js +343 -71
- package/dist/docx/internal/packageParts.js +17 -18
- package/dist/docx/internal/pageLayout.js +313 -0
- package/dist/docx/internal/readDocxNumbering.js +79 -59
- package/dist/docx/internal/reviewPart.js +68 -37
- package/dist/docx/internal/source.js +1 -0
- package/dist/docx/internal/sourceEligibility.js +385 -60
- package/dist/docx/internal/sourceEnvelope.js +473 -0
- package/dist/docx/internal/tableBorders.js +79 -0
- package/dist/docx/internal/wordFields.js +40 -0
- package/dist/docx/internal/wordMath.js +136 -166
- package/dist/docx/internal/xmlTree.js +288 -0
- package/dist/docx/internal/xmlWriter.js +44 -0
- package/dist/docx/paste/index.d.ts +28 -6
- package/dist/docx/paste/lib/WordPastePlugin.js +78 -107
- package/dist/dom/index.d.ts +2 -7
- package/dist/dom/index.js +2 -2
- package/dist/dom/plite-dom.internal.js +2 -2
- package/dist/facade.js +3 -3
- package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +170 -87
- package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +140 -27
- package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +160 -82
- package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +66 -30
- package/dist/features/basic-styles/lib/BaseStylePlugins.js +144 -89
- package/dist/features/board/index.d.ts +2 -2
- package/dist/features/board/index.js +4 -3
- package/dist/features/board/lib/BaseBoardArrowPlugin.js +90 -87
- package/dist/features/board/lib/BaseBoardFramePlugin.js +7 -7
- package/dist/features/board/lib/BaseBoardGeoPlugin.js +3 -2
- package/dist/features/board/lib/BaseBoardImagePlugin.js +9 -6
- package/dist/features/board/lib/BaseBoardNotePlugin.js +3 -2
- package/dist/features/board/lib/BaseBoardPlugin.js +473 -281
- package/dist/features/board/lib/BaseBoardStrokePlugin.js +9 -6
- package/dist/features/board/lib/BaseBoardTextPlugin.js +13 -0
- package/dist/features/board/lib/boardArrow.internal.js +7 -5
- package/dist/features/board/lib/boardCopy.internal.js +42 -36
- package/dist/features/board/lib/boardFrame.internal.js +5 -7
- package/dist/features/board/lib/boardGeometry.internal.js +127 -0
- package/dist/features/board/lib/boardHeights.internal.js +57 -0
- package/dist/features/board/lib/boardHtml.internal.js +51 -34
- package/dist/features/board/lib/boardMember.internal.js +10 -10
- package/dist/features/board/lib/boardShape.internal.js +10 -119
- package/dist/features/board/lib/boardStroke.internal.js +13 -1
- package/dist/features/board/lib/boardStyle.internal.js +11 -7
- package/dist/features/board/lib/boardTypes.internal.js +28 -0
- package/dist/features/callout/index.d.ts +2 -84
- package/dist/features/callout/lib/BaseCalloutPlugin.js +464 -18
- package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +236 -194
- package/dist/features/code-block/lib/CodeBlockRules.js +133 -14
- package/dist/features/column/index.d.ts +2 -0
- package/dist/features/column/lib/BaseColumnPlugin.js +767 -0
- package/dist/features/comments/BaseCommentsPlugin.js +1832 -729
- package/dist/features/comments/comment-active-presentations.internal.js +86 -0
- package/dist/features/comments/comment-range-reader.internal.js +12 -0
- package/dist/features/comments/comment-thread-index.internal.js +869 -0
- package/dist/features/comments/comment-unresolved-index.internal.js +102 -0
- package/dist/features/comments/comment-validation.internal.js +136 -0
- package/dist/features/comments/fitCommentBody.js +338 -0
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +3 -2
- package/dist/features/date/index.d.ts +3 -2
- package/dist/features/date/lib/BaseDatePlugin.js +126 -33
- package/dist/features/details/index.d.ts +11 -4
- package/dist/features/details/lib/BaseDetailsPlugin.js +602 -217
- package/dist/features/field/index.d.ts +2 -0
- package/dist/features/field/index.js +4 -0
- package/dist/features/field/lib/BaseFieldPlugin.js +682 -0
- package/dist/features/field/lib/applyFieldValues.js +579 -0
- package/dist/features/field/lib/fieldCache.internal.js +67 -0
- package/dist/features/field/lib/fieldRules.internal.js +658 -0
- package/dist/features/find/index.d.ts +125 -40
- package/dist/features/find/lib/BaseFindPlugin.js +1952 -207
- package/dist/features/footnote/index.d.ts +429 -2
- package/dist/features/footnote/lib/BaseFootnotePlugin.js +512 -180
- package/dist/features/indent/lib/BaseIndentPlugin.js +226 -76
- package/dist/features/indent/lib/indentHtml.internal.js +35 -0
- package/dist/features/indent/lib/indentLevel.internal.js +3 -3
- package/dist/features/ink/index.d.ts +2 -2
- package/dist/features/ink/index.js +2 -2
- package/dist/features/ink/lib/BaseInkPlugin.js +891 -155
- package/dist/features/ink/lib/inkAnchor.internal.js +436 -0
- package/dist/features/ink/lib/inkCodec.internal.js +145 -0
- package/dist/features/ink/lib/inkMatch.internal.js +236 -71
- package/dist/features/ink/lib/inkPlaces.internal.js +219 -71
- package/dist/features/ink/lib/inkReflow.internal.js +406 -0
- package/dist/features/ink/lib/inkSvg.internal.js +419 -0
- package/dist/features/link/lib/BaseLinkPlugin.js +504 -193
- package/dist/features/lint/index.d.ts +57 -30
- package/dist/features/lint/lib/BaseLintPlugin.js +581 -186
- package/dist/features/list/lib/BaseListPlugin.js +105 -690
- package/dist/features/list/lib/listCommands.internal.js +161 -0
- package/dist/features/list/lib/listFamily.internal.js +68 -23
- package/dist/features/list/lib/listHtml.internal.js +185 -69
- package/dist/features/list/lib/listIndex.internal.js +54 -20
- package/dist/features/list/lib/listKeyboard.internal.js +181 -0
- package/dist/features/list/lib/listMarkdown.internal.js +123 -0
- package/dist/features/list/lib/listNumbering.internal.js +1 -1
- package/dist/features/list/lib/listRules.internal.js +125 -0
- package/dist/features/lock/index.d.ts +2 -0
- package/dist/features/lock/index.js +2 -0
- package/dist/features/lock/lib/BaseLockPlugin.js +761 -0
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +5 -5
- package/dist/features/media/lib/BaseMediaPlugin.js +120 -155
- package/dist/features/media/lib/image/BaseImagePlugin.js +128 -154
- package/dist/features/media/lib/media/parseMediaEmbedUrl.internal.js +326 -0
- package/dist/features/media/lib/media/parseMediaEmbedUrl.js +12 -0
- package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +68 -11
- package/dist/features/media/lib/mediaHtml.internal.js +2 -2
- package/dist/features/media/lib/mediaPasteRule.internal.js +89 -0
- package/dist/features/media/lib/mediaPlugin.internal.js +201 -0
- package/dist/features/mention/index.d.ts +2 -72
- package/dist/features/mention/lib/BaseMentionPlugin.js +97 -49
- package/dist/features/reference/index.d.ts +240 -0
- package/dist/features/reference/index.js +2 -0
- package/dist/features/reference/lib/BaseReferencePlugin.js +598 -0
- package/dist/features/table/index.d.ts +3 -2
- package/dist/features/table/lib/BaseTablePlugin.js +1312 -447
- package/dist/features/table/lib/internal/authoredProjection.js +172 -0
- package/dist/features/table/lib/internal/axisMove.js +244 -0
- package/dist/features/table/lib/internal/docxBorders.js +79 -0
- package/dist/features/table/lib/internal/grid.js +34 -1
- package/dist/features/table/lib/internal/mutation.js +53 -141
- package/dist/features/table/lib/internal/paste.js +66 -3
- package/dist/features/table/lib/internal/selection.js +120 -20
- package/dist/features/table/lib/internal/tableCellHtml.js +11 -2
- package/dist/features/table/lib/internal/tabularText.js +105 -3
- package/dist/features/table/lib/internal/widths.js +136 -0
- package/dist/features/toc/index.d.ts +2 -2
- package/dist/features/toc/index.js +2 -2
- package/dist/features/toc/lib/BaseTocPlugin.js +163 -22
- package/dist/features/upload/index.d.ts +2 -2
- package/dist/features/upload/index.js +3 -2
- package/dist/features/upload/lib/BaseUploadPlugin.js +644 -443
- package/dist/features/upload/lib/uploadRules.internal.js +259 -0
- package/dist/history/index.d.ts +2 -3
- package/dist/history/index.js +2 -1
- package/dist/html/index.d.ts +4 -3
- package/dist/html/server/index.d.ts +6 -2
- package/dist/html/server/index.js +8 -4
- package/dist/html/server/serverCssParser.internal.js +372 -0
- package/dist/html/server/serverCssStyle.internal.js +214 -0
- package/dist/{index-DC_MNGyu.d.ts → htmlConversion-CmUPi9rg.d.ts} +6 -3
- package/dist/{htmlTypes-DjeFG3P8.d.ts → htmlTypes-C3hHzpRh.d.ts} +33 -45
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/index-5j5BcvLz.d.ts +493 -0
- package/dist/{react/features/layout/index.d.ts → index-B7vlwvLQ.d.ts} +201 -193
- package/dist/{index-Bxfvicyy.d.ts → index-BFuz7j3F.d.ts} +292 -176
- package/dist/index-BKiW8Kte.d.ts +21 -0
- package/dist/index-BTGCF8li.d.ts +3146 -0
- package/dist/index-BnqTluVD-D50uRAnI.d.ts +348 -0
- package/dist/index-Bw3p8fsS.d.ts +258 -0
- package/dist/{index-D5W-p9bS.d.ts → index-BxJ1-Bk3.d.ts} +631 -320
- package/dist/index-Byf_lqL7.d.ts +84 -0
- package/dist/index-CEQXbShY.d.ts +1 -0
- package/dist/{index-DaM37gF6.d.ts → index-CW0A2w5s.d.ts} +166 -248
- package/dist/{index-DzD6BIFJ.d.ts → index-CXFQCw_T.d.ts} +474 -443
- package/dist/{index-CcZbqPqk.d.ts → index-Cv3NLcDO.d.ts} +213 -75
- package/dist/index-D17Cz7nd.d.ts +97 -0
- package/dist/index-D4gbdWPp.d.ts +208 -0
- package/dist/index-D7LkEoIA.d.ts +118 -0
- package/dist/index-DQAD-81H.d.ts +930 -0
- package/dist/{index-Bc2Yg_2j.d.ts → index-DgYHSQmu-DLvTjIM2.d.ts} +4 -4
- package/dist/index-DqsRyYXn.d.ts +3 -0
- package/dist/{index-DTgaSxKr.d.ts → index-DzXvKehR.d.ts} +130 -110
- package/dist/index-KVVMEzVq.d.ts +45 -0
- package/dist/index-OJ8B_v_P-D5yZA1mD.d.ts +254 -0
- package/dist/index-Q7hzYYQW.d.ts +1 -0
- package/dist/index-RrccNMAA.d.ts +69 -0
- package/dist/index-h-K-xgfs.d.ts +305 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +6 -15
- package/dist/internal/comments/comment-anchor.internal.js +696 -0
- package/dist/internal/mergePlateRenderedAttributes.js +13 -16
- package/dist/{react/internal → internal}/penStroke.internal.js +29 -4
- package/dist/internal/plugin/OverridePlugin.js +251 -141
- package/dist/internal/plugin/blockInsertion.js +7 -5
- package/dist/internal/plugin/collectPlateNodeMappings.js +23 -9
- package/dist/internal/plugin/compilePlainTextMappings.js +68 -15
- package/dist/internal/plugin/compilePlateModel.js +180 -135
- package/dist/internal/plugin/compilePlateShortcuts.js +2 -1
- package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
- package/dist/internal/plugin/conversionLaws.js +73 -0
- package/dist/internal/plugin/createPlateModelPublication.js +271 -0
- package/dist/internal/plugin/createPlateRuntimePlugins.js +277 -0
- package/dist/internal/plugin/defaultElementTag.js +17 -1
- package/dist/{react/utils/dom-attributes.internal.js → internal/plugin/domHandlers.js} +8 -2
- package/dist/internal/plugin/endMatterPartition.js +28 -0
- package/dist/internal/plugin/getPlateDecorationSources.js +2 -1
- package/dist/internal/plugin/getPluginRenderAttributes.js +4 -8
- package/dist/internal/plugin/indentShift.js +44 -0
- package/dist/internal/plugin/isEditOnlyDisabled.js +1 -1
- package/dist/internal/plugin/markdownClipboardUnwrap.js +10 -0
- package/dist/internal/plugin/markdownEscapes.js +20 -0
- package/dist/internal/plugin/markdownParagraph.js +23 -1
- package/dist/internal/plugin/markdownPreservedProperties.js +25 -0
- package/dist/internal/plugin/matchesPluginInject.internal.js +20 -0
- package/dist/internal/plugin/mergeNodeAttributes.internal.js +76 -0
- package/dist/internal/plugin/pastedUploadFiles.js +4 -0
- package/dist/internal/plugin/pipeInjectNodeProps.js +8 -13
- package/dist/internal/plugin/plateRuntime.js +11 -3
- package/dist/internal/plugin/pluginDescriptorSnapshot.js +172 -0
- package/dist/internal/plugin/pluginFormatOperation.js +8 -3
- package/dist/internal/plugin/pluginInjectNodeProps.js +49 -34
- package/dist/internal/plugin/pluginNodeClass.internal.js +6 -0
- package/dist/internal/plugin/pluginStore.js +81 -11
- package/dist/internal/plugin/resolvePlugin.js +45 -25
- package/dist/internal/plugin/resolvePluginGraph.js +352 -0
- package/dist/internal/plugin/resolvePlugins.js +20 -1133
- package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
- package/dist/internal/plugin/uploadDrafts.js +11 -0
- package/dist/internal/utils/mergePlugins.js +7 -5
- package/dist/internal/utils/trustedContentSlice.js +1 -1
- package/dist/internal/utils/urlPolicy.js +37 -2
- package/dist/internal/utils/vscodeClipboard.js +11 -0
- package/dist/lib/editor/editorUser.internal.js +13 -5
- package/dist/lib/editor/withPlite.js +118 -61
- package/dist/lib/libs/zustand.js +31 -7
- package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
- package/dist/lib/plugin/createPluginContext.internal.js +8 -27
- package/dist/lib/plugin/defineBasePlugin.internal.js +69 -9
- package/dist/lib/plugin/definePlugin.js +1 -1
- package/dist/lib/plugin/pluginFactoryRuntime.internal.js +40 -0
- package/dist/lib/plugins/affinity/AffinityPlugin.js +85 -52
- package/dist/lib/plugins/debug/DebugPlugin.js +1 -4
- package/dist/lib/plugins/dom/DOMPlugin.js +35 -15
- package/dist/lib/plugins/dom/clipboardFormatKey.internal.js +9 -0
- package/dist/lib/plugins/dom/isPlainTextPasteTarget.internal.js +13 -0
- package/dist/lib/plugins/getCorePlugins.internal.js +1 -3
- package/dist/lib/plugins/html/HtmlPlugin.js +49 -1745
- package/dist/lib/plugins/html/cssLexer.internal.js +409 -0
- package/dist/lib/plugins/html/cssSafety.internal.js +100 -0
- package/dist/lib/plugins/html/htmlAst.js +62 -18
- package/dist/lib/plugins/html/htmlConversion.js +25 -9
- package/dist/lib/plugins/html/htmlDecode.internal.js +808 -0
- package/dist/lib/plugins/html/htmlDom.js +3 -13
- package/dist/lib/plugins/html/htmlMatcher.internal.js +24 -1
- package/dist/lib/plugins/html/htmlRules.internal.js +417 -0
- package/dist/lib/plugins/html/htmlSafety.js +38 -24
- package/dist/lib/plugins/html/htmlSerialize.internal.js +495 -0
- package/dist/lib/plugins/html/htmlStyleInline.internal.js +688 -0
- package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
- package/dist/lib/plugins/input-rules/InputRulesPlugin.js +187 -54
- package/dist/lib/plugins/input-rules/createInputRules.js +65 -69
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +144 -0
- package/dist/lib/plugins/input-rules/inputRuleVeto.js +2 -2
- package/dist/lib/plugins/input-rules/inputRules.internal.js +20 -0
- package/dist/lib/plugins/input-rules/markInputRule.internal.js +64 -2
- package/dist/lib/plugins/paragraph/BaseParagraphPlugin.js +21 -8
- package/dist/lib/utils/getInjectMatch.js +6 -39
- package/dist/markdown/index.d.ts +2 -2
- package/dist/markdown/index.js +2 -1
- package/dist/markdown/lib/MarkdownPlugin.js +129 -84
- package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +32 -8
- package/dist/markdown/lib/deserializer/mdastToSlate.js +11 -3
- package/dist/markdown/lib/internal/markdownAttributes.js +18 -8
- package/dist/markdown/lib/internal/markdownBareLinks.js +270 -0
- package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
- package/dist/markdown/lib/internal/markdownDiagnostics.js +33 -16
- package/dist/markdown/lib/internal/markdownDocument.js +14 -33
- package/dist/markdown/lib/internal/markdownFootnoteWriter.js +35 -0
- package/dist/markdown/lib/internal/markdownFrontmatter.js +102 -0
- package/dist/markdown/lib/internal/markdownIntrinsics.js +88 -163
- package/dist/markdown/lib/internal/markdownLine.js +186 -145
- package/dist/markdown/lib/internal/markdownMappings.js +335 -107
- package/dist/markdown/lib/internal/markdownParse.js +596 -0
- package/dist/markdown/lib/internal/markdownReferences.js +12 -6
- package/dist/markdown/lib/internal/markdownRuntime.js +456 -0
- package/dist/markdown/lib/internal/markdownSafety.js +53 -1
- package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
- package/dist/markdown/lib/internal/markdownStream.js +1006 -0
- package/dist/markdown/lib/internal/markdownTags.js +206 -76
- package/dist/markdown/lib/internal/markdownTailHeal.js +869 -0
- package/dist/markdown/lib/internal/walkMdast.js +34 -0
- package/dist/markdown/lib/serializer/convertNodesSerialize.js +33 -18
- package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +322 -0
- package/dist/markdown/lib/serializer/listToMdastTree.js +34 -12
- package/dist/markdown/lib/serializer/reportOmittedProperties.js +5 -2
- package/dist/markdown/lib/utils/remarkPlugins.js +48 -23
- package/dist/math/index.d.ts +21 -384
- package/dist/math/lib/BaseEquationPlugin.js +111 -29
- package/dist/math/react/index.d.ts +10 -9
- package/dist/migrations/documentMigrationAuthored.internal.js +2 -1
- package/dist/migrations/documentMigrationSelection.internal.js +138 -2
- package/dist/migrations/documentMigrationTarget.internal.js +10 -2
- package/dist/migrations/documentMigrations.js +134 -143
- package/dist/migrations/index.d.ts +30 -44
- package/dist/migrations/index.js +1 -2
- package/dist/migrations/migratePlateV54.js +61 -52
- package/dist/migrations/migratePlateV54Ast.internal.js +201 -118
- package/dist/migrations/migratePlateV54BuiltIns.internal.js +18 -3
- package/dist/migrations/migratePlateV54Callout.internal.js +61 -0
- package/dist/migrations/migratePlateV54CodeBlocks.internal.js +68 -34
- package/dist/migrations/migratePlateV54Excalidraw.internal.js +534 -0
- package/dist/migrations/migratePlateV54ExcalidrawHelpers.internal.js +82 -0
- package/dist/migrations/migratePlateV54Inputs.internal.js +39 -32
- package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
- package/dist/migrations/migratePlateV54Profile.internal.js +54 -27
- package/dist/migrations/migratePlateV54RetiredMarks.internal.js +25 -10
- package/dist/migrations/migratePlateV54Stage.internal.js +127 -0
- package/dist/migrations/migratePlateV54Suggestions.internal.js +10 -3
- package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
- package/dist/migrations/migratePlateV54Urls.internal.js +149 -58
- package/dist/migrations/v53-manifest.internal.js +4 -0
- package/dist/pagination/index.d.ts +2 -167
- package/dist/pagination/index.js +26 -2
- package/dist/pagination/react/PaginationPlugin.js +271 -0
- package/dist/pagination/react/index.d.ts +168 -31
- package/dist/pagination/react/index.js +3 -5
- package/dist/plain-text.js +19 -15
- package/dist/protocol-o3jVSHir-Bouoin05.d.ts +103 -0
- package/dist/react/authored/AuthoredReactPlugin.js +127 -0
- package/dist/react/authored/index.d.ts +37 -0
- package/dist/react/authored/index.js +3 -0
- package/dist/react/authored/useAuthored.js +118 -0
- package/dist/react/components/EditorContentView.internal.js +100 -53
- package/dist/react/components/EditorProvider.js +26 -25
- package/dist/react/components/EditorRefEffect.internal.js +74 -0
- package/dist/react/components/EditorRefEffect.js +12 -56
- package/dist/react/components/NodeSelection.js +513 -485
- package/dist/react/components/Plate.js +259 -185
- package/dist/react/components/PlateContainer.js +110 -45
- package/dist/react/components/PlateContent.js +3 -3
- package/dist/react/components/PlateController.js +28 -16
- package/dist/react/components/PlateRoot.internal.js +3 -2
- package/dist/react/components/PlateView.js +34 -20
- package/dist/{static/internal/getPlainText.js → react/components/getPlainText.internal.js} +1 -4
- package/dist/react/components/plate-nodes.js +66 -87
- package/dist/{static/internal/writeStaticSelectionClipboardData.js → react/components/writeStaticSelectionClipboardData.internal.js} +11 -7
- package/dist/react/core.js +8 -17
- package/dist/react/editor/getPlateCorePlugins.internal.js +1 -1
- package/dist/react/editor/useCreateEditor.js +19 -17
- package/dist/react/editor/withPlate.js +11 -8
- package/dist/react/features/basic-styles/BasicStylePlugins.js +2 -3
- package/dist/react/features/board/BoardPlugin.js +8 -2
- package/dist/react/features/board/BoardShape.js +475 -169
- package/dist/react/features/board/BoardSurface.js +118 -89
- package/dist/react/features/board/boardCamera.internal.js +295 -0
- package/dist/react/features/board/boardClipboard.internal.js +41 -32
- package/dist/react/features/board/boardConnect.internal.js +2 -10
- package/dist/react/features/board/boardExport.internal.js +757 -0
- package/dist/react/features/board/boardGesture.internal.js +234 -65
- package/dist/react/features/board/boardIndex.internal.js +282 -46
- package/dist/react/features/board/boardInk.internal.js +2 -13
- package/dist/react/features/board/boardKeys.internal.js +76 -47
- package/dist/react/features/board/boardLanding.internal.js +147 -0
- package/dist/react/features/board/boardPick.internal.js +4 -3
- package/dist/react/features/board/boardPicking.internal.js +0 -17
- package/dist/react/features/board/boardPictureStyles.internal.js +415 -0
- package/dist/react/features/board/boardPictures.internal.js +19 -13
- package/dist/react/features/board/boardPreview.internal.js +74 -16
- package/dist/react/features/board/boardResize.internal.js +114 -47
- package/dist/react/features/board/boardSnap.internal.js +14 -9
- package/dist/react/features/board/boardStyleView.internal.js +123 -0
- package/dist/react/features/board/boardTextFit.internal.js +311 -0
- package/dist/react/features/board/boardView.internal.js +560 -552
- package/dist/react/features/board/boardVoice.internal.js +29 -17
- package/dist/react/features/board/boardWindow.internal.js +138 -0
- package/dist/react/features/board/index.d.ts +559 -156
- package/dist/react/features/board/index.js +3 -3
- package/dist/react/features/callout/index.d.ts +212 -39
- package/dist/react/features/{layout → column}/ColumnPlugin.js +4 -3
- package/dist/react/features/column/index.d.ts +808 -0
- package/dist/react/features/combobox/combobox.internal.js +119 -0
- package/dist/react/features/combobox/comboboxOwner.internal.js +76 -27
- package/dist/react/features/combobox/index.d.ts +51 -18
- package/dist/react/features/combobox/useCombobox.js +50 -13
- package/dist/react/features/comments/CommentsPlugin.js +2 -3
- package/dist/react/features/comments/index.d.ts +74 -342
- package/dist/react/features/comments/index.js +2 -1
- package/dist/react/features/comments/useCommentThreadIndex.js +243 -0
- package/dist/react/features/date/index.d.ts +4 -3
- package/dist/react/features/details/index.d.ts +126 -10
- package/dist/react/features/field/FieldPlugin.js +49 -0
- package/dist/react/features/field/index.d.ts +326 -0
- package/dist/react/features/field/index.js +2 -0
- package/dist/react/features/footnote/FootnotePlugin.js +13 -8
- package/dist/react/features/footnote/index.d.ts +373 -130
- package/dist/react/features/format-painter/FormatPainterPlugin.js +66 -27
- package/dist/react/features/format-painter/index.d.ts +13 -120
- package/dist/react/features/ink/InkContent.js +375 -0
- package/dist/react/features/ink/InkPlugin.js +102 -6
- package/dist/react/features/ink/index.d.ts +290 -260
- package/dist/react/features/ink/index.js +2 -3
- package/dist/react/features/ink/inkCapture.internal.js +338 -57
- package/dist/react/features/ink/inkImages.internal.js +304 -0
- package/dist/react/features/ink/inkInput.internal.js +43 -4
- package/dist/react/features/ink/inkLayout.internal.js +6 -3
- package/dist/react/features/ink/inkMeasure.internal.js +43 -17
- package/dist/react/features/ink/inkPaint.internal.js +134 -10
- package/dist/react/features/ink/inkPick.internal.js +323 -0
- package/dist/react/features/ink/inkPlacement.internal.js +420 -167
- package/dist/react/features/ink/inkWatch.internal.js +7 -36
- package/dist/react/features/list/ListPlugin.js +74 -38
- package/dist/react/features/lock/LockPlugin.js +138 -0
- package/dist/react/features/lock/index.d.ts +60 -0
- package/dist/react/features/lock/index.js +2 -0
- package/dist/react/features/media/index.d.ts +55 -35
- package/dist/react/features/mention/index.d.ts +13 -17
- package/dist/react/features/resizable/Resizable.js +9 -8
- package/dist/react/features/resizable/index.d.ts +7 -6
- package/dist/react/features/table/TablePlugin.js +251 -85
- package/dist/react/features/table/index.d.ts +1247 -2690
- package/dist/react/features/table/index.js +2 -1
- package/dist/react/features/table/measureTableColumnWidths.internal.js +48 -0
- package/dist/react/features/table/tableSelectionHostBinding.internal.js +4 -6
- package/dist/react/features/table/useTableControls.js +1170 -0
- package/dist/react/features/table/useTableResize.js +57 -16
- package/dist/react/features/toc/TocPlugin.js +1 -0
- package/dist/react/features/toc/index.d.ts +9 -11
- package/dist/react/features/upload/UploadPlugin.js +14 -5
- package/dist/react/features/upload/index.d.ts +25 -201
- package/dist/react/index.d.ts +7 -6
- package/dist/react/index.js +12 -21
- package/dist/react/internal/plate-context.js +472 -205
- package/dist/react/internal/plite-components.js +2 -2
- package/dist/react/internal/rendered-attributes.js +1 -1
- package/dist/react/internal/useDeepCompareMemo.js +36 -7
- package/dist/react/internal/usePlateModelRevision.js +13 -9
- package/dist/react/plite-react.js +2 -2
- package/dist/react/plugin/pluginFactory.internal.js +1 -37
- package/dist/react/plugin/toReactPlugin.js +40 -8
- package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +12 -10
- package/dist/react/plugins/paragraph/ParagraphPlugin.js +3 -3
- package/dist/react/stores/element/useElement.js +2 -2
- package/dist/react/stores/element/useElementSelector.js +4 -2
- package/dist/react/stores/element/useElementStore.js +142 -106
- package/dist/react/stores/element/useElementStoreSelector.internal.js +80 -24
- package/dist/react/stores/element/usePath.js +32 -32
- package/dist/react/stores/plate/pluginStoreSelector.internal.js +44 -0
- package/dist/react/stores/plate/useEditor.js +135 -71
- package/dist/react/stores/plate/useEditorHistory.js +55 -0
- package/dist/react/stores/plate/useEditorSelector.js +33 -22
- package/dist/react/stores/plate/usePluginStore.js +36 -43
- package/dist/react/stores/plate/useViewStore.js +38 -23
- package/dist/react/utils/BlockPlaceholderPlugin.js +41 -26
- package/dist/react/utils/dispatchPlateShortcut.internal.js +2 -1
- package/dist/react/utils/editableKeyDown.internal.js +1 -0
- package/dist/react/utils/getRenderNodeProps.internal.js +18 -19
- package/dist/react/utils/hardAffinityBoundary.internal.js +25 -0
- package/dist/react/utils/pipeHandler.internal.js +43 -17
- package/dist/react/utils/pipeRenderElement.internal.js +86 -70
- package/dist/react/utils/pipeRenderLeaf.internal.js +26 -45
- package/dist/react/utils/pipeRenderText.internal.js +44 -42
- package/dist/react/utils/pluginRenderElement.internal.js +9 -7
- package/dist/react/utils/pluginRenderLeaf.internal.js +6 -28
- package/dist/react/utils/pluginRenderText.internal.js +3 -15
- package/dist/react/utils/useSelectionFragment.js +8 -2
- package/dist/react/virtualized.d.ts +7 -6
- package/dist/react/virtualized.js +2 -2
- package/dist/refusal-hmMeqqsF-DEODtsVZ.d.ts +1 -0
- package/dist/registerEditorTools-CxU5qGen.d.ts +519 -0
- package/dist/root.js +6 -15
- package/dist/shared-room-D0Ch6_0l-DEODtsVZ.d.ts +1 -0
- package/dist/skills/plate/SKILL.md +49 -0
- package/dist/skills/plate/references/ai-and-agents.md +16 -0
- package/dist/skills/plate/references/plugins.md +22 -0
- package/dist/skills/plate/references/pricing.md +38 -0
- package/dist/skills/plate/references/report-a-bug.md +8 -0
- package/dist/skills/plate/references/setup.md +78 -0
- package/dist/skills/plate/references/testing.md +22 -0
- package/dist/skills/plate/references/ui-and-sync.md +25 -0
- package/dist/{source-CNKy99Th.d.ts → source-SWPrNfXp.d.ts} +32 -20
- package/dist/static/components/{PlateStatic.js → EditorStatic.js} +184 -42
- package/dist/static/components/plite-nodes.js +40 -17
- package/dist/static/index.d.ts +60 -38
- package/dist/static/index.js +1 -1
- package/dist/static/internal/loadStaticRenderer.js +4 -0
- package/dist/static/internal/staticDocumentView.js +219 -17
- package/dist/static/internal/staticPendingMedia.internal.js +147 -0
- package/dist/static/internal/staticPresentation.js +22 -25
- package/dist/static/internal/staticViewState.internal.js +47 -0
- package/dist/static/pipeRenderElementStatic.internal.js +3 -13
- package/dist/static/pluginRenderElementStatic.internal.js +32 -7
- package/dist/static/pluginRenderMarkStatic.internal.js +90 -0
- package/dist/static/renderStaticHtml.js +92 -6
- package/dist/static/utils/fallbackContentRoots.internal.js +15 -0
- package/dist/static/utils/getRenderNodeStaticProps.internal.js +12 -5
- package/dist/storage-BiSc0Cnj-BamxXwsJ.d.ts +250 -0
- package/dist/sync/SyncPlugin.js +16 -0
- package/dist/sync/cloudflare/index.d.ts +72 -0
- package/dist/sync/cloudflare/index.js +2 -0
- package/dist/sync/index.d.ts +5 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/postgres/index.d.ts +41 -0
- package/dist/sync/postgres/index.js +2 -0
- package/dist/sync/react/SyncReactPlugin.js +20 -0
- package/dist/sync/react/hooks.js +71 -0
- package/dist/sync/react/index.d.ts +87 -0
- package/dist/sync/react/index.js +3 -0
- package/dist/sync/server/index.d.ts +6 -0
- package/dist/sync/server/index.js +2 -0
- package/dist/tabbable/react/TabbableEffects.internal.js +96 -37
- package/dist/tabbable/react/TabbablePlugin.js +6 -1
- package/dist/tabbable/react/index.d.ts +63 -5
- package/dist/testing/index.d.ts +20 -10
- package/dist/transport-CWTT3vFK-_eytF0bO.d.ts +78 -0
- package/dist/{index-BU6k1Aev.d.ts → tx-only-CFSEh_pE-j0KGzcne.d.ts} +8226 -6860
- package/dist/utils/plate-keys.js +4 -9
- package/dist/utils/plugins/TrailingBlockPlugin.js +10 -7
- package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
- package/dist/{index-xdmCBvlT.d.ts → widths-C1tAKF__.d.ts} +590 -140
- package/package.json +94 -148
- package/LICENSE +0 -24
- package/dist/AIChatRequestContext-BMVWhfPV.d.ts +0 -34
- package/dist/BaseSuggestionPlugin-DBl3fqnm.d.ts +0 -86
- package/dist/PlateStatic-DhNv2ejp.d.ts +0 -19
- package/dist/ai/lib/AIChatRequestContext.js +0 -16
- package/dist/ai/lib/findQuotedSpan.internal.js +0 -63
- package/dist/ai/react/AIChatPlugin.js +0 -1203
- package/dist/ai/react/useAIChat.js +0 -327
- package/dist/combobox-DkBGgyd3.d.ts +0 -22
- package/dist/comparison-types-CYnJ35qU.d.ts +0 -169
- package/dist/docs/excalidraw.md +0 -200
- package/dist/docs/installation/docs.md +0 -24
- package/dist/docs/installation/mcp.md +0 -147
- package/dist/docs/migration/plite-to-plate.md +0 -251
- package/dist/docs/yjs.md +0 -256
- package/dist/docx/export/lib/comments.js +0 -231
- package/dist/docx/export/lib/docxStaticComponents.js +0 -371
- package/dist/docx/export/lib/exportHtmlToDocx.internal.js +0 -70
- package/dist/docx/export/lib/generatedParts.js +0 -51
- package/dist/docx/export/lib/html-to-docx.internal.js +0 -40
- package/dist/docx/export/lib/internal/constants.js +0 -106
- package/dist/docx/export/lib/internal/docx-document.js +0 -652
- package/dist/docx/export/lib/internal/escape-xml.js +0 -4
- package/dist/docx/export/lib/internal/html-to-docx.js +0 -148
- package/dist/docx/export/lib/internal/list-item.js +0 -85
- package/dist/docx/export/lib/internal/list.js +0 -43
- package/dist/docx/export/lib/internal/math.js +0 -187
- package/dist/docx/export/lib/internal/namespaces.js +0 -40
- package/dist/docx/export/lib/internal/render-document-file.js +0 -403
- package/dist/docx/export/lib/internal/schemas/content-types.js +0 -25
- package/dist/docx/export/lib/internal/schemas/core.js +0 -26
- package/dist/docx/export/lib/internal/schemas/document-rels.js +0 -15
- package/dist/docx/export/lib/internal/schemas/document.template.js +0 -36
- package/dist/docx/export/lib/internal/schemas/font-table.js +0 -55
- package/dist/docx/export/lib/internal/schemas/generic-rels.js +0 -9
- package/dist/docx/export/lib/internal/schemas/numbering.js +0 -18
- package/dist/docx/export/lib/internal/schemas/rels.js +0 -12
- package/dist/docx/export/lib/internal/schemas/settings.js +0 -17
- package/dist/docx/export/lib/internal/schemas/styles.js +0 -142
- package/dist/docx/export/lib/internal/schemas/theme.js +0 -198
- package/dist/docx/export/lib/internal/schemas/web-settings.js +0 -10
- package/dist/docx/export/lib/internal/unit-conversion.js +0 -24
- package/dist/docx/export/lib/internal/vnode.js +0 -4
- package/dist/docx/export/lib/internal/word-styles.js +0 -123
- package/dist/docx/export/lib/internal/xml-builder.js +0 -1808
- package/dist/docx/export/lib/reviewPart.js +0 -234
- package/dist/docx/import/lib/wordFormatting.js +0 -608
- package/dist/docx/internal/domParser.js +0 -23
- package/dist/excalidraw/index.d.ts +0 -57
- package/dist/excalidraw/index.js +0 -2
- package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +0 -15
- package/dist/excalidraw/react/ExcalidrawPlugin.js +0 -6
- package/dist/excalidraw/react/index.d.ts +0 -101
- package/dist/excalidraw/react/index.js +0 -3
- package/dist/excalidraw/react/useExcalidrawSync.js +0 -103
- package/dist/features/combobox/index.d.ts +0 -3
- package/dist/features/combobox/index.js +0 -2
- package/dist/features/combobox/lib/combobox.internal.js +0 -111
- package/dist/features/combobox/lib/filterWords.js +0 -23
- package/dist/features/comments/plite-comments.internal.js +0 -2
- package/dist/features/ink/lib/inkGone.internal.js +0 -107
- package/dist/features/layout/index.d.ts +0 -2
- package/dist/features/layout/lib/BaseColumnPlugin.js +0 -249
- package/dist/features/media/lib/media/parseMediaUrl.js +0 -151
- package/dist/features/suggestion/BaseSuggestionPlugin.js +0 -30
- package/dist/features/suggestion/index.d.ts +0 -9
- package/dist/features/suggestion/index.js +0 -3
- package/dist/features/suggestion/suggestionColorOf.js +0 -14
- package/dist/features/upload/lib/mimeTypes.internal.js +0 -3982
- package/dist/index-BBKGrsG3.d.ts +0 -8
- package/dist/index-BiQerPJS.d.ts +0 -46
- package/dist/index-BkR7-GLI.d.ts +0 -166
- package/dist/index-Bq3sdm3S.d.ts +0 -158
- package/dist/index-CT7miqQN.d.ts +0 -298
- package/dist/index-Cl77E9yr.d.ts +0 -184
- package/dist/index-D1CFXA-i.d.ts +0 -6187
- package/dist/index-DLA2DUR2.d.ts +0 -28
- package/dist/index-DdIRduDG.d.ts +0 -399
- package/dist/index-iaZOhA76.d.ts +0 -59
- package/dist/index-kLKMc-pI.d.ts +0 -36
- package/dist/internal/plugin/plateChangeHandlers.js +0 -74
- package/dist/lib/plugins/element-id/ElementIdPlugin.js +0 -47
- package/dist/lib/plugins/element-id/elementIdAdmission.internal.js +0 -34
- package/dist/lib/plugins/element-state/ElementStatePlugin.js +0 -14
- package/dist/lib/utils/applyDeepToNodes.js +0 -17
- package/dist/lib/utils/defaultsDeepToNodes.js +0 -12
- package/dist/lib/utils/hotkeys.js +0 -113
- package/dist/lib/utils/mergeDeepToNodes.js +0 -12
- package/dist/lib/utils/pluginNodeClass.js +0 -10
- package/dist/markdown/lib/internal/markdownConversion.js +0 -666
- package/dist/markdown/lib/internal/markdownSegments.js +0 -134
- package/dist/markdown/lib/serializer/convertTextsSerialize.js +0 -163
- package/dist/migrations/migrateListIdentity.js +0 -93
- package/dist/pagination/react/PagedEditorContent.js +0 -77
- package/dist/react/components/EditorSelectionView.js +0 -40
- package/dist/react/features/ink/InkCopyView.js +0 -203
- package/dist/react/features/ink/InkLayer.js +0 -218
- package/dist/react/features/suggestion/SuggestionPlugin.js +0 -24
- package/dist/react/features/suggestion/index.d.ts +0 -44
- package/dist/react/features/suggestion/index.js +0 -3
- package/dist/react/features/suggestion/suggestion-view.internal.js +0 -112
- package/dist/react/features/suggestion/useSuggestion.js +0 -135
- package/dist/react/internal/createPlateTargetScope.js +0 -62
- package/dist/react/libs/jotai.js +0 -3
- package/dist/static/internal/renderStaticHtmlWithOverrides.js +0 -33
- package/dist/static/pluginRenderLeafStatic.internal.js +0 -87
- package/dist/static/pluginRenderTextStatic.internal.js +0 -87
- package/dist/tabbable/index.d.ts +0 -2
- package/dist/tabbable/index.js +0 -0
- package/dist/utils/plugins/ExitBreakPlugin.js +0 -26
- package/dist/yjs/index.d.ts +0 -2
- package/dist/yjs/index.js +0 -1
- package/dist/yjs/react/YjsPlugin.js +0 -60
- package/dist/yjs/react/index.d.ts +0 -94
- package/dist/yjs/react/index.js +0 -3
- /package/dist/features/{layout → column}/index.js +0 -0
- /package/dist/react/features/{layout → column}/index.js +0 -0
package/dist/dom/index.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
|
|
3
|
-
* Returns whether an event, node, window, or document belongs to an Apple
|
|
4
|
-
* platform, where `mod` is Command.
|
|
5
|
-
*/
|
|
6
|
-
declare const usesAppleDOMHotkeys: (event: unknown) => boolean;
|
|
7
|
-
export { type ClipboardSliceRead, type ClipboardSliceWrite, type DOMApi, type DOMClipboardApi, type DOMElement, type DOMNode, type DOMPoint, type DOMRange, DOMResolutionError, type DOMSelection, type DOMStaticRange, type DOMText, type DOMVisualPoint, type DOMVisualPointOptions, type DataTransferDecodeContext, type DataTransferDiagnostic, type DataTransferEncodeContext, type DataTransferFormat, type DataTransferFormatPhase, type DataTransferSchemaClaim, type DataTransferSnapshot, type HotkeyMatchOptions, type HotkeyPlatform, type HotkeySpec, type KeyboardEventLike, type ScrollIntoViewOptions, type ScrollIntoViewTarget, ariaKeyShortcuts, dataTransferFormats, domCommands, isHotkey, usesAppleDOMHotkeys, writeDataTransferFragment };
|
|
1
|
+
import { A as DOMVisualPoint, B as ScrollMargin, C as DOMElement, D as DOMSelection, E as DOMRange, F as DataTransferFormat, G as HotkeyMatchOptions, H as dataTransferFormats, I as DataTransferSchemaClaim, J as KeyboardEventLike, K as HotkeyPlatform, L as DataTransferSnapshot, M as DataTransferDecodeContext, N as DataTransferDiagnostic, O as DOMStaticRange, P as DataTransferEncodeContext, R as ScrollIntoViewOptions, T as DOMPoint, U as domCommands, V as ViewportRect, W as writeDataTransferFragment, Y as ariaKeyShortcuts, _ as DOMDragStart, a as usesAppleDOMHotkeys, b as DOMDropTargetInput, c as DOMApi, g as DOMDragApi, i as isHotkey, j as DOMVisualPointOptions, k as DOMText, l as DOMClipboardApi, o as ClipboardSliceRead, q as HotkeySpec, r as DropIndicator, s as ClipboardSliceWrite, v as DOMDropEdge, w as DOMNode, x as DOMDropTargetOptions, y as DOMDropTarget, z as ScrollIntoViewTarget } from "../index-CW0A2w5s.js";
|
|
2
|
+
export { type ClipboardSliceRead, type ClipboardSliceWrite, type DOMApi, type DOMClipboardApi, type DOMDragApi, type DOMDragStart, type DOMDropEdge, type DOMDropTarget, type DOMDropTargetInput, type DOMDropTargetOptions, type DOMElement, type DOMNode, type DOMPoint, type DOMRange, type DOMSelection, type DOMStaticRange, type DOMText, type DOMVisualPoint, type DOMVisualPointOptions, type DataTransferDecodeContext, type DataTransferDiagnostic, type DataTransferEncodeContext, type DataTransferFormat, type DataTransferSchemaClaim, type DataTransferSnapshot, type DropIndicator, type HotkeyMatchOptions, type HotkeyPlatform, type HotkeySpec, type KeyboardEventLike, type ScrollIntoViewOptions, type ScrollIntoViewTarget, type ScrollMargin, type ViewportRect, ariaKeyShortcuts, dataTransferFormats, domCommands, isHotkey, usesAppleDOMHotkeys, writeDataTransferFragment };
|
package/dist/dom/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { ariaKeyShortcuts, dataTransferFormats, domCommands, isHotkey, usesAppleDOMHotkeys, writeDataTransferFragment } from "plitejs/dom";
|
|
2
|
+
export { ariaKeyShortcuts, dataTransferFormats, domCommands, isHotkey, usesAppleDOMHotkeys, writeDataTransferFragment };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { Hotkeys, cleanDOMClipboardContents, containsShadowAware, dataTransferFormats, dom, domCommands, getSelection, isDOMElement, isDOMNode, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection } from "plitejs/dom";
|
|
2
|
+
export { Hotkeys, cleanDOMClipboardContents, containsShadowAware, dataTransferFormats, dom, domCommands, getSelection, isDOMElement, isDOMNode, isHotkey, readDOMSelectionRange, usesAppleDOMHotkeys, writeDOMSelection };
|
package/dist/facade.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ContentSlice, DocumentChange, EditorSchemaValidationError, ElementApi, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, createEditor, defineEditorSchema, definePlugin as defineRuntimePlugin, definePluginPoint, editorCommands, editorReads, getEditorRuntimeOwner, locateAt, property,
|
|
2
|
-
import { EDITOR_DOCUMENT_FIELDS
|
|
3
|
-
export { ContentSlice, DocumentChange, EDITOR_DOCUMENT_FIELDS
|
|
1
|
+
import { ContentSlice, DocumentChange, EditorSchemaValidationError, ElementApi, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, createEditor, createEditorView, defineEditorSchema, definePlugin as defineRuntimePlugin, definePluginPoint, editorCommands, editorReads, getEditorRuntimeOwner, locateAt, property, schema, transfer, txLocate } from "plitejs";
|
|
2
|
+
import { EDITOR_DOCUMENT_FIELDS, EditorRefusalError, FOREIGN_CONTENTEDITABLE_SELECTOR, HISTORY_ABSORB_DELETED_TAG, MAIN_ROOT_KEY, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, authoredDirectProperties, brandPluginDescriptor as brandRuntimePluginDescriptor, buildDefaultChild, canPlaceBlocksAtPath, captureHistoryAnchor, claimsHistoryReplay, cloneEditorJsonValue, closestShadowAware, compilePluginInput, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createAuthoredEditorView, createBranchEditor, createCompiledHotkeyMatcher, createDetachedContentSlice, createDetachedEditorSchema, createDormantEditor, createEditorOwner, createEditorSelectorStore, createPluginUpdateProxy, didCommitChangePersistedValue, exportContentSlice, findEndMatterLandingIndex, fingerprintEditorDocumentValue, fitSlicePlacements, getActiveCommandEditor, getActiveEditorTransaction, getActiveEditorUpdateId, getActiveEditorUpdateIds, getActiveEditorUpdateTags, getActiveElement, getActiveTransactionEndedHandlers, getAnchorRuntimeId, getAuthoredUpdateView, getAuthoredViewCommit, getBranchDynamicPluginInputs, getCaretOwner, getCarriedCaretEditor, getCarriedRootEditor, getCommitDocumentValue, getCompiledEditorSchema, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability, getEditorCommitNode, getEditorCommitSnapshot, getEditorCommitValue, getEditorDocumentShapeIssueMessage, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getInternalEditorRuntimeOwner, getMutationVersion, getPluginCompartmentInput, getPluginContributions, getReaderRange, getRecordSetVersion, getSchemaElementSourceReference, getSnapshotVersion, getStateFieldEqualityFn, getStateViewPresentation, getTextSearchScope, getUpdateStartValue, getValueRecords, getViewAuthor, getViewCommitSource, getViewPresentation, hasAuthoredPendingInsertion, hasAuthoredRuntime, hasNonWritableAt, hasNonWritableContributors, holdsCaret, initializePluginEntries, isAuthorId, isAuthoredFormatOnlyPropertyWrite, isAuthoredPreview, isDocumentView, isEditorClosingOrDestroyed, isEditorDraftView, isEditorDryRun, isEditorPublishingCommit, isEnvelopeInput, isGeckoDOMHost, isPersistedEffect, isPlugin as isRuntimePlugin, isProposeOnlyView, isRootSelectionChanged, isTextRun, isTxOnlyMethod, joinKeepsPrefixOccupant, landNodePropertiesAt, liftAuthoredRange, liftAuthoredViewRange, mapDetachedSelectionThroughChange, mapHistoryAnchor, mapSemanticUpdateMethodArguments, markRootViewInteraction, nonWritableContent, nonWritableRoot, normalizeSelectorDependencies, normalizeSetValues, notePasteLoss, notifyEditorAdmissionChange, notifyObservers, onPresentationRelease, preserveCompiledSchemaPropertyIdentity, projectEditorView, projectEditorViewCommit, readAuthoredChangeBridge, readAuthoredProjectedRoot, readAuthoredView, readCaretViewIn, readCommitRootIndex, readComposedSelectionRange, readDocumentRange, readDocumentRecord, readDocumentRootChildren, readEditorCommitChangesHistoryTopStep, readEditorCommitHistoryEntry, readEditorOptions, readEditorSyncAccess, readElementPropertyWrites, readNamedRootChildren, readOptionalRuntimeRootEditorLookup, readPersistedEnvelope, readRecord, readRootViewUse, readShownDocument, readShownElementById, readShownPreview, readShownRecords, readShownViewUse, readStoredEditorDocument, readViewPage, readingCovered, recordEditorHistoryEffect, recordSetChanges, recordSetIds, refuseWritePolicy, registerEditableKeyDownFallback, registerEditorAdmissionCheck, registerEditorBranchFactory, registerEditorTransactionGuard, rejectEditorRecord, reportEditorLifecycleError, resolveInstalledPlugin, resolveLocationRoot, resolvePluginMethod, resolveStoredAnchor, restoreHistoryAnchor, runEditableKeyDownFallback, runEditorObserver, sameResult, scheduleAfterCommitNotification, selectorDependenciesSubscriptionKey, serializeStructuralPlainText, setDOMClipboardFormatKey, setDOMTextSyncRendererCapability, setEditorPluginInputValidator, setEditorStateViewTransform, setEditorTransactionViewTransform, setPluginPortalFactory, setRetainedTextFlowRendererCapability, setSelectionAsView, setShownSelectionAsView, shareBranchDocumentStore, skipHistoryIfOnlyProperties, snapshotEditorJsonValue, splitTopLevelEndMatter, subscribeCaretTarget, subscribeEditorNodeChange, subscribeEditorRefusals, subscribeEditorTextChange, subscribeEditorViewState, subscribePublishedCommits, subscribeSharedEditorViewState, subscribeShownViewUse, txStored, vetoesWrite, visitDocumentChangeSections, withCompiledEditorSchemaCapabilityEntries, withDocumentViewRead, withEditorDocumentProjection, withEditorUpdateRootScope, withMintingFitDocument, withMountedPresentation, withPliteReactPreservedSelection, withPluginPortalCandidates, withStoredAuthoredRead, withTransactionSpecDraftRead } from "plitejs/internal";
|
|
3
|
+
export { ContentSlice, DocumentChange, EDITOR_DOCUMENT_FIELDS, EditorRefusalError, EditorSchemaValidationError, ElementApi, FOREIGN_CONTENTEDITABLE_SELECTOR, HISTORY_ABSORB_DELETED_TAG, MAIN_ROOT_KEY, NodeApi, PathApi, PointApi, RangeApi, SelectionApi, TextApi, afterActiveTransactionEnds, assertDetachedSelectionSupported, assertEditorDocumentContainers, attachTransactionSpecAfterCommit, authoredDirectProperties, brandRuntimePluginDescriptor, buildDefaultChild, canPlaceBlocksAtPath, captureHistoryAnchor, claimsHistoryReplay, cloneEditorJsonValue, closestShadowAware, compilePluginInput, completePersistedDocumentFields, configureAuthoredView, containsCompleteEditorSchema, createAuthoredEditorView, createBranchEditor, createCompiledHotkeyMatcher, createDetachedContentSlice, createDetachedEditorSchema, createDormantEditor, createEditor, createEditorOwner, createEditorSelectorStore, createEditorView, createPluginUpdateProxy, defineEditorSchema, definePluginPoint, defineRuntimePlugin, didCommitChangePersistedValue, editorCommands, editorReads, exportContentSlice, findEndMatterLandingIndex, fingerprintEditorDocumentValue, fitSlicePlacements, getActiveCommandEditor, getActiveEditorTransaction, getActiveEditorUpdateId, getActiveEditorUpdateIds, getActiveEditorUpdateTags, getActiveElement, getActiveTransactionEndedHandlers, getAnchorRuntimeId, getAuthoredUpdateView, getAuthoredViewCommit, getBranchDynamicPluginInputs, getCaretOwner, getCarriedCaretEditor, getCarriedRootEditor, getCommitDocumentValue, getCompiledEditorSchema, getCompiledEditorSchemaFromApi, getCompiledPropertyCandidates, getDocumentValueNode, getEditorAuthoredDocumentCapability, getEditorCommitNode, getEditorCommitSnapshot, getEditorCommitValue, getEditorDocumentShapeIssueMessage, getEditorRuntimeOwner, getEditorRuntimeRootKeys, getEditorUpdateRoot, getInstalledPlugin, getInternalEditorRuntimeOwner, getMutationVersion, getPluginCompartmentInput, getPluginContributions, getReaderRange, getRecordSetVersion, getSchemaElementSourceReference, getSnapshotVersion, getStateFieldEqualityFn, getStateViewPresentation, getTextSearchScope, getUpdateStartValue, getValueRecords, getViewAuthor, getViewCommitSource, getViewPresentation, hasAuthoredPendingInsertion, hasAuthoredRuntime, hasNonWritableAt, hasNonWritableContributors, holdsCaret, initializePluginEntries, isAuthorId, isAuthoredFormatOnlyPropertyWrite, isAuthoredPreview, isDocumentView, isEditorClosingOrDestroyed, isEditorDraftView, isEditorDryRun, isEditorPublishingCommit, isEnvelopeInput, isGeckoDOMHost, isPersistedEffect, isProposeOnlyView, isRootSelectionChanged, isRuntimePlugin, isTextRun, isTxOnlyMethod, joinKeepsPrefixOccupant, landNodePropertiesAt, liftAuthoredRange, liftAuthoredViewRange, locateAt, mapDetachedSelectionThroughChange, mapHistoryAnchor, mapSemanticUpdateMethodArguments, markRootViewInteraction, nonWritableContent, nonWritableRoot, normalizeSelectorDependencies, normalizeSetValues, notePasteLoss, notifyEditorAdmissionChange, notifyObservers, onPresentationRelease, preserveCompiledSchemaPropertyIdentity, projectEditorView, projectEditorViewCommit, property, readAuthoredChangeBridge, readAuthoredProjectedRoot, readAuthoredView, readCaretViewIn, readCommitRootIndex, readComposedSelectionRange, readDocumentRange, readDocumentRecord, readDocumentRootChildren, readEditorCommitChangesHistoryTopStep, readEditorCommitHistoryEntry, readEditorOptions, readEditorSyncAccess, readElementPropertyWrites, readNamedRootChildren, readOptionalRuntimeRootEditorLookup, readPersistedEnvelope, readRecord, readRootViewUse, readShownDocument, readShownElementById, readShownPreview, readShownRecords, readShownViewUse, readStoredEditorDocument, readViewPage, readingCovered, recordEditorHistoryEffect, recordSetChanges, recordSetIds, refuseWritePolicy, registerEditableKeyDownFallback, registerEditorAdmissionCheck, registerEditorBranchFactory, registerEditorTransactionGuard, rejectEditorRecord, reportEditorLifecycleError, resolveInstalledPlugin, resolveLocationRoot, resolvePluginMethod, resolveStoredAnchor, restoreHistoryAnchor, runEditableKeyDownFallback, runEditorObserver, sameResult, scheduleAfterCommitNotification, schema, selectorDependenciesSubscriptionKey, serializeStructuralPlainText, setDOMClipboardFormatKey, setDOMTextSyncRendererCapability, setEditorPluginInputValidator, setEditorStateViewTransform, setEditorTransactionViewTransform, setPluginPortalFactory, setRetainedTextFlowRendererCapability, setSelectionAsView, setShownSelectionAsView, shareBranchDocumentStore, skipHistoryIfOnlyProperties, snapshotEditorJsonValue, splitTopLevelEndMatter, subscribeCaretTarget, subscribeEditorNodeChange, subscribeEditorRefusals, subscribeEditorTextChange, subscribeEditorViewState, subscribePublishedCommits, subscribeSharedEditorViewState, subscribeShownViewUse, transfer, txLocate, txStored, vetoesWrite, visitDocumentChangeSections, withCompiledEditorSchemaCapabilityEntries, withDocumentViewRead, withEditorDocumentProjection, withEditorUpdateRootScope, withMintingFitDocument, withMountedPresentation, withPliteReactPreservedSelection, withPluginPortalCandidates, withStoredAuthoredRead, withTransactionSpecDraftRead };
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
+
import { hasNonWritableAt } from "../../../facade.js";
|
|
1
2
|
import { definePlugin } from "../../../lib/plugin/definePlugin.js";
|
|
3
|
+
import { SPACE_TRIGGERS } from "../../../lib/plugins/input-rules/inputRules.internal.js";
|
|
4
|
+
import { applyBlockInsertion, hasInsertionTarget, isReplaceableEmptyBlock } from "../../../internal/plugin/blockInsertion.js";
|
|
5
|
+
import { resolveInputRuleEditor } from "../../../lib/plugins/input-rules/inputRuleVeto.internal.js";
|
|
2
6
|
import { BaseParagraphPlugin } from "../../../lib/plugins/paragraph/BaseParagraphPlugin.js";
|
|
3
7
|
import { defineInputRule } from "../../../lib/plugins/input-rules/defineInputRule.js";
|
|
4
8
|
import { matchBlockStart } from "../../../lib/plugins/input-rules/createInputRules.js";
|
|
5
9
|
import { PLUGINS } from "../../../utils/plate-keys.js";
|
|
6
10
|
import { ElementApi, NodeApi, PathApi, TextApi, locateAt, txLocate } from "../../../core.js";
|
|
7
|
-
import { getMarkdownParagraphType } from "../../../internal/plugin/markdownParagraph.js";
|
|
11
|
+
import { getMarkdownParagraphType, groupMarkdownInlineRuns } from "../../../internal/plugin/markdownParagraph.js";
|
|
8
12
|
//#region src/features/basic-nodes/lib/BaseBlockPlugins.ts
|
|
9
13
|
const thematicBreakDashRe = /^(--|—)$/;
|
|
14
|
+
const DEFAULT_HORIZONTAL_RULE_VARIANTS = [
|
|
15
|
+
"-",
|
|
16
|
+
"_",
|
|
17
|
+
"*"
|
|
18
|
+
];
|
|
19
|
+
const hasLandedAfterHorizontalRule = (tx, hrPath, editor) => {
|
|
20
|
+
const selection = tx.selection();
|
|
21
|
+
const next = selection && tx.nodes.block({ at: selection.focus });
|
|
22
|
+
return !!next && !tx.schema.isVoid(next[0]) && !tx.schema.isReadOnly(next[0]) && (!editor || !hasNonWritableAt(editor, tx.key(next[0]))) && PathApi.isCommon(PathApi.next(hrPath), next[1]);
|
|
23
|
+
};
|
|
10
24
|
const BlockquoteRules = { markdown: ({ enabled, marker = ">", priority } = {}) => defineInputRule({
|
|
11
25
|
target: "insertText",
|
|
12
|
-
trigger:
|
|
26
|
+
trigger: SPACE_TRIGGERS,
|
|
13
27
|
priority,
|
|
14
28
|
enabled,
|
|
15
29
|
resolve: (context) => {
|
|
@@ -31,28 +45,34 @@ const BlockquoteRules = { markdown: ({ enabled, marker = ">", priority } = {}) =
|
|
|
31
45
|
}, { at: match.blockPath })) return decline();
|
|
32
46
|
}
|
|
33
47
|
}) };
|
|
34
|
-
const HorizontalRuleRules = { markdown: ({ enabled, priority,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
48
|
+
const HorizontalRuleRules = { markdown: ({ enabled, priority, variants = DEFAULT_HORIZONTAL_RULE_VARIANTS } = {}) => {
|
|
49
|
+
const hasDash = variants.includes("-");
|
|
50
|
+
const hasUnderscore = variants.includes("_");
|
|
51
|
+
const hasStar = variants.includes("*");
|
|
52
|
+
const triggers = [...hasDash ? ["-"] : [], ...hasUnderscore || hasStar ? SPACE_TRIGGERS : []];
|
|
53
|
+
return defineInputRule({
|
|
54
|
+
target: "insertText",
|
|
55
|
+
trigger: triggers,
|
|
56
|
+
enabled,
|
|
57
|
+
priority,
|
|
58
|
+
resolve: (context) => {
|
|
59
|
+
if (triggers.length === 0) return void 0;
|
|
60
|
+
const block = context.getBlockEntry();
|
|
61
|
+
if (!block || !block[0].children.every((child) => TextApi.isText(child)) || NodeApi.string(block[0]) !== context.getBlockStartText()) return;
|
|
62
|
+
const match = context.text === "-" ? hasDash ? matchBlockStart(context, { match: thematicBreakDashRe }) : void 0 : SPACE_TRIGGERS.some((trigger) => trigger === context.text) ? hasUnderscore && matchBlockStart(context, { match: "___" }) || hasStar && matchBlockStart(context, { match: "***" }) || void 0 : void 0;
|
|
63
|
+
return match ? {
|
|
64
|
+
...match,
|
|
65
|
+
path: block[1]
|
|
66
|
+
} : void 0;
|
|
67
|
+
},
|
|
68
|
+
apply: ({ decline, editor, tx }, match) => {
|
|
69
|
+
tx.text.delete({ at: match.range });
|
|
70
|
+
if (!tx.blocks.set({ type: editor.plugin(BaseHorizontalRulePlugin).schema.type })) return decline();
|
|
71
|
+
tx.break.insert();
|
|
72
|
+
return hasLandedAfterHorizontalRule(tx, match.path, resolveInputRuleEditor(editor)) ? void 0 : decline();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} };
|
|
56
76
|
/** Enables support for block quotes, useful for quotations and passages. */
|
|
57
77
|
const BaseBlockquotePlugin = definePlugin(PLUGINS.blockquote, {
|
|
58
78
|
schema: ({ plugins }) => ({ element: { content: plugins.blockContent({
|
|
@@ -60,6 +80,17 @@ const BaseBlockquotePlugin = definePlugin(PLUGINS.blockquote, {
|
|
|
60
80
|
min: 1
|
|
61
81
|
}) } }),
|
|
62
82
|
formats: ({ defineFormats, schema: { type } }) => defineFormats({
|
|
83
|
+
docx: {
|
|
84
|
+
decode: ({ decodeBlocks, node }) => ({
|
|
85
|
+
children: decodeBlocks(node.children),
|
|
86
|
+
type
|
|
87
|
+
}),
|
|
88
|
+
encode: ({ encodeBlocks }) => ({
|
|
89
|
+
children: encodeBlocks(),
|
|
90
|
+
kind: "blockquote"
|
|
91
|
+
}),
|
|
92
|
+
node: "blockquote"
|
|
93
|
+
},
|
|
63
94
|
plainText: { encode: ({ children }) => children.split("\n").map((line) => `> ${line}`).join("\n") },
|
|
64
95
|
html: {
|
|
65
96
|
decode: () => ({}),
|
|
@@ -71,19 +102,19 @@ const BaseBlockquotePlugin = definePlugin(PLUGINS.blockquote, {
|
|
|
71
102
|
},
|
|
72
103
|
markdown: {
|
|
73
104
|
node: "blockquote",
|
|
74
|
-
decode: ({
|
|
75
|
-
children:
|
|
76
|
-
|
|
77
|
-
isInline,
|
|
78
|
-
registry
|
|
105
|
+
decode: ({ decode, marks, registry, isBlock, isInline, node }) => ({
|
|
106
|
+
children: groupMarkdownInlineRuns(node.children.length === 0 ? [] : decode(node.children, marks), {
|
|
107
|
+
defaultEmpty: true,
|
|
108
|
+
isBlock: (child) => !isInline(child) && isBlock(child),
|
|
109
|
+
paragraphType: getMarkdownParagraphType(registry)
|
|
79
110
|
}),
|
|
80
111
|
type
|
|
81
112
|
}),
|
|
82
|
-
encode: ({
|
|
83
|
-
children:
|
|
84
|
-
|
|
85
|
-
isInline,
|
|
86
|
-
registry
|
|
113
|
+
encode: ({ encodeFlow, isBlock, isInline, node, registry }) => ({
|
|
114
|
+
children: encodeFlow(groupMarkdownInlineRuns(node.children, {
|
|
115
|
+
defaultEmpty: true,
|
|
116
|
+
isBlock: (child) => !isInline(child) && isBlock(child),
|
|
117
|
+
paragraphType: getMarkdownParagraphType(registry)
|
|
87
118
|
})),
|
|
88
119
|
type: "blockquote"
|
|
89
120
|
})
|
|
@@ -94,52 +125,79 @@ const BaseBlockquotePlugin = definePlugin(PLUGINS.blockquote, {
|
|
|
94
125
|
break: { empty: (context) => isLiftableBlockquoteChild(context) ? "lift" : void 0 },
|
|
95
126
|
delete: { start: (context) => {
|
|
96
127
|
if (!isLiftableBlockquoteChild(context)) return void 0;
|
|
97
|
-
const {
|
|
98
|
-
if (!
|
|
99
|
-
const parent = editor.read.nodes.parent(path);
|
|
100
|
-
if (!parent || !ElementApi.isElement(parent[0]) || parent[0].type !== schema.type) return "lift";
|
|
128
|
+
const { node, path, state } = context;
|
|
129
|
+
if (!state.selection() || !state.nodes.isEmpty(node)) return "lift";
|
|
101
130
|
return PathApi.hasPrevious(path) ? void 0 : "lift";
|
|
102
131
|
} }
|
|
103
132
|
},
|
|
104
|
-
shortcuts: { untab: {
|
|
105
|
-
|
|
133
|
+
shortcuts: { untab: {
|
|
134
|
+
keys: "shift+tab",
|
|
135
|
+
priority: -10
|
|
136
|
+
} },
|
|
137
|
+
update: ({ plugin, tx, schema: { type } }) => ({
|
|
106
138
|
wrap: txLocate(locateAt(0), ({ at } = {}) => {
|
|
107
|
-
|
|
139
|
+
const runs = [];
|
|
140
|
+
const blocks = [...tx.nodes.blocks({ at })].toSorted((a, b) => PathApi.compare(a[1], b[1]));
|
|
141
|
+
for (const [node, path] of blocks) {
|
|
108
142
|
if (node.type === type || tx.nodes.above({
|
|
109
143
|
at: path,
|
|
110
144
|
type: plugin
|
|
111
145
|
})) continue;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
146
|
+
const run = runs.at(-1);
|
|
147
|
+
const last = run?.at(-1);
|
|
148
|
+
if (run && last && PathApi.equals(PathApi.next(last), path)) run.push(path);
|
|
149
|
+
else runs.push([path]);
|
|
116
150
|
}
|
|
151
|
+
if (runs.length === 0) return false;
|
|
152
|
+
if (!runs.every((run) => run.every((path) => tx.schema.canWrap({
|
|
153
|
+
children: [],
|
|
154
|
+
type
|
|
155
|
+
}, { at: path })))) return false;
|
|
156
|
+
let changed = false;
|
|
157
|
+
for (const run of runs.toReversed()) if (tx.nodes.wrap({
|
|
158
|
+
children: [],
|
|
159
|
+
type
|
|
160
|
+
}, run.length === 1 ? { at: run[0] } : {
|
|
161
|
+
at: PathApi.parent(run[0]),
|
|
162
|
+
match: (_node, path) => run.some((member) => PathApi.equals(member, path))
|
|
163
|
+
})) changed = true;
|
|
164
|
+
return changed;
|
|
117
165
|
}),
|
|
118
166
|
toggle: () => tx.blocks.toggle({ type }, { wrap: true }),
|
|
119
167
|
untab: () => {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}),
|
|
126
|
-
mode: "lowest"
|
|
127
|
-
})].sort((a, b) => b[1].length - a[1].length || b[1].join(".").localeCompare(a[1].join(".")));
|
|
168
|
+
const blocks = [...tx.nodes.blocks({ mode: "lowest" })].filter(([node, path]) => {
|
|
169
|
+
if (node.indent || node.listType || tx.schema.getElementBehavior(node)?.ownsExit) return false;
|
|
170
|
+
const parent = tx.nodes.parent(path);
|
|
171
|
+
return !!parent && ElementApi.isElement(parent[0]) && parent[0].type === type;
|
|
172
|
+
}).toSorted((a, b) => PathApi.compare(b[1], a[1]));
|
|
128
173
|
if (blocks.length === 0) return false;
|
|
129
|
-
|
|
130
|
-
|
|
174
|
+
let lifted = false;
|
|
175
|
+
for (const [node, path] of blocks) {
|
|
176
|
+
const key = tx.key(node);
|
|
177
|
+
tx.nodes.lift({ at: path });
|
|
178
|
+
const nextEntry = tx.nodes.get(key);
|
|
179
|
+
if (nextEntry && !PathApi.equals(nextEntry[1], path)) lifted = true;
|
|
180
|
+
}
|
|
181
|
+
return lifted;
|
|
131
182
|
}
|
|
132
183
|
})
|
|
133
184
|
});
|
|
134
|
-
function isLiftableBlockquoteChild({ editor, node, path, schema }) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
});
|
|
185
|
+
function isLiftableBlockquoteChild({ editor, node, path, schema, state }) {
|
|
186
|
+
if (node.type !== editor.plugin(BaseParagraphPlugin).schema.type || node.listType) return false;
|
|
187
|
+
const parent = state.nodes.parent(path);
|
|
188
|
+
return !!parent && ElementApi.isElement(parent[0]) && parent[0].type === schema.type;
|
|
139
189
|
}
|
|
140
190
|
const BaseHorizontalRulePlugin = definePlugin(PLUGINS.horizontalRule, {
|
|
141
191
|
schema: { element: { void: "block" } },
|
|
142
192
|
formats: ({ defineFormats, schema: { type } }) => defineFormats({
|
|
193
|
+
docx: {
|
|
194
|
+
decode: () => ({
|
|
195
|
+
children: [{ text: "" }],
|
|
196
|
+
type
|
|
197
|
+
}),
|
|
198
|
+
encode: () => ({ kind: "horizontalRule" }),
|
|
199
|
+
node: "horizontalRule"
|
|
200
|
+
},
|
|
143
201
|
plainText: { encode: () => "---" },
|
|
144
202
|
html: {
|
|
145
203
|
decode: () => ({}),
|
|
@@ -155,33 +213,58 @@ const BaseHorizontalRulePlugin = definePlugin(PLUGINS.horizontalRule, {
|
|
|
155
213
|
encode: () => ({ type: "thematicBreak" })
|
|
156
214
|
}
|
|
157
215
|
}),
|
|
158
|
-
component: "hr"
|
|
216
|
+
component: "hr",
|
|
217
|
+
update: ({ editor, tx, schema: { type } }) => {
|
|
218
|
+
const insertDivider = (mode, properties = {}, options = {}) => {
|
|
219
|
+
if (!hasInsertionTarget(tx, options)) return false;
|
|
220
|
+
const element = tx.schema.create(type, properties);
|
|
221
|
+
let insertedKeys;
|
|
222
|
+
if (!applyBlockInsertion({
|
|
223
|
+
editor,
|
|
224
|
+
insert: (blockOptions) => {
|
|
225
|
+
insertedKeys = tx.blocks.insert(element, blockOptions);
|
|
226
|
+
return insertedKeys !== void 0;
|
|
227
|
+
},
|
|
228
|
+
matches: () => false,
|
|
229
|
+
mode,
|
|
230
|
+
options: {
|
|
231
|
+
...options,
|
|
232
|
+
select: false
|
|
233
|
+
},
|
|
234
|
+
tx
|
|
235
|
+
})) return false;
|
|
236
|
+
if (!options.select) return true;
|
|
237
|
+
const hrKey = insertedKeys?.[0];
|
|
238
|
+
const hrEntry = hrKey ? tx.nodes.get(hrKey) : void 0;
|
|
239
|
+
if (!hrEntry || !hrKey) return true;
|
|
240
|
+
const hrPath = hrEntry[1];
|
|
241
|
+
const nextEntry = tx.nodes.get(PathApi.next(hrPath));
|
|
242
|
+
if (nextEntry && ElementApi.isElement(nextEntry[0]) && isReplaceableEmptyBlock(editor, tx, [nextEntry[0], nextEntry[1]])) {
|
|
243
|
+
const nextPoint = tx.points.start(tx.key(nextEntry[0]));
|
|
244
|
+
if (nextPoint) {
|
|
245
|
+
tx.selection.set(nextPoint);
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const hrPoint = tx.points.start(hrKey);
|
|
250
|
+
if (hrPoint) {
|
|
251
|
+
const nextBefore = tx.nodes.get(PathApi.next(hrPath));
|
|
252
|
+
const nextBeforeKey = nextBefore && ElementApi.isElement(nextBefore[0]) ? tx.key(nextBefore[0]) : void 0;
|
|
253
|
+
tx.selection.set(hrPoint);
|
|
254
|
+
tx.break.insert();
|
|
255
|
+
if (!hasLandedAfterHorizontalRule(tx, hrPath, editor)) {
|
|
256
|
+
const nextAfter = tx.nodes.get(PathApi.next(hrPath));
|
|
257
|
+
if (nextAfter && ElementApi.isElement(nextAfter[0]) && tx.key(nextAfter[0]) !== nextBeforeKey) tx.nodes.remove({ at: PathApi.next(hrPath) });
|
|
258
|
+
tx.selection.set(hrPoint);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return true;
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
insert: txLocate(locateAt(1, "at", "after", "before"), (properties = {}, options) => insertDivider("insert", properties, options)),
|
|
265
|
+
upsert: txLocate(locateAt(1, "after", "before"), (properties = {}, options) => insertDivider("upsert", properties, options))
|
|
266
|
+
};
|
|
267
|
+
}
|
|
159
268
|
});
|
|
160
|
-
const groupInlineChildrenIntoParagraphs = (children, context) => {
|
|
161
|
-
const paragraphType = getMarkdownParagraphType(context.registry);
|
|
162
|
-
const elements = [];
|
|
163
|
-
let inlineNodes = [];
|
|
164
|
-
const flushInlineNodes = () => {
|
|
165
|
-
if (inlineNodes.length === 0) return;
|
|
166
|
-
elements.push({
|
|
167
|
-
children: inlineNodes,
|
|
168
|
-
type: paragraphType
|
|
169
|
-
});
|
|
170
|
-
inlineNodes = [];
|
|
171
|
-
};
|
|
172
|
-
children.forEach((child) => {
|
|
173
|
-
if (ElementApi.isElement(child) && !context.isInline(child) && context.isBlock(child)) {
|
|
174
|
-
flushInlineNodes();
|
|
175
|
-
elements.push(child);
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
inlineNodes.push(child);
|
|
179
|
-
});
|
|
180
|
-
flushInlineNodes();
|
|
181
|
-
return elements.length > 0 ? elements : [{
|
|
182
|
-
children: [{ text: "" }],
|
|
183
|
-
type: paragraphType
|
|
184
|
-
}];
|
|
185
|
-
};
|
|
186
269
|
//#endregion
|
|
187
270
|
export { BaseBlockquotePlugin, BaseHorizontalRulePlugin, BlockquoteRules, HorizontalRuleRules };
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { getCompiledPlatePlugin } from "../../../internal/plugin/compilePlateModel.js";
|
|
2
2
|
import { definePlugin } from "../../../lib/plugin/definePlugin.js";
|
|
3
|
+
import { SPACE_TRIGGERS } from "../../../lib/plugins/input-rules/inputRules.internal.js";
|
|
4
|
+
import { applyBlockInsertion, hasInsertionTarget, matchesGeneratedBlockInsertion } from "../../../internal/plugin/blockInsertion.js";
|
|
3
5
|
import { defineInputRule } from "../../../lib/plugins/input-rules/defineInputRule.js";
|
|
4
6
|
import { matchBlockStart } from "../../../lib/plugins/input-rules/createInputRules.js";
|
|
5
7
|
import { PLUGINS } from "../../../utils/plate-keys.js";
|
|
6
|
-
import { property, schema, txLocate } from "../../../core.js";
|
|
8
|
+
import { ElementApi, TextApi, locateAt, property, schema, txLocate } from "../../../core.js";
|
|
7
9
|
//#region src/features/basic-nodes/lib/BaseHeadingPlugins.ts
|
|
10
|
+
const DEFAULT_HEADING_LEVELS = [
|
|
11
|
+
1,
|
|
12
|
+
2,
|
|
13
|
+
3,
|
|
14
|
+
4,
|
|
15
|
+
5,
|
|
16
|
+
6
|
|
17
|
+
];
|
|
18
|
+
const initialState = { levels: DEFAULT_HEADING_LEVELS };
|
|
8
19
|
const isHeadingLevel = (value) => typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 6;
|
|
20
|
+
const isAllowedHeadingLevel = (levels, value) => isHeadingLevel(value) && (levels ?? DEFAULT_HEADING_LEVELS).includes(value);
|
|
21
|
+
const levelProps = (level, type, detailsTitleType) => (node) => node.type === detailsTitleType ? { level } : {
|
|
22
|
+
level,
|
|
23
|
+
type
|
|
24
|
+
};
|
|
9
25
|
const rules = {
|
|
10
26
|
break: { splitReset: true },
|
|
11
27
|
delete: {
|
|
@@ -15,6 +31,7 @@ const rules = {
|
|
|
15
31
|
merge: { removeEmpty: true }
|
|
16
32
|
};
|
|
17
33
|
const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
|
|
34
|
+
initialState,
|
|
18
35
|
schema: { element: {
|
|
19
36
|
...schema.element.textBlock(),
|
|
20
37
|
properties: { level: property.json({
|
|
@@ -24,8 +41,29 @@ const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
|
|
|
24
41
|
}) }
|
|
25
42
|
} },
|
|
26
43
|
formats: ({ defineFormats, schema: { type } }) => defineFormats({
|
|
44
|
+
docx: {
|
|
45
|
+
decode: ({ decodeInlines, node }) => ({
|
|
46
|
+
children: decodeInlines(node.children),
|
|
47
|
+
level: node.level,
|
|
48
|
+
type
|
|
49
|
+
}),
|
|
50
|
+
encode: ({ encodeInlines, key, node }) => {
|
|
51
|
+
const bookmark = key();
|
|
52
|
+
return {
|
|
53
|
+
...bookmark === void 0 ? {} : { bookmark },
|
|
54
|
+
children: encodeInlines(),
|
|
55
|
+
kind: "paragraph",
|
|
56
|
+
style: `Heading${node.level}`
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
node: "heading"
|
|
60
|
+
},
|
|
27
61
|
html: {
|
|
28
|
-
decode: ({ element, registry }) =>
|
|
62
|
+
decode: ({ element, registry }) => {
|
|
63
|
+
if (element.parentElement?.tagName === "SUMMARY" && registry.has(PLUGINS.detailsSummary)) return;
|
|
64
|
+
const level = Number(element.tagName.slice(1));
|
|
65
|
+
return isHeadingLevel(level) ? { level } : void 0;
|
|
66
|
+
},
|
|
29
67
|
encode: ({ content, node, preserve }) => {
|
|
30
68
|
preserve("level");
|
|
31
69
|
return {
|
|
@@ -44,11 +82,32 @@ const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
|
|
|
44
82
|
},
|
|
45
83
|
markdown: {
|
|
46
84
|
node: "heading",
|
|
47
|
-
decode: ({ decode, marks, node }) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
type
|
|
51
|
-
|
|
85
|
+
decode: ({ decode, marks, node, schema: formatSchema }) => {
|
|
86
|
+
if (!isHeadingLevel(node.depth)) return void 0;
|
|
87
|
+
const children = decode(node.children, marks);
|
|
88
|
+
const isDisallowedBlock = (child) => ElementApi.isElement(child) && !formatSchema.getElementBehavior(child)?.inline && !formatSchema.allowsElementType(type, child.type);
|
|
89
|
+
if (!children.some(isDisallowedBlock)) return {
|
|
90
|
+
children,
|
|
91
|
+
level: node.depth,
|
|
92
|
+
type
|
|
93
|
+
};
|
|
94
|
+
const nodes = [];
|
|
95
|
+
let run = [];
|
|
96
|
+
const flush = () => {
|
|
97
|
+
if (run.some((child) => !TextApi.isText(child) || child.text.trim() !== "")) nodes.push({
|
|
98
|
+
children: run,
|
|
99
|
+
level: node.depth,
|
|
100
|
+
type
|
|
101
|
+
});
|
|
102
|
+
run = [];
|
|
103
|
+
};
|
|
104
|
+
for (const child of children) if (isDisallowedBlock(child)) {
|
|
105
|
+
flush();
|
|
106
|
+
nodes.push(child);
|
|
107
|
+
} else run.push(child);
|
|
108
|
+
flush();
|
|
109
|
+
return nodes;
|
|
110
|
+
},
|
|
52
111
|
encode: ({ encodePhrasing, node, preserve }) => {
|
|
53
112
|
preserve("level");
|
|
54
113
|
return {
|
|
@@ -60,39 +119,93 @@ const BaseHeadingPlugin = definePlugin(PLUGINS.heading, {
|
|
|
60
119
|
}
|
|
61
120
|
}),
|
|
62
121
|
rules,
|
|
63
|
-
read: ({ editor, schema: { type }
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
122
|
+
read: ({ editor, schema: { type }, state, store }) => {
|
|
123
|
+
const detailsTitleType = () => {
|
|
124
|
+
const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
|
|
125
|
+
const summarySchema = summary ? editor.plugin(summary).schema : void 0;
|
|
126
|
+
return summarySchema && "type" in summarySchema ? summarySchema.type : void 0;
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
level: (node) => (node.type === type || node.type === detailsTitleType()) && isHeadingLevel(node.level) ? node.level : void 0,
|
|
130
|
+
/**
|
|
131
|
+
* Whether `setLevel(level)` can apply: `level` is enabled and the schema
|
|
132
|
+
* lets every selected block take the level where it sits.
|
|
133
|
+
*/
|
|
134
|
+
canSetLevel: (level) => {
|
|
135
|
+
if (!isAllowedHeadingLevel(store.get().levels, level)) return false;
|
|
136
|
+
const blocks = state.nodes.blocks();
|
|
137
|
+
const props = levelProps(level, type, detailsTitleType());
|
|
138
|
+
const root = state.view.root();
|
|
139
|
+
return blocks.length > 0 && blocks.every(([node, path]) => state.schema.canPlace([{
|
|
140
|
+
...node,
|
|
141
|
+
...props(node)
|
|
142
|
+
}], {
|
|
143
|
+
at: path,
|
|
144
|
+
replace: true,
|
|
145
|
+
root
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}).extend(({ read }) => ({ update: ({ editor, name, store, tx, schema: { type } }) => {
|
|
69
151
|
const summary = getCompiledPlatePlugin(editor, PLUGINS.detailsSummary);
|
|
70
|
-
const
|
|
152
|
+
const summarySchema = summary ? editor.plugin(summary).schema : void 0;
|
|
153
|
+
const detailsTitleType = summarySchema && "type" in summarySchema ? summarySchema.type : void 0;
|
|
154
|
+
const insertHeading = (mode, properties, options = {}) => {
|
|
155
|
+
if (!isAllowedHeadingLevel(store.get().levels, properties.level)) return false;
|
|
156
|
+
if (!hasInsertionTarget(tx, options)) return false;
|
|
157
|
+
const element = tx.schema.create(type, properties);
|
|
158
|
+
return applyBlockInsertion({
|
|
159
|
+
editor,
|
|
160
|
+
insert: (blockOptions) => tx.blocks.insert(element, blockOptions) !== void 0,
|
|
161
|
+
matches: (source) => matchesGeneratedBlockInsertion({
|
|
162
|
+
editor,
|
|
163
|
+
pluginName: name,
|
|
164
|
+
properties,
|
|
165
|
+
source,
|
|
166
|
+
target: element,
|
|
167
|
+
tx
|
|
168
|
+
}),
|
|
169
|
+
mode,
|
|
170
|
+
options,
|
|
171
|
+
tx
|
|
172
|
+
});
|
|
173
|
+
};
|
|
71
174
|
const setLevel = txLocate(false, (level) => {
|
|
175
|
+
if (!isAllowedHeadingLevel(store.get().levels, level)) return false;
|
|
72
176
|
const blocks = tx.nodes.blocks();
|
|
73
177
|
if (blocks.length === 0) return false;
|
|
74
|
-
return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set((
|
|
75
|
-
level,
|
|
76
|
-
type
|
|
77
|
-
});
|
|
178
|
+
return blocks.every(([node]) => read.level(node) === level) || tx.blocks.set(levelProps(level, type, detailsTitleType));
|
|
78
179
|
});
|
|
79
180
|
return {
|
|
181
|
+
insert: txLocate(locateAt(1, "at", "after", "before"), (properties, options) => insertHeading("insert", properties, options)),
|
|
80
182
|
setLevel,
|
|
81
|
-
toggle: txLocate(false, ({ level }) =>
|
|
183
|
+
toggle: txLocate(false, ({ level }) => {
|
|
184
|
+
if (!isAllowedHeadingLevel(store.get().levels, level)) return false;
|
|
185
|
+
const blocks = tx.nodes.blocks();
|
|
186
|
+
if (blocks.length === 0) return false;
|
|
187
|
+
return blocks.every(([node]) => read.level(node) === level) ? tx.blocks.reset({ unset: "level" }) : setLevel(level);
|
|
188
|
+
}),
|
|
189
|
+
upsert: txLocate(locateAt(1, "after", "before"), (properties, options) => insertHeading("upsert", properties, options))
|
|
82
190
|
};
|
|
83
191
|
} }));
|
|
84
192
|
const HeadingRules = { markdown: ({ enabled, priority } = {}) => defineInputRule(BaseHeadingPlugin, {
|
|
85
193
|
target: "insertText",
|
|
86
|
-
trigger:
|
|
194
|
+
trigger: SPACE_TRIGGERS,
|
|
87
195
|
enabled,
|
|
88
196
|
priority,
|
|
89
|
-
resolve: (context) =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
197
|
+
resolve: (context) => {
|
|
198
|
+
const heading = context.editor.plugin(BaseHeadingPlugin);
|
|
199
|
+
if (!heading.installed) return void 0;
|
|
200
|
+
const allowedLevels = heading.store.get().levels;
|
|
201
|
+
return matchBlockStart(context, {
|
|
202
|
+
match: /^(#{1,6})$/,
|
|
203
|
+
resolveMatch: ({ match }) => {
|
|
204
|
+
const level = match[1].length;
|
|
205
|
+
return isAllowedHeadingLevel(allowedLevels, level) ? { level } : void 0;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
},
|
|
96
209
|
apply: ({ decline, editor, tx }, match) => {
|
|
97
210
|
const block = tx.nodes.block();
|
|
98
211
|
if (!block || editor.plugin(BaseHeadingPlugin).read.level(block[0]) === match.level) return decline();
|