platejs 54.0.0-beta.8 → 54.0.0-beta.9
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/THIRD_PARTY_NOTICES.md +0 -28
- package/dist/EditorStatic-BKBBZZn8.d.ts +771 -0
- package/dist/ai/index.d.ts +2 -40
- package/dist/ai/index.js +4 -2
- package/dist/ai/lib/aiDraftSession.js +984 -0
- package/dist/ai/{react → lib}/aiOutputLanding.internal.js +76 -97
- package/dist/ai/lib/aiPolicy.internal.js +403 -0
- package/dist/ai/lib/editorAgent.js +1696 -0
- package/dist/ai/lib/lockedContext.internal.js +26 -1
- package/dist/ai/lib/lockedContext.js +122 -30
- package/dist/ai/lib/registerEditorTools.js +235 -0
- package/dist/ai/react/AIPlugin.js +246 -0
- package/dist/ai/react/CopilotPlugin.js +317 -199
- package/dist/ai/react/copilotInline.internal.js +358 -0
- package/dist/ai/react/index.d.ts +200 -821
- package/dist/ai/react/index.js +3 -3
- package/dist/ai/react/useEditorAgent.js +193 -0
- package/dist/authored/AuthoredPlugin.js +34 -2
- package/dist/authored/index.d.ts +5 -4
- package/dist/authored/index.js +3 -2
- package/dist/{features/suggestion → authored}/suggestionColorOf.js +4 -4
- package/dist/{index-BeyI3RUg.d.ts → authored-BQAGqGhS-DN3sw1OP.d.ts} +62 -39
- package/dist/clipboard-format-key-CWuwPPe2-BJGVrNlz.d.ts +1 -0
- package/dist/code-block/codemirror/createCodeMirrorAdapter.js +224 -58
- package/dist/code-block/codemirror/index.d.ts +2 -1
- package/dist/comment-anchor.internal-L2GsNCIh.d.ts +28 -0
- package/dist/compiler/index.d.ts +9 -3
- package/dist/compiler/index.js +3 -1
- package/dist/{core-D8i_gkA6.d.ts → core-N8rIvQxS.d.ts} +2171 -2000
- package/dist/core.js +4 -8
- package/dist/diff/index.d.ts +2 -2
- package/dist/docs/ai.md +475 -387
- package/dist/docs/api/anchor.md +1 -1
- package/dist/docs/api/core/plate-components.md +12 -3
- package/dist/docs/api/core/plate-editor.md +1 -1
- package/dist/docs/api/core/plate-plugin.md +33 -21
- package/dist/docs/api/core/plate-store.md +14 -13
- package/dist/docs/api/core.md +62 -91
- package/dist/docs/api/document-change.md +24 -20
- package/dist/docs/api/dom.md +66 -102
- package/dist/docs/api/editor-api.md +74 -42
- package/dist/docs/api/editor-transforms.md +17 -39
- package/dist/docs/api/location.md +5 -12
- package/dist/docs/api/plate.md +2 -2
- package/dist/docs/api/react-hooks.md +108 -49
- package/dist/docs/api/selection.md +10 -2
- package/dist/docs/api/utils.md +14 -14
- package/dist/docs/authored-changes.md +32 -30
- package/dist/docs/autoformat.md +4 -1
- package/dist/docs/basic-marks.md +0 -1
- package/dist/docs/block-menu.md +2 -3
- package/dist/docs/block-placeholder.md +2 -3
- package/dist/docs/board.md +23 -20
- package/dist/docs/clear-formatting.md +4 -4
- package/dist/docs/clipboard.md +25 -18
- package/dist/docs/code-block.md +62 -40
- package/dist/docs/column.md +28 -15
- package/dist/docs/combobox.md +36 -51
- package/dist/docs/comment.md +171 -141
- package/dist/docs/controlled.md +5 -7
- package/dist/docs/copilot.md +183 -148
- package/dist/docs/debugging.md +5 -14
- package/dist/docs/discussion.md +34 -28
- package/dist/docs/dnd.md +7 -6
- package/dist/docs/document-meta.md +27 -28
- package/dist/docs/document-model.md +9 -8
- package/dist/docs/docx.md +63 -116
- package/dist/docs/editor.md +59 -95
- package/dist/docs/emoji.md +4 -5
- package/dist/docs/equation.md +4 -4
- package/dist/docs/examples/collaboration-example.md +15 -30
- package/dist/docs/examples/export.md +10 -9
- package/dist/docs/examples/version-history.md +7 -6
- package/dist/docs/exit-break.md +32 -59
- package/dist/docs/external-text.md +28 -15
- package/dist/docs/field.md +3 -3
- package/dist/docs/find.md +70 -102
- package/dist/docs/footnote.md +40 -80
- package/dist/docs/format-painter.md +1 -1
- package/dist/docs/history.md +49 -63
- package/dist/docs/html.md +59 -28
- package/dist/docs/indent.md +39 -29
- package/dist/docs/ink.md +29 -12
- package/dist/docs/installation/docs.md +10 -0
- package/dist/docs/installation/node.md +12 -8
- package/dist/docs/installation/plate-ui.md +12 -7
- package/dist/docs/line-height.md +1 -1
- package/dist/docs/link.md +95 -98
- package/dist/docs/list.md +62 -54
- package/dist/docs/llms.txt +11 -9
- package/dist/docs/lock.md +28 -21
- package/dist/docs/markdown.md +118 -120
- package/dist/docs/media.md +31 -31
- package/dist/docs/mention.md +6 -9
- package/dist/docs/multi-select.md +17 -9
- package/dist/docs/pagination.md +144 -127
- package/dist/docs/performance.md +2 -2
- package/dist/docs/plugin-context.md +9 -8
- package/dist/docs/plugin-input-rules.md +84 -125
- package/dist/docs/plugin-methods.md +11 -9
- package/dist/docs/plugin-rules.md +11 -35
- package/dist/docs/plugin-shortcuts.md +1 -1
- package/dist/docs/plugin.md +53 -2
- package/dist/docs/prompt-editor.md +0 -1
- package/dist/docs/roots.md +2 -3
- package/dist/docs/schema.md +12 -3
- package/dist/docs/selection.md +3 -1
- package/dist/docs/serializing.md +9 -8
- package/dist/docs/slash-command.md +4 -4
- package/dist/docs/static.md +11 -5
- package/dist/docs/suggestion.md +51 -71
- package/dist/docs/sync.md +256 -0
- package/dist/docs/table.md +35 -20
- package/dist/docs/text-align.md +4 -4
- package/dist/docs/toolbar.md +26 -5
- package/dist/docs/trailing-block.md +18 -45
- package/dist/docs/underline.md +2 -2
- package/dist/docs/unit-testing.md +1 -1
- package/dist/docs/upload.md +71 -36
- package/dist/docx/export/index.d.ts +152 -56
- package/dist/docx/export/lib/colors.js +268 -0
- package/dist/docx/export/lib/compileAst.js +1825 -0
- package/dist/docx/export/lib/exportDocx.js +57 -159
- package/dist/docx/export/lib/mathOmml.js +233 -0
- package/dist/docx/export/lib/ooxmlBuilder.js +1759 -0
- package/dist/docx/export/lib/outputSafety.js +155 -82
- package/dist/docx/export/lib/reviewProjection.js +31 -202
- package/dist/docx/export/lib/sourcePreservation.js +133 -73
- package/dist/docx/export/lib/wordStyles.js +399 -0
- package/dist/docx/import/index.d.ts +4 -4
- package/dist/docx/import/lib/importDocx.js +1401 -1062
- package/dist/docx/import/lib/opcRelationships.js +77 -0
- package/dist/docx/import/lib/readWordDocument.js +990 -0
- package/dist/docx/import/lib/wordStyles.js +534 -0
- package/dist/docx/internal/diagnostics.js +67 -0
- package/dist/docx/internal/docxPackage.js +20 -44
- package/dist/docx/internal/domParser.js +2 -21
- package/dist/docx/internal/packageParts.js +15 -16
- package/dist/docx/internal/readDocxNumbering.js +35 -38
- package/dist/docx/internal/reviewPart.js +22 -21
- package/dist/docx/internal/sourceEligibility.js +87 -30
- package/dist/docx/internal/wordMath.js +102 -137
- package/dist/docx/internal/xmlTree.js +262 -0
- package/dist/docx/internal/xmlWriter.js +44 -0
- package/dist/docx/paste/index.d.ts +4 -4
- package/dist/docx/paste/lib/WordPastePlugin.js +12 -11
- package/dist/dom/index.d.ts +2 -2
- package/dist/dom/index.js +2 -2
- package/dist/dom/plite-dom.internal.js +2 -2
- package/dist/excalidraw/index.d.ts +6 -4
- package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +19 -7
- package/dist/excalidraw/react/index.d.ts +6 -4
- package/dist/facade.js +3 -3
- package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +31 -11
- package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +19 -1
- package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +95 -69
- package/dist/features/basic-styles/lib/BaseStylePlugins.js +79 -82
- package/dist/features/board/index.d.ts +2 -2
- package/dist/features/board/index.js +2 -2
- 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 +368 -283
- package/dist/features/board/lib/BaseBoardStrokePlugin.js +8 -5
- package/dist/features/board/lib/BaseBoardTextPlugin.js +3 -2
- package/dist/features/board/lib/boardArrow.internal.js +2 -2
- 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 +124 -0
- package/dist/features/board/lib/boardHtml.internal.js +36 -36
- package/dist/features/board/lib/boardMember.internal.js +8 -8
- package/dist/features/board/lib/boardShape.internal.js +10 -124
- package/dist/features/board/lib/boardStyle.internal.js +6 -6
- package/dist/features/board/lib/boardTypes.internal.js +6 -0
- package/dist/features/callout/index.d.ts +3 -3
- package/dist/features/callout/lib/BaseCalloutPlugin.js +46 -2
- package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +207 -179
- 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 +693 -0
- package/dist/features/comments/BaseCommentsPlugin.js +1315 -408
- package/dist/features/comments/comment-thread-index.internal.js +5 -4
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/date/index.d.ts +3 -3
- package/dist/features/date/lib/BaseDatePlugin.js +72 -31
- package/dist/features/details/index.d.ts +3 -3
- package/dist/features/details/lib/BaseDetailsPlugin.js +20 -22
- package/dist/features/field/index.d.ts +1 -1
- package/dist/features/field/lib/BaseFieldPlugin.js +58 -58
- package/dist/features/field/lib/fieldRules.internal.js +6 -6
- package/dist/features/find/index.d.ts +98 -34
- package/dist/features/find/lib/BaseFindPlugin.js +939 -370
- package/dist/features/footnote/index.d.ts +428 -2
- package/dist/features/footnote/lib/BaseFootnotePlugin.js +437 -167
- package/dist/features/indent/lib/BaseIndentPlugin.js +222 -75
- package/dist/features/indent/lib/indentHtml.internal.js +9 -0
- package/dist/features/indent/lib/indentLevel.internal.js +3 -3
- package/dist/features/ink/index.d.ts +1 -1
- package/dist/features/ink/lib/BaseInkPlugin.js +4 -3
- package/dist/features/ink/lib/inkPlaces.internal.js +3 -3
- package/dist/features/link/lib/BaseLinkPlugin.js +467 -186
- package/dist/features/lint/index.d.ts +5 -5
- package/dist/features/lint/lib/BaseLintPlugin.js +3 -1
- package/dist/features/list/lib/BaseListPlugin.js +99 -709
- package/dist/features/list/lib/listCommands.internal.js +161 -0
- package/dist/features/list/lib/listFamily.internal.js +69 -24
- package/dist/features/list/lib/listHtml.internal.js +185 -70
- package/dist/features/list/lib/listIndex.internal.js +50 -20
- package/dist/features/list/lib/listKeyboard.internal.js +176 -0
- package/dist/features/list/lib/listMarkdown.internal.js +127 -0
- package/dist/features/list/lib/listRules.internal.js +125 -0
- package/dist/features/lock/index.d.ts +2 -2
- package/dist/features/lock/index.js +2 -2
- package/dist/features/lock/lib/BaseLockPlugin.js +154 -54
- package/dist/features/media/index.d.ts +1 -1
- package/dist/features/media/lib/BaseMediaPlugin.js +117 -4
- package/dist/features/media/lib/image/BaseImagePlugin.js +46 -10
- package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +26 -8
- package/dist/features/media/lib/mediaHtml.internal.js +2 -2
- package/dist/features/mention/index.d.ts +4 -11
- package/dist/features/mention/lib/BaseMentionPlugin.js +12 -16
- package/dist/features/table/index.d.ts +2 -2
- package/dist/features/table/lib/BaseTablePlugin.js +711 -410
- package/dist/features/table/lib/internal/authoredProjection.js +172 -0
- package/dist/features/table/lib/internal/axisMove.js +152 -0
- package/dist/features/table/lib/internal/docxBorders.js +39 -0
- package/dist/features/table/lib/internal/grid.js +34 -1
- package/dist/features/table/lib/internal/mutation.js +18 -121
- package/dist/features/table/lib/internal/selection.js +114 -3
- package/dist/features/table/lib/internal/tabularText.js +2 -1
- package/dist/features/table/lib/internal/widths.js +118 -0
- package/dist/features/toc/index.d.ts +1 -1
- package/dist/features/toc/lib/BaseTocPlugin.js +42 -2
- package/dist/features/upload/index.d.ts +2 -2
- package/dist/features/upload/index.js +3 -2
- package/dist/features/upload/lib/BaseUploadPlugin.js +258 -295
- package/dist/features/upload/lib/uploadRules.internal.js +259 -0
- package/dist/history/index.d.ts +2 -3
- package/dist/html/index.d.ts +4 -3
- package/dist/html/server/index.d.ts +6 -2
- package/dist/html/server/index.js +5 -2
- package/dist/{index-CfK4uv4I.d.ts → htmlConversion-DkPBUAhF.d.ts} +6 -3
- package/dist/{htmlTypes-zTLU3aTb.d.ts → htmlTypes-BtbQ2kEr.d.ts} +16 -2
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/{index-CX_JaDRY.d.ts → index-1OVDeYPV.d.ts} +3 -3
- package/dist/{index-BSBkt2bm.d.ts → index-B32tPEDz.d.ts} +112 -39
- package/dist/index-BG8rVWFU.d.ts +21 -0
- package/dist/{index-BCYBYfGM.d.ts → index-BTr77Bx4.d.ts} +65 -79
- package/dist/{index-yZDmK6ab.d.ts → index-Bjidr3Bh.d.ts} +89 -38
- package/dist/index-BrH9LjUL.d.ts +1 -0
- package/dist/index-C5UBSjnN.d.ts +3 -0
- package/dist/{index-CD_Ym9WQ.d.ts → index-C9NdczaJ.d.ts} +9 -12
- package/dist/{index-DoZhM7nD.d.ts → index-CQIZktRx.d.ts} +144 -55
- package/dist/{index-u_h6ow4e.d.ts → index-CXykQDCy.d.ts} +172 -115
- package/dist/{index-DM-b6jEe-BqkdOlav.d.ts → index-CkM6HC0j-Dl58Hah-.d.ts} +1 -1
- package/dist/{index-CfRUKYCM.d.ts → index-CpPTPirx.d.ts} +2 -2
- package/dist/index-DFTcRJUh.d.ts +97 -0
- package/dist/index-DUPlSPvg.d.ts +81 -0
- package/dist/{index-DuElD_q6.d.ts → index-DayqETUb.d.ts} +243 -241
- package/dist/{index-BPOa4Z5n.d.ts → index-DlfamnX-.d.ts} +120 -228
- package/dist/{index-D11C0iLb.d.ts → index-DlmWL_1-.d.ts} +29 -10
- package/dist/index-Dqd1rrEG-BSmp1a8x.d.ts +316 -0
- package/dist/{index-4PpawhYe-yelJvgk1.d.ts → index-Du3tBg6V-CtvB7eak.d.ts} +3 -3
- package/dist/{index-BisOdLXI.d.ts → index-MQmrgI2L.d.ts} +10 -5
- package/dist/{index-3CExu_fj.d.ts → index-SKTw56CW.d.ts} +9 -9
- package/dist/{index-DsNwo8dd.d.ts → index-drvpTZ3S.d.ts} +713 -1523
- package/dist/index-vP4xFieu.d.ts +184 -0
- package/dist/index-zK527a0f.d.ts +57 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -11
- package/dist/internal/comments/comment-anchor.internal.js +636 -0
- package/dist/internal/plugin/OverridePlugin.js +139 -56
- package/dist/internal/plugin/collectPlateNodeMappings.js +7 -4
- package/dist/internal/plugin/compilePlainTextMappings.js +67 -16
- package/dist/internal/plugin/compilePlateModel.js +56 -17
- package/dist/internal/plugin/compilePlateShortcuts.js +2 -1
- package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
- package/dist/internal/plugin/createPlateModelPublication.js +261 -0
- package/dist/internal/plugin/createPlateRuntimePlugins.js +263 -0
- package/dist/internal/plugin/getPlateDecorationSources.js +2 -1
- package/dist/internal/plugin/indentShift.js +44 -0
- package/dist/internal/plugin/markdownParagraph.js +23 -1
- package/dist/internal/plugin/plateRuntime.js +2 -2
- package/dist/internal/plugin/pluginDescriptorSnapshot.js +178 -0
- package/dist/internal/plugin/pluginFormatOperation.js +8 -3
- package/dist/internal/plugin/pluginStore.js +4 -7
- package/dist/internal/plugin/resolvePlugin.js +32 -17
- package/dist/internal/plugin/resolvePluginGraph.js +354 -0
- package/dist/internal/plugin/resolvePlugins.js +19 -1137
- package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
- package/dist/internal/plugin/uploadDrafts.js +6 -1
- package/dist/internal/utils/mergePlugins.js +6 -5
- package/dist/internal/utils/trustedContentSlice.js +1 -1
- package/dist/internal/utils/urlPolicy.js +19 -1
- package/dist/lib/editor/editorUser.internal.js +13 -5
- package/dist/lib/editor/withPlite.js +55 -44
- package/dist/lib/libs/zustand.js +31 -7
- package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
- package/dist/lib/plugin/createPluginContext.internal.js +6 -24
- 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 +9 -8
- package/dist/lib/plugins/debug/DebugPlugin.js +1 -4
- package/dist/lib/plugins/dom/DOMPlugin.js +20 -7
- 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 +30 -1766
- package/dist/lib/plugins/html/htmlAst.js +5 -2
- package/dist/lib/plugins/html/htmlConversion.js +4 -0
- package/dist/lib/plugins/html/htmlDecode.internal.js +891 -0
- package/dist/lib/plugins/html/htmlMatcher.internal.js +24 -1
- package/dist/lib/plugins/html/htmlRules.internal.js +490 -0
- package/dist/lib/plugins/html/htmlSerialize.internal.js +462 -0
- package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
- package/dist/lib/plugins/input-rules/InputRulesPlugin.js +114 -30
- package/dist/lib/plugins/input-rules/createInputRules.js +64 -68
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +111 -9
- 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/pluginNodeClass.js +1 -5
- package/dist/markdown/index.d.ts +2 -2
- package/dist/markdown/lib/MarkdownPlugin.js +38 -45
- package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +3 -3
- package/dist/markdown/lib/deserializer/mdastToSlate.js +2 -4
- package/dist/markdown/lib/internal/markdownBareLinks.js +265 -0
- package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
- package/dist/markdown/lib/internal/markdownDiagnostics.js +2 -2
- package/dist/markdown/lib/internal/markdownDocument.js +13 -32
- package/dist/markdown/lib/internal/markdownIntrinsics.js +38 -163
- package/dist/markdown/lib/internal/markdownLine.js +133 -115
- package/dist/markdown/lib/internal/markdownMappings.js +173 -101
- package/dist/markdown/lib/internal/markdownParse.js +601 -0
- package/dist/markdown/lib/internal/markdownReferences.js +9 -3
- package/dist/markdown/lib/internal/markdownRuntime.js +353 -0
- package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
- package/dist/markdown/lib/internal/markdownStream.js +1239 -0
- package/dist/markdown/lib/internal/markdownTags.js +50 -37
- package/dist/markdown/lib/internal/markdownTailHeal.js +813 -0
- package/dist/markdown/lib/serializer/convertNodesSerialize.js +14 -3
- package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +134 -44
- package/dist/markdown/lib/serializer/listToMdastTree.js +23 -4
- package/dist/markdown/lib/serializer/reportOmittedProperties.js +1 -0
- package/dist/markdown/lib/utils/remarkPlugins.js +44 -23
- package/dist/math/index.d.ts +11 -11
- package/dist/math/lib/BaseEquationPlugin.js +99 -20
- package/dist/math/react/index.d.ts +4 -4
- package/dist/migrations/documentMigrationAuthored.internal.js +2 -1
- package/dist/migrations/documentMigrationSelection.internal.js +43 -12
- package/dist/migrations/documentMigrationTarget.internal.js +10 -2
- package/dist/migrations/documentMigrations.js +98 -30
- package/dist/migrations/index.d.ts +30 -44
- package/dist/migrations/index.js +1 -2
- package/dist/migrations/migratePlateV54.js +11 -7
- package/dist/migrations/migratePlateV54Ast.internal.js +43 -70
- package/dist/migrations/migratePlateV54BuiltIns.internal.js +2 -2
- package/dist/migrations/migratePlateV54CodeBlocks.internal.js +45 -6
- package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
- package/dist/migrations/migratePlateV54RetiredMarks.internal.js +2 -2
- package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
- package/dist/migrations/migratePlateV54Urls.internal.js +11 -2
- package/dist/pagination/index.d.ts +2 -167
- package/dist/pagination/index.js +2 -2
- package/dist/pagination/react/PaginationPlugin.js +278 -0
- package/dist/pagination/react/index.d.ts +94 -34
- package/dist/pagination/react/index.js +3 -5
- package/dist/plain-text.js +9 -12
- package/dist/react/authored/AuthoredReactPlugin.js +126 -0
- package/dist/react/authored/index.d.ts +34 -0
- package/dist/react/authored/index.js +3 -0
- package/dist/react/authored/useAuthored.js +82 -0
- package/dist/react/components/EditorContentView.internal.js +64 -45
- package/dist/react/components/EditorProvider.js +25 -24
- package/dist/react/components/EditorRefEffect.internal.js +56 -0
- package/dist/react/components/EditorRefEffect.js +12 -56
- package/dist/react/components/NodeSelection.js +435 -493
- package/dist/react/components/Plate.js +84 -83
- package/dist/react/components/PlateContainer.js +96 -43
- package/dist/react/components/PlateView.js +1 -1
- package/dist/react/components/plate-nodes.js +1 -2
- package/dist/react/components/writeStaticSelectionClipboardData.internal.js +1 -1
- package/dist/react/core.js +7 -11
- package/dist/react/editor/useCreateEditor.js +19 -17
- package/dist/react/editor/withPlate.js +10 -13
- package/dist/react/features/basic-styles/BasicStylePlugins.js +2 -3
- package/dist/react/features/board/BoardPlugin.js +1 -1
- package/dist/react/features/board/BoardShape.js +9 -10
- package/dist/react/features/board/BoardSurface.js +1 -1
- package/dist/react/features/board/boardCamera.internal.js +295 -0
- package/dist/react/features/board/boardClipboard.internal.js +20 -20
- package/dist/react/features/board/boardConnect.internal.js +2 -1
- package/dist/react/features/board/boardExport.internal.js +5 -4
- package/dist/react/features/board/boardGesture.internal.js +44 -38
- package/dist/react/features/board/boardIndex.internal.js +1 -1
- package/dist/react/features/board/boardKeys.internal.js +42 -46
- package/dist/react/features/board/boardLanding.internal.js +147 -0
- package/dist/react/features/board/boardPick.internal.js +2 -2
- package/dist/react/features/board/boardPreview.internal.js +16 -2
- package/dist/react/features/board/boardResize.internal.js +5 -15
- 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 +310 -915
- package/dist/react/features/board/boardVoice.internal.js +4 -5
- package/dist/react/features/board/boardWindow.internal.js +138 -0
- package/dist/react/features/board/index.d.ts +92 -86
- package/dist/react/features/callout/index.d.ts +3 -3
- package/dist/react/features/{layout → column}/ColumnPlugin.js +4 -3
- package/dist/react/features/{layout → column}/index.d.ts +61 -44
- package/dist/react/features/combobox/combobox.internal.js +106 -0
- package/dist/react/features/combobox/comboboxOwner.internal.js +19 -23
- package/dist/react/features/combobox/index.d.ts +47 -16
- package/dist/react/features/combobox/useCombobox.js +50 -13
- package/dist/react/features/comments/CommentsPlugin.js +3 -3
- package/dist/react/features/comments/index.d.ts +142 -75
- package/dist/react/features/comments/index.js +2 -1
- package/dist/react/features/comments/useCommentThreadIndex.js +288 -0
- package/dist/react/features/date/index.d.ts +4 -4
- package/dist/react/features/details/index.d.ts +4 -4
- package/dist/react/features/field/index.d.ts +5 -5
- package/dist/react/features/footnote/FootnotePlugin.js +13 -8
- package/dist/react/features/footnote/index.d.ts +952 -105
- package/dist/react/features/format-painter/index.d.ts +6 -6
- package/dist/react/features/ink/index.d.ts +33 -13
- package/dist/react/features/ink/inkCapture.internal.js +10 -4
- package/dist/react/features/list/ListPlugin.js +68 -36
- package/dist/react/features/lock/LockPlugin.js +57 -18
- package/dist/react/features/lock/index.d.ts +8 -8
- package/dist/react/features/media/index.d.ts +10 -10
- package/dist/react/features/mention/index.d.ts +4 -11
- package/dist/react/features/table/TablePlugin.js +215 -61
- package/dist/react/features/table/index.d.ts +158 -59
- package/dist/react/features/table/index.js +2 -1
- package/dist/react/features/table/measureTableColumnWidths.internal.js +44 -0
- package/dist/react/features/table/useTableControls.js +897 -0
- package/dist/react/features/table/useTableResize.js +33 -16
- package/dist/react/features/toc/index.d.ts +8 -11
- package/dist/react/features/upload/UploadPlugin.js +12 -3
- package/dist/react/features/upload/index.d.ts +36 -97
- package/dist/react/index.d.ts +7 -5
- package/dist/react/index.js +11 -15
- package/dist/react/internal/plate-context.js +118 -68
- package/dist/react/internal/useDeepCompareMemo.js +36 -7
- package/dist/react/internal/usePlateModelRevision.js +12 -7
- package/dist/react/plite-react.js +2 -2
- package/dist/react/plugin/pluginFactory.internal.js +1 -37
- package/dist/react/plugin/toReactPlugin.js +15 -4
- package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +2 -2
- 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 +96 -86
- 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 +62 -89
- package/dist/react/stores/plate/useEditorSelector.js +17 -204
- package/dist/react/stores/plate/usePluginStore.js +36 -43
- package/dist/react/stores/plate/useViewStore.js +38 -23
- package/dist/react/utils/BlockPlaceholderPlugin.js +13 -4
- package/dist/react/utils/pipeHandler.internal.js +20 -7
- package/dist/react/utils/pipeRenderLeaf.internal.js +1 -2
- package/dist/react/utils/pipeRenderText.internal.js +1 -1
- package/dist/react/utils/useSelectionFragment.js +8 -2
- package/dist/react/virtualized.d.ts +6 -5
- package/dist/refusal-CBecclcb-BJGVrNlz.d.ts +1 -0
- package/dist/registerEditorTools-dPLJZ0PP.d.ts +386 -0
- package/dist/root.js +7 -11
- package/dist/skills/plate/SKILL.md +43 -0
- package/dist/{source-B1rLozUs.d.ts → source-BnYE-ryK.d.ts} +14 -14
- package/dist/static/components/{PlateStatic.js → EditorStatic.js} +86 -31
- package/dist/static/components/plite-nodes.js +31 -11
- package/dist/static/index.d.ts +21 -15
- package/dist/static/index.js +1 -1
- package/dist/static/internal/loadStaticRenderer.js +4 -0
- package/dist/static/internal/staticDocumentView.js +8 -5
- package/dist/static/internal/staticPendingMedia.internal.js +136 -0
- package/dist/static/internal/staticPresentation.js +12 -12
- package/dist/static/pipeRenderElementStatic.internal.js +2 -10
- package/dist/static/pluginRenderElementStatic.internal.js +28 -5
- package/dist/static/pluginRenderLeafStatic.internal.js +3 -1
- package/dist/static/pluginRenderTextStatic.internal.js +3 -1
- package/dist/static/renderStaticHtml.js +31 -2
- package/dist/static/utils/getRenderNodeStaticProps.internal.js +8 -3
- package/dist/sync/SyncPlugin.js +16 -0
- package/dist/sync/cloudflare/index.d.ts +56 -0
- package/dist/sync/cloudflare/index.js +2 -0
- package/dist/sync/index.d.ts +3 -0
- package/dist/sync/index.js +3 -0
- package/dist/sync/react/SyncReactPlugin.js +20 -0
- package/dist/sync/react/hooks.js +64 -0
- package/dist/{yjs → sync}/react/index.d.ts +74 -68
- package/dist/sync/react/index.js +4 -0
- package/dist/sync/server/index.d.ts +3 -0
- package/dist/sync/server/index.js +2 -0
- package/dist/tabbable/index.d.ts +1 -1
- package/dist/tabbable/react/TabbableEffects.internal.js +5 -5
- package/dist/tabbable/react/index.d.ts +3 -3
- package/dist/testing/index.d.ts +7 -6
- package/dist/transport-CRrArpJZ-Bm6uVAsa.d.ts +115 -0
- package/dist/{tx-only-D8lpB-sT-ZiAbZRMU.d.ts → tx-only-DXWFNuXJ-DuOaZk8U.d.ts} +2761 -2694
- package/dist/utils/plate-keys.js +2 -8
- package/dist/utils/plugins/TrailingBlockPlugin.js +10 -7
- package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
- package/package.json +47 -114
- package/dist/AIChatRequestContext-PbXTTovP.d.ts +0 -36
- package/dist/BaseSuggestionPlugin-Dg-cdX26.d.ts +0 -97
- package/dist/PlateStatic-CggiBCuD.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 -1639
- package/dist/ai/react/useAIChat.js +0 -332
- package/dist/combobox-CUUSZR07.d.ts +0 -22
- package/dist/docs/yjs.md +0 -256
- package/dist/docx/export/lib/comments.js +0 -311
- package/dist/docx/export/lib/docxStaticComponents.js +0 -381
- package/dist/docx/export/lib/exportHtmlToDocx.internal.js +0 -70
- package/dist/docx/export/lib/generatedParts.js +0 -51
- package/dist/docx/export/lib/hostIndex.js +0 -92
- 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 -1803
- package/dist/docx/export/lib/reviewPart.js +0 -234
- package/dist/docx/import/lib/wordFormatting.js +0 -608
- 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 -19
- package/dist/features/layout/index.d.ts +0 -2
- package/dist/features/layout/lib/BaseColumnPlugin.js +0 -272
- package/dist/features/suggestion/BaseSuggestionPlugin.js +0 -31
- package/dist/features/suggestion/index.d.ts +0 -10
- package/dist/features/suggestion/index.js +0 -3
- package/dist/features/upload/lib/mimeTypes.internal.js +0 -3982
- package/dist/index-0YxPsHwd.d.ts +0 -1
- package/dist/index-BODDOPEd.d.ts +0 -8
- package/dist/index-Bt5YI_JN.d.ts +0 -29
- package/dist/index-Cil7kghY.d.ts +0 -161
- package/dist/index-DJW6AjJ6.d.ts +0 -184
- package/dist/index-f3aV3Kt-.d.ts +0 -156
- package/dist/lib/plugins/element-state/ElementStatePlugin.js +0 -14
- package/dist/lib/utils/hotkeys.js +0 -113
- package/dist/markdown/lib/internal/markdownConversion.js +0 -1326
- package/dist/markdown/lib/internal/markdownOpenTail.js +0 -381
- package/dist/markdown/lib/internal/markdownSegments.js +0 -143
- package/dist/migrations/migrateListIdentity.js +0 -93
- package/dist/pagination/react/PagedEditorContent.js +0 -77
- package/dist/react/features/suggestion/SuggestionPlugin.js +0 -24
- package/dist/react/features/suggestion/index.d.ts +0 -45
- package/dist/react/features/suggestion/index.js +0 -3
- package/dist/react/features/suggestion/suggestion-view.internal.js +0 -114
- package/dist/react/features/suggestion/useSuggestion.js +0 -138
- package/dist/static/internal/renderStaticHtmlWithOverrides.js +0 -33
- 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.js +0 -3
- /package/dist/features/{layout → column}/index.js +0 -0
- /package/dist/react/features/{layout → column}/index.js +0 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
import { $a as Plugin, Al as TransferPlugin, Cl as TransferIntent, El as TransferOutcome, Ga as Path, Kc as StateFieldValueInput, Ma as NodeTarget, O as DecorationAttributes, Sl as TransferInput, Wl as Value, Xc as Text, Xi as NamedRootKey, _i as Element$1, _t as EditorDocumentValue, d as AnyEditor, ha as NodeKey, ho as PluginDependencyReferenceFor, ki as HistoryOutcome, ms as RootKey, ni as EditorUpdatePolicy, po as PluginDependencyContractReference, tr as EditorSelectorDependencies, ts as Range, vl as TransferApi, yl as TransferCheck } from "./tx-only-DXWFNuXJ-DuOaZk8U.js";
|
|
2
|
+
import "./htmlTypes-BtbQ2kEr.js";
|
|
3
|
+
import { N as DataTransferDiagnostic, S as DOMEditor, V as ViewportRect, c as DOMApi, d as DOMCoverageCopyPolicy, f as DOMCoverageMaterializeRangeRole, h as DOMCoverageSelectionPolicy, l as DOMClipboardApi, m as DOMCoverageReason, n as DOMPluginTypes, p as DOMCoverageMaterializeReason, r as DropIndicator, t as DOMPlugin, u as DOMCoverageBoundary } from "./index-DlfamnX-.js";
|
|
4
|
+
import { s as Editor$2 } from "./core-N8rIvQxS.js";
|
|
5
|
+
import React$1, { CSSProperties, KeyboardEvent as KeyboardEvent$1, MouseEventHandler, ReactNode, Ref, RefObject, TextareaHTMLAttributes } from "react";
|
|
6
|
+
import "lodash";
|
|
7
|
+
type DecorationSlice = Readonly<{
|
|
8
|
+
attributes: DecorationAttributes;
|
|
9
|
+
end: number;
|
|
10
|
+
key: string;
|
|
11
|
+
start: number;
|
|
12
|
+
}>;
|
|
13
|
+
/** The boxes of one range in viewport coordinates. */
|
|
14
|
+
type RangeRects = Readonly<{
|
|
15
|
+
boundingRect: ViewportRect;
|
|
16
|
+
focusRect: ViewportRect | null;
|
|
17
|
+
rects: readonly ViewportRect[];
|
|
18
|
+
}>;
|
|
19
|
+
/** Immutable DOM geometry for one range in one mounted Editable. */
|
|
20
|
+
type RangeGeometry = RangeRects & Readonly<{
|
|
21
|
+
/**
|
|
22
|
+
* The part of the Editable anyone can see: the viewport cut by every box
|
|
23
|
+
* that clips the Editable, its own box included when its overflow clips.
|
|
24
|
+
* Every range of one Editable shares it in a frame. `null` when none shows.
|
|
25
|
+
*/
|
|
26
|
+
clipRect: ViewportRect | null;
|
|
27
|
+
/**
|
|
28
|
+
* The range's boxes cut to `clipRect`, each line outside it dropped. A
|
|
29
|
+
* line that only touches the edge is outside; a caret on the edge is
|
|
30
|
+
* inside. `null` when nothing of the range is inside. Show or hide by it,
|
|
31
|
+
* and draw inside `clipRect`.
|
|
32
|
+
*/
|
|
33
|
+
visible: RangeRects | null;
|
|
34
|
+
}>;
|
|
35
|
+
type Editor$1<V extends Value = any> = AnyEditor<V>;
|
|
36
|
+
type InputIntent = 'clipboard' | 'composition' | 'delete' | 'history' | 'insert-break' | 'internal-control' | 'model-selection-move' | 'native-selection-move' | 'viewport-selection' | 'text-insert';
|
|
37
|
+
type SelectionSource = 'app-owned' | 'composition-owned' | 'dom-current' | 'internal-control' | 'model-owned' | 'viewport-backed' | 'unknown';
|
|
38
|
+
type EditableSelectionSourceTransition = {
|
|
39
|
+
preferModelSelection: boolean;
|
|
40
|
+
reason: 'internal-control' | 'model-command' | 'native-selection-move' | 'decoration-refresh' | 'repair-induced' | 'unknown-selection';
|
|
41
|
+
selectionSource: SelectionSource;
|
|
42
|
+
};
|
|
43
|
+
/** Text a mounted Editable committed with typing intent. */
|
|
44
|
+
type TypedText = Readonly<{
|
|
45
|
+
/** The Editable root element whose input produced the text. */
|
|
46
|
+
editable: HTMLElement;
|
|
47
|
+
/** The inserted text in the model, ending at the caret. */
|
|
48
|
+
range: Range;
|
|
49
|
+
text: string;
|
|
50
|
+
}>;
|
|
51
|
+
/** Listener called when a mounted Editable commits typed text. */
|
|
52
|
+
type TypedTextListener = (typed: TypedText) => void;
|
|
53
|
+
/** Options for installing React over one exact DOM plugin descriptor. */
|
|
54
|
+
interface ReactPluginOptions<TDOMPlugin extends DOMPlugin = DOMPlugin> {
|
|
55
|
+
/** DOM plugin owned by this React bridge. */
|
|
56
|
+
dom: TDOMPlugin;
|
|
57
|
+
}
|
|
58
|
+
/** React capability exposed through `editor.api.react`. */
|
|
59
|
+
type ReactApi = {
|
|
60
|
+
isComposing: () => boolean;
|
|
61
|
+
isFocused: () => boolean;
|
|
62
|
+
isReadOnly: () => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Commit pending native input to the model, including an active Android
|
|
65
|
+
* keyboard draft. Returns false while a non-Android composition is active or
|
|
66
|
+
* when the mounted Editable unmounts during the flush.
|
|
67
|
+
*/
|
|
68
|
+
settleInput: () => boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Call `listener` with the text each mounted Editable of this editor types:
|
|
71
|
+
* an `insertText` input or composition commit whose one change is an
|
|
72
|
+
* insertion ending at a collapsed caret. Paste, drop, yank, replacement and
|
|
73
|
+
* data-transfer input, history replay, remote edits and typing over a
|
|
74
|
+
* selection report nothing, and so does a commit whose document an earlier
|
|
75
|
+
* commit listener changes before the report. Android keyboards that paste through
|
|
76
|
+
* `insertText` report the pasted text. Returns the unsubscribe function.
|
|
77
|
+
*/
|
|
78
|
+
subscribeTypedText: (listener: TypedTextListener) => () => void;
|
|
79
|
+
};
|
|
80
|
+
declare const createReactPlugin: <const TDOMPlugin extends DOMPlugin>(domPlugin: TDOMPlugin) => Plugin<Readonly<{
|
|
81
|
+
readonly api: ReactApi;
|
|
82
|
+
readonly dependencies: readonly [PluginDependencyReferenceFor<TDOMPlugin>, PluginDependencyContractReference<Readonly<{
|
|
83
|
+
direct: Readonly<Pick<Readonly<{
|
|
84
|
+
readonly name: "transfer";
|
|
85
|
+
readonly read: Readonly<{
|
|
86
|
+
check: (input: TransferInput, options?: Readonly<{
|
|
87
|
+
intent?: TransferIntent;
|
|
88
|
+
}>) => TransferCheck;
|
|
89
|
+
nodes: (options?: Readonly<{
|
|
90
|
+
node?: NodeTarget<Element$1>;
|
|
91
|
+
}>) => readonly NodeKey[];
|
|
92
|
+
}>;
|
|
93
|
+
readonly api: Readonly<{
|
|
94
|
+
copy: (input: TransferInput) => TransferOutcome;
|
|
95
|
+
move: (input: TransferInput) => TransferOutcome;
|
|
96
|
+
}>;
|
|
97
|
+
}>, "api" | "name" | "read">> & Readonly<Record<never, never>>;
|
|
98
|
+
installed: Readonly<Pick<Readonly<{
|
|
99
|
+
readonly name: "transfer";
|
|
100
|
+
readonly read: Readonly<{
|
|
101
|
+
check: (input: TransferInput, options?: Readonly<{
|
|
102
|
+
intent?: TransferIntent;
|
|
103
|
+
}>) => TransferCheck;
|
|
104
|
+
nodes: (options?: Readonly<{
|
|
105
|
+
node?: NodeTarget<Element$1>;
|
|
106
|
+
}>) => readonly NodeKey[];
|
|
107
|
+
}>;
|
|
108
|
+
readonly api: Readonly<{
|
|
109
|
+
copy: (input: TransferInput) => TransferOutcome;
|
|
110
|
+
move: (input: TransferInput) => TransferOutcome;
|
|
111
|
+
}>;
|
|
112
|
+
}>, "api" | "name" | "read">> & Readonly<Record<never, never>>;
|
|
113
|
+
}>>];
|
|
114
|
+
}> & Readonly<{
|
|
115
|
+
name: "react";
|
|
116
|
+
}>>;
|
|
117
|
+
/** React plugin backed by one exact DOM dependency. */
|
|
118
|
+
type ReactPlugin<TDOMPlugin extends DOMPlugin = DOMPlugin> = ReturnType<typeof createReactPlugin<TDOMPlugin>>;
|
|
119
|
+
/**
|
|
120
|
+
* Installs the DOM bridge and exposes React focus, read-only, and composition
|
|
121
|
+
* APIs through the editor plugin system.
|
|
122
|
+
*/
|
|
123
|
+
declare const react: <const TDOMPlugin extends DOMPlugin>({ dom: domPlugin }: ReactPluginOptions<TDOMPlugin>) => ReactPlugin<TDOMPlugin>;
|
|
124
|
+
type ReactDefaultPlugins<TPlugins extends readonly unknown[]> = readonly [...TPlugins, DOMPlugin, TransferPlugin, ReactPlugin];
|
|
125
|
+
type EditorBase<V extends Value, TPlugins extends readonly unknown[]> = AnyEditor<V, ReactDefaultPlugins<TPlugins>>;
|
|
126
|
+
/** AnyEditor type with the React and DOM plugins installed. */
|
|
127
|
+
type Editor<V extends Value = Value, TPlugins extends readonly unknown[] = readonly []> = Omit<EditorBase<V, TPlugins>, 'api'> & {
|
|
128
|
+
readonly api: EditorBase<V, TPlugins>['api'] & DOMPluginTypes['api'] & {
|
|
129
|
+
react: ReactApi;
|
|
130
|
+
transfer: TransferApi;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* A React and DOM-specific version of the `Editor` interface.
|
|
135
|
+
*/
|
|
136
|
+
interface ReactRuntimeEditor<V extends Value = Value, TPlugins extends readonly unknown[] = any> extends DOMEditor<V, TPlugins> {
|
|
137
|
+
api: DOMEditor<V, TPlugins>['api'] & {
|
|
138
|
+
dom: DOMApi & {
|
|
139
|
+
clipboard: DOMClipboardApi;
|
|
140
|
+
};
|
|
141
|
+
react: ReactApi;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
type EditableRepairRequest = {
|
|
145
|
+
focus?: boolean;
|
|
146
|
+
forceRender?: boolean;
|
|
147
|
+
kind: 'force-render';
|
|
148
|
+
selectionSourceTransition?: EditableSelectionSourceTransition;
|
|
149
|
+
} | {
|
|
150
|
+
focus?: boolean;
|
|
151
|
+
forceRender?: boolean;
|
|
152
|
+
kind: 'sync-selection';
|
|
153
|
+
selectionSourceTransition?: EditableSelectionSourceTransition;
|
|
154
|
+
syncDOMSelection?: boolean;
|
|
155
|
+
} | {
|
|
156
|
+
focus?: boolean;
|
|
157
|
+
forceRender?: boolean;
|
|
158
|
+
kind: 'repair-caret' | 'repair-caret-after-text-insert';
|
|
159
|
+
selectionSourceTransition?: EditableSelectionSourceTransition;
|
|
160
|
+
} | {
|
|
161
|
+
kind: 'none' | 'skip-dom-sync';
|
|
162
|
+
};
|
|
163
|
+
/** An exact replacement in the observed text's UTF-16 before coordinates. */
|
|
164
|
+
type ExternalTextChange = Readonly<{
|
|
165
|
+
from: number;
|
|
166
|
+
insert: string;
|
|
167
|
+
to: number;
|
|
168
|
+
}>;
|
|
169
|
+
/** Directed UTF-16 offsets within one canonical Text. */
|
|
170
|
+
type ExternalTextSelection = Readonly<{
|
|
171
|
+
anchor: number;
|
|
172
|
+
focus: number;
|
|
173
|
+
}>;
|
|
174
|
+
/** Only the focused view may install a native selection. */
|
|
175
|
+
type ExternalTextSelectionState = ExternalTextSelection & Readonly<{
|
|
176
|
+
mode: 'model' | 'native';
|
|
177
|
+
}>;
|
|
178
|
+
/** A keyed editor decoration clipped to this Text's offsets. */
|
|
179
|
+
type ExternalTextDecoration = DecorationSlice;
|
|
180
|
+
/** Canonical state delivered to one mounted external text view. */
|
|
181
|
+
type ExternalTextState<TConfig = undefined> = Readonly<{
|
|
182
|
+
config: TConfig;
|
|
183
|
+
decorations: readonly ExternalTextDecoration[];
|
|
184
|
+
readOnly: boolean;
|
|
185
|
+
selection: ExternalTextSelectionState | null;
|
|
186
|
+
/** The canonical string reference; retain it without diffing whole strings. */
|
|
187
|
+
text: string;
|
|
188
|
+
/** Echo this observed version in actions; unrelated commits need no update. */
|
|
189
|
+
version: number;
|
|
190
|
+
}>;
|
|
191
|
+
/** The only mutation bridge from an external view to its owning editor runtime.
|
|
192
|
+
* Invoke actions from input and command handlers, never from adapter lifecycle
|
|
193
|
+
* callbacks or `offsetAt`. When the runtime rejects a mutating action, a stale
|
|
194
|
+
* action, or a read-only `composition('start')` outside those non-reentrant
|
|
195
|
+
* callbacks, it synchronously delivers a canonical reset
|
|
196
|
+
* (`update({ changes: null, state })`) before returning.
|
|
197
|
+
*/
|
|
198
|
+
type ExternalTextActions = Readonly<{
|
|
199
|
+
composition: (phase: 'end' | 'start') => void;
|
|
200
|
+
deleteOut: (input: {
|
|
201
|
+
baseVersion: number;
|
|
202
|
+
direction: 'backward' | 'forward';
|
|
203
|
+
}) => void;
|
|
204
|
+
dispatch: (input: {
|
|
205
|
+
baseVersion: number;
|
|
206
|
+
changes: readonly ExternalTextChange[];
|
|
207
|
+
intent: 'composition' | 'cut' | 'drop' | 'input' | 'paste';
|
|
208
|
+
selection: ExternalTextSelection;
|
|
209
|
+
}) => void;
|
|
210
|
+
/** Delegate to installed editor history; adapters must disable local history. */
|
|
211
|
+
history: (direction: 'redo' | 'undo') => boolean;
|
|
212
|
+
navigateOut: (input: {
|
|
213
|
+
baseVersion: number;
|
|
214
|
+
direction: 'backward' | 'forward';
|
|
215
|
+
extend?: boolean;
|
|
216
|
+
/** The caret's goal client x for an ArrowUp or ArrowDown exit; omit it for other keys. */
|
|
217
|
+
x?: number;
|
|
218
|
+
}) => void;
|
|
219
|
+
select: (input: {
|
|
220
|
+
baseVersion: number;
|
|
221
|
+
selection: ExternalTextSelection;
|
|
222
|
+
}) => void;
|
|
223
|
+
/**
|
|
224
|
+
* Offer a keydown the view declined to the EditorContent's `onKeyDown`. Pass
|
|
225
|
+
* the DOM event from its own listener, after every local handler passed on
|
|
226
|
+
* it. The editor drops the key when something prevents its default or stops
|
|
227
|
+
* its propagation before the editor root, and refuses keys a text input
|
|
228
|
+
* uses natively, such as composing and modifier keys, typing, Enter without
|
|
229
|
+
* Ctrl or Meta, Tab, navigation keys, deletion, select-all, clipboard, undo
|
|
230
|
+
* and redo keys, and on Apple hosts Control with a letter, the quote key or
|
|
231
|
+
* Enter. It also refuses every key while the editor or the element is
|
|
232
|
+
* read-only, during an authored preview, or while any part of the selection
|
|
233
|
+
* is outside this view's Text. When the view held focus as the key arrived,
|
|
234
|
+
* focus follows the selection once React commits the handler's change. It
|
|
235
|
+
* stays put when the handler unmounted the EditorContent, when the handler
|
|
236
|
+
* moved focus out of the view or blurred it before returning while the view
|
|
237
|
+
* stayed mounted, or when focus sits outside the view, other than on the
|
|
238
|
+
* page body, once React has committed. When the view did not hold focus,
|
|
239
|
+
* focus stays where it was.
|
|
240
|
+
*/
|
|
241
|
+
yieldKey: (event: KeyboardEvent) => void;
|
|
242
|
+
}>;
|
|
243
|
+
/** Adapter-owned DOM and local resources for one mounted host. */
|
|
244
|
+
type ExternalTextView<TConfig = undefined> = Readonly<{
|
|
245
|
+
destroy: () => void;
|
|
246
|
+
/** Install the delivered `state.selection`, then focus the local input. */
|
|
247
|
+
focus: () => void;
|
|
248
|
+
/**
|
|
249
|
+
* The offset nearest client `x` on the view's first (`'start'`) or last
|
|
250
|
+
* (`'end'`) visual line, in the delivered `state.text`; `null` when the view
|
|
251
|
+
* cannot tell. The owning editor asks before a vertical arrow enters the
|
|
252
|
+
* view and writes the selection itself. Read layout only: never dispatch an
|
|
253
|
+
* action, change the view's text or selection, focus, scroll, or run work
|
|
254
|
+
* the view deferred, such as a pending layout pass. Actions called during
|
|
255
|
+
* the query are refused. Omitted, the caret enters at the first or last
|
|
256
|
+
* offset.
|
|
257
|
+
*/
|
|
258
|
+
offsetAt?: (input: {
|
|
259
|
+
edge: 'end' | 'start';
|
|
260
|
+
x: number;
|
|
261
|
+
}) => number | null;
|
|
262
|
+
/**
|
|
263
|
+
* Reveal `selection` inside any view-owned scroll container without scrolling
|
|
264
|
+
* outer document ancestors, and return the revealed range's viewport
|
|
265
|
+
* `DOMRect` (or `null`/`void` to fall back to the host box). The owning
|
|
266
|
+
* editor performs outer scrolling from that rect so outer `scrollMargin` and
|
|
267
|
+
* `scrollMode` stay authoritative.
|
|
268
|
+
*/
|
|
269
|
+
scrollIntoView?: (selection: ExternalTextSelection) => DOMRect | null | void;
|
|
270
|
+
/** Apply patches and canonical state before returning without dispatching an action. */
|
|
271
|
+
update: (input: {
|
|
272
|
+
/** `null` resets from state.text; a list applies exact patches; [] acknowledges. */
|
|
273
|
+
changes: readonly ExternalTextChange[] | null;
|
|
274
|
+
state: ExternalTextState<TConfig>;
|
|
275
|
+
}) => void;
|
|
276
|
+
}>;
|
|
277
|
+
/** Render one exact-one-Text block without a second model or history owner.
|
|
278
|
+
* Lifecycle callbacks are synchronous notifications and must not mutate the
|
|
279
|
+
* owning editor or reenter the mounted view.
|
|
280
|
+
*/
|
|
281
|
+
type ExternalTextAdapter<TConfig = undefined> = Readonly<{
|
|
282
|
+
mount: (context: {
|
|
283
|
+
actions: ExternalTextActions;
|
|
284
|
+
host: HTMLElement;
|
|
285
|
+
state: ExternalTextState<TConfig>;
|
|
286
|
+
}) => ExternalTextView<TConfig>;
|
|
287
|
+
}>;
|
|
288
|
+
/** Mount options inferred from the adapter; changing config does not remount it. */
|
|
289
|
+
type ExternalTextOptions<TConfig = undefined> = Readonly<{
|
|
290
|
+
adapter: ExternalTextAdapter<TConfig>;
|
|
291
|
+
ariaLabel: string;
|
|
292
|
+
/** Wrap native children when the block cannot mount an external view, such as in Suggesting mode, with pending authored changes, with multiple text leaves, or in static rendering. */
|
|
293
|
+
fallback?: (children: ReactNode) => ReactNode;
|
|
294
|
+
}> & (undefined extends TConfig ? Readonly<{
|
|
295
|
+
config?: TConfig;
|
|
296
|
+
}> : Readonly<{
|
|
297
|
+
config: TConfig;
|
|
298
|
+
}>);
|
|
299
|
+
type EditorHistoryFocusPolicy$1 = 'none' | 'preserve' | 'restore-root';
|
|
300
|
+
type NodeSelectionFocus = RefObject<HTMLElement | null>;
|
|
301
|
+
type EditableHistoryReplayResult = HistoryOutcome | Readonly<{
|
|
302
|
+
reason: 'composing' | 'not-installed' | 'unmounted';
|
|
303
|
+
status: 'unavailable';
|
|
304
|
+
}> | Readonly<{
|
|
305
|
+
/** No shown `Editable` of the presentation can edit `root`. */
|
|
306
|
+
reason: 'hidden' | 'read-only';
|
|
307
|
+
/** The root the replay would change, `undefined` for the primary document. */
|
|
308
|
+
root: RootKey | undefined;
|
|
309
|
+
status: 'unavailable';
|
|
310
|
+
}>;
|
|
311
|
+
type EditableHistoryReplayEvent = Readonly<{
|
|
312
|
+
direction: 'redo' | 'undo';
|
|
313
|
+
result: EditableHistoryReplayResult;
|
|
314
|
+
}>;
|
|
315
|
+
/** Hears the final range of a mouse selection made in an Editable's own text. */
|
|
316
|
+
type EditablePointerSelectionEndHandler = (selection: Range, context: EditableHandlerContext) => void;
|
|
317
|
+
/** Outcome of one paste that an editable's built-in insertion handled. */
|
|
318
|
+
type EditablePasteResult = Readonly<{
|
|
319
|
+
/**
|
|
320
|
+
* Reports from the format that inserted or claimed the payload, plus loss
|
|
321
|
+
* from payloads that could not be used. `impact: 'lossy'` means pasted
|
|
322
|
+
* content was left out.
|
|
323
|
+
*/
|
|
324
|
+
diagnostics: readonly DataTransferDiagnostic[];
|
|
325
|
+
/** Whether the paste committed content. */
|
|
326
|
+
inserted: boolean;
|
|
327
|
+
}>;
|
|
328
|
+
/** What one drop the Editable settled did. */
|
|
329
|
+
type EditableDropResult = Readonly<{
|
|
330
|
+
kind: 'data';
|
|
331
|
+
/** Format reports for external data inserted on the paste path. */
|
|
332
|
+
diagnostics: readonly DataTransferDiagnostic[];
|
|
333
|
+
inserted: boolean;
|
|
334
|
+
}> | Readonly<{
|
|
335
|
+
kind: 'transfer';
|
|
336
|
+
outcome: TransferOutcome;
|
|
337
|
+
}>;
|
|
338
|
+
type EditableHandlerResult = boolean | EditableRepairRequest | void;
|
|
339
|
+
/**
|
|
340
|
+
* What an editable passes each DOM handler after its event. `editor` is the
|
|
341
|
+
* view whose editable runs the handler, such as a content root's.
|
|
342
|
+
*/
|
|
343
|
+
type EditableHandlerContext = {
|
|
344
|
+
editor: ReactRuntimeEditor;
|
|
345
|
+
};
|
|
346
|
+
type EditableInputEventContext = EditableHandlerContext & {
|
|
347
|
+
data: unknown;
|
|
348
|
+
event?: InputEvent | React$1.KeyboardEvent<HTMLDivElement>;
|
|
349
|
+
inputType?: string;
|
|
350
|
+
intent: InputIntent | null;
|
|
351
|
+
native: boolean;
|
|
352
|
+
selection: Range | null;
|
|
353
|
+
};
|
|
354
|
+
type EditableDOMBeforeInputContext = EditableInputEventContext & {
|
|
355
|
+
event: InputEvent;
|
|
356
|
+
inputType: string;
|
|
357
|
+
};
|
|
358
|
+
type EditableDOMBeforeInputHandler = (event: InputEvent, context: EditableDOMBeforeInputContext) => EditableHandlerResult;
|
|
359
|
+
type EditableKeyDownHandler = (event: React$1.KeyboardEvent<HTMLDivElement>, context: EditableHandlerContext) => EditableHandlerResult;
|
|
360
|
+
/**
|
|
361
|
+
* Expose the browser test handle that `@platejs/test` reads on every
|
|
362
|
+
* `Editable` root mounted afterwards, and keep the kernel trace it reads.
|
|
363
|
+
*
|
|
364
|
+
* Call once at module scope in a test or development entry, before the first
|
|
365
|
+
* editor mounts. Production entries never call it, so their bundles drop the
|
|
366
|
+
* handle. Calling it again changes nothing.
|
|
367
|
+
*/
|
|
368
|
+
declare const installBrowserHandle: () => void;
|
|
369
|
+
type DOMTextSyncOptOutReason = 'empty-text' | 'decoration' | 'custom-leaf' | 'custom-text';
|
|
370
|
+
type RenderLeafProps = {
|
|
371
|
+
attributes: {
|
|
372
|
+
'data-editor-leaf': true;
|
|
373
|
+
'data-editor-leaf-end'?: number;
|
|
374
|
+
'data-editor-leaf-start'?: number;
|
|
375
|
+
};
|
|
376
|
+
children: ReactNode;
|
|
377
|
+
leaf: Omit<Text, 'text'>;
|
|
378
|
+
leafPosition?: {
|
|
379
|
+
end: number;
|
|
380
|
+
isFirst?: true;
|
|
381
|
+
isLast?: true;
|
|
382
|
+
start: number;
|
|
383
|
+
};
|
|
384
|
+
path?: Path;
|
|
385
|
+
text: Omit<Text, 'text'>;
|
|
386
|
+
};
|
|
387
|
+
/** Props of a `renderText` call for a text node. */
|
|
388
|
+
type RenderTextProps = {
|
|
389
|
+
attributes: {
|
|
390
|
+
'data-editor-dom-sync'?: true;
|
|
391
|
+
'data-editor-node': 'text';
|
|
392
|
+
'data-editor-dom-sync-reason'?: DOMTextSyncOptOutReason;
|
|
393
|
+
'data-editor-path'?: string;
|
|
394
|
+
'data-editor-node-key'?: string;
|
|
395
|
+
ref?: Ref<HTMLSpanElement>;
|
|
396
|
+
};
|
|
397
|
+
children: ReactNode;
|
|
398
|
+
text: Text;
|
|
399
|
+
};
|
|
400
|
+
type RenderPlaceholderProps = {
|
|
401
|
+
attributes: {
|
|
402
|
+
'aria-hidden': true;
|
|
403
|
+
'data-editor-placeholder': true;
|
|
404
|
+
contentEditable: false;
|
|
405
|
+
dir?: 'rtl';
|
|
406
|
+
ref: React$1.RefCallback<HTMLElement>;
|
|
407
|
+
style: CSSProperties;
|
|
408
|
+
};
|
|
409
|
+
children: ReactNode;
|
|
410
|
+
};
|
|
411
|
+
type DOMCoverageBoundaryMaterializePayload = {
|
|
412
|
+
boundary: DOMCoverageBoundary;
|
|
413
|
+
range?: Range;
|
|
414
|
+
rangeRole?: DOMCoverageMaterializeRangeRole;
|
|
415
|
+
reason: DOMCoverageMaterializeReason;
|
|
416
|
+
};
|
|
417
|
+
type EditableDOMCoverageBoundaryScope = {
|
|
418
|
+
from: number;
|
|
419
|
+
to?: number;
|
|
420
|
+
type: 'children';
|
|
421
|
+
} | {
|
|
422
|
+
type: 'self';
|
|
423
|
+
};
|
|
424
|
+
type EditableDOMCoverageBoundaryPlaceholderContext = {
|
|
425
|
+
materialize: () => void;
|
|
426
|
+
};
|
|
427
|
+
type EditableDOMCoverageBoundaryMaterializePayload = DOMCoverageBoundaryMaterializePayload;
|
|
428
|
+
type EditableDOMCoverageBoundaryProps = {
|
|
429
|
+
boundaryId?: string;
|
|
430
|
+
children?: ReactNode;
|
|
431
|
+
copyPolicy?: DOMCoverageCopyPolicy;
|
|
432
|
+
mounted?: boolean;
|
|
433
|
+
onMaterialize?: (payload: DOMCoverageBoundaryMaterializePayload) => void;
|
|
434
|
+
reason?: DOMCoverageReason;
|
|
435
|
+
renderPlaceholder?: (context: EditableDOMCoverageBoundaryPlaceholderContext) => ReactNode;
|
|
436
|
+
scope: EditableDOMCoverageBoundaryScope;
|
|
437
|
+
selectionPolicy?: DOMCoverageSelectionPolicy;
|
|
438
|
+
};
|
|
439
|
+
type EditableContentRootViewport = {
|
|
440
|
+
/**
|
|
441
|
+
* The root's top-level blocks in view, such as the shapes a camera shows.
|
|
442
|
+
* The slot also mounts the blocks the selection's ends are in, and hides
|
|
443
|
+
* each run of the others behind a boundary whose copy reads the model.
|
|
444
|
+
*/
|
|
445
|
+
mountedKeys: ReadonlySet<NodeKey>;
|
|
446
|
+
/**
|
|
447
|
+
* Brings `path` into view, such as when the selection moves into a block
|
|
448
|
+
* outside `mountedKeys`. `editor.api.dom.scrollIntoView` calls it with
|
|
449
|
+
* `align` `'auto'` for a mounted path, point or range in this root, and
|
|
450
|
+
* `'auto'` leaves a block already in view where it is. It adds the block at
|
|
451
|
+
* `path[0]` to `mountedKeys` before or on the next render, and returns false
|
|
452
|
+
* when it cannot.
|
|
453
|
+
*/
|
|
454
|
+
reveal: (path: Path, align?: 'auto' | 'center' | 'end' | 'start') => boolean;
|
|
455
|
+
};
|
|
456
|
+
type EditableContentRootSlotOptions = {
|
|
457
|
+
ariaLabel?: string;
|
|
458
|
+
/** Focus the content root's editable surface when it mounts. */
|
|
459
|
+
autoFocus?: boolean;
|
|
460
|
+
className?: string;
|
|
461
|
+
disableDefaultStyles?: boolean;
|
|
462
|
+
id?: string;
|
|
463
|
+
/**
|
|
464
|
+
* The element that takes focus in place of this root's editable when the
|
|
465
|
+
* editor moves focus here, as after an undo, on a click that selects an
|
|
466
|
+
* object or on a call to `editor.api.dom.focus()`. It takes focus only while
|
|
467
|
+
* no range is shown into this root and the root's own selection is none or
|
|
468
|
+
* a node selection of its top-level blocks, including a node selection the
|
|
469
|
+
* root kept while the caret was in another root. Once the element holds
|
|
470
|
+
* focus, that kept node selection becomes the selection again, so a key the
|
|
471
|
+
* element handles acts on it. It does not come back when the element's focus
|
|
472
|
+
* handler leaves focus on another element, asks for focus elsewhere or
|
|
473
|
+
* changes the selection. A focus call made inside an update or a read focuses
|
|
474
|
+
* the editable instead, as on a root without this element. When the render
|
|
475
|
+
* that follows a focus call replaces the element, focus falls to the page.
|
|
476
|
+
* Give the element `contentEditable={false}`: one that inherits editing runs
|
|
477
|
+
* the editable's own focus handler, which in Firefox moves focus to the
|
|
478
|
+
* editable. Unless the element is a control, such as a button, the editor
|
|
479
|
+
* reads no keys from it, so it must handle the keys it needs, such as undo
|
|
480
|
+
* and redo.
|
|
481
|
+
*/
|
|
482
|
+
nodeSelectionFocus?: NodeSelectionFocus;
|
|
483
|
+
placeholder?: ReactNode;
|
|
484
|
+
readOnly?: boolean;
|
|
485
|
+
spellCheck?: TextareaHTMLAttributes<HTMLDivElement>['spellCheck'];
|
|
486
|
+
style?: CSSProperties;
|
|
487
|
+
tabIndex?: number;
|
|
488
|
+
/** Mount only some of the root's top-level blocks, such as a board's shapes in view. */
|
|
489
|
+
viewport?: EditableContentRootViewport;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Render slots passed to custom element renderers for child projection,
|
|
493
|
+
* external text views, DOM coverage boundaries, and schema-owned content roots.
|
|
494
|
+
*/
|
|
495
|
+
type EditableElementSlots = {
|
|
496
|
+
children: (range?: {
|
|
497
|
+
from?: number;
|
|
498
|
+
to?: number;
|
|
499
|
+
}) => ReactNode;
|
|
500
|
+
/** Delegate one exact-one-Text block to an adapter while the editor owns its value. */
|
|
501
|
+
externalText: <TConfig = undefined>(options: ExternalTextOptions<TConfig>) => ReactNode;
|
|
502
|
+
/**
|
|
503
|
+
* Renders model-present content whose editable DOM may be intentionally
|
|
504
|
+
* absent, such as closed accordion bodies or inactive tab panels.
|
|
505
|
+
*/
|
|
506
|
+
contentBoundary: (props: EditableDOMCoverageBoundaryProps) => ReactNode;
|
|
507
|
+
/** Render a schema-owned child content root declared on the element's `contentRoots`. */
|
|
508
|
+
contentRoot: (slot: string, options?: EditableContentRootSlotOptions) => ReactNode;
|
|
509
|
+
};
|
|
510
|
+
type RenderElementProps<TElement extends Element$1 = Element$1> = TElement extends Element$1 ? {
|
|
511
|
+
attributes: {
|
|
512
|
+
'data-editor-inline'?: true;
|
|
513
|
+
'data-editor-node': 'element';
|
|
514
|
+
'data-editor-path': string;
|
|
515
|
+
'data-editor-node-key': string;
|
|
516
|
+
'data-editor-void'?: true;
|
|
517
|
+
/** The direction of a text block's first letter, absent when none decides. */
|
|
518
|
+
dir?: 'ltr' | 'rtl';
|
|
519
|
+
/**
|
|
520
|
+
* Binds and places the element. It changes when the node or its page
|
|
521
|
+
* placement changes, so a ref merge must change with it and pass a
|
|
522
|
+
* detach on as a call with `null`.
|
|
523
|
+
*/
|
|
524
|
+
ref: React$1.RefCallback<HTMLElement>;
|
|
525
|
+
};
|
|
526
|
+
children: ReactNode;
|
|
527
|
+
element: TElement;
|
|
528
|
+
isInline: boolean;
|
|
529
|
+
slots: EditableElementSlots;
|
|
530
|
+
} : never;
|
|
531
|
+
type RenderElementRenderer<TElement extends Element$1 = Element$1> = (props: RenderElementProps<TElement>) => ReactNode;
|
|
532
|
+
/**
|
|
533
|
+
* Props passed to `renderVoid` for rendering a void element's visible content
|
|
534
|
+
* inside the runtime-managed void shell.
|
|
535
|
+
*/
|
|
536
|
+
type RenderVoidProps<TElement extends Element$1 = Element$1> = {
|
|
537
|
+
/** The rendered void element node. */
|
|
538
|
+
element: TElement;
|
|
539
|
+
/** Element render slots available to void renderers (`slots.contentRoot` for schema-owned child roots). */
|
|
540
|
+
slots: {
|
|
541
|
+
contentRoot: EditableElementSlots['contentRoot'];
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
type RenderVoidRenderer<TElement extends Element$1 = Element$1> = (props: RenderVoidProps<TElement>) => ReactNode;
|
|
545
|
+
type EditableDOMHandlers<TAttributes> = { [K in keyof TAttributes]: K extends `on${string}` ? NonNullable<TAttributes[K]> extends ((event: infer E) => void) ? (event: E, context: EditableHandlerContext) => void : TAttributes[K] : TAttributes[K]; };
|
|
546
|
+
/**
|
|
547
|
+
* Each DOM handler gets an `EditableHandlerContext` after its event, whose
|
|
548
|
+
* `editor` is the view whose editable runs it. An editable skips an event
|
|
549
|
+
* inside a content root's editable, which runs the same handlers on the
|
|
550
|
+
* content root's view.
|
|
551
|
+
*/
|
|
552
|
+
type EditorContentProps<TElement extends Element$1 = Element$1, TRoot extends RootKey = RootKey> = {
|
|
553
|
+
autoFocus?: boolean;
|
|
554
|
+
className?: string;
|
|
555
|
+
disableDefaultStyles?: boolean;
|
|
556
|
+
id?: string;
|
|
557
|
+
ignoreBlankEditableRootClicks?: boolean;
|
|
558
|
+
onDOMBeforeInput?: EditableDOMBeforeInputHandler;
|
|
559
|
+
onHistoryReplay?: (event: EditableHistoryReplayEvent) => void;
|
|
560
|
+
onKeyDown?: EditableKeyDownHandler;
|
|
561
|
+
/**
|
|
562
|
+
* Called once for each paste this editable handles through its built-in
|
|
563
|
+
* formats: after the paste commits (`inserted: true`), or when no format
|
|
564
|
+
* can insert it or a format claims it with an empty slice
|
|
565
|
+
* (`inserted: false`). A diagnostic with `impact: 'lossy'` means pasted
|
|
566
|
+
* content was left out.
|
|
567
|
+
*
|
|
568
|
+
* Not called when `onPaste` or a plugin command handles the paste without
|
|
569
|
+
* the built-in formats, or when this editable unmounts before the paste
|
|
570
|
+
* settles. An `onPaste` handler that inserts through
|
|
571
|
+
* `editor.api.dom.clipboard.insertData` during the paste gets that
|
|
572
|
+
* insertion's result.
|
|
573
|
+
*/
|
|
574
|
+
onPasteResult?: (result: EditablePasteResult) => void;
|
|
575
|
+
/**
|
|
576
|
+
* Called once after a primary mouse press that began on this editable's own
|
|
577
|
+
* text has its final text range: after the mouseup's import and every later
|
|
578
|
+
* write of that press, such as a drag released outside the editable or a
|
|
579
|
+
* click inside selected text that collapses it. Not called for a press on a
|
|
580
|
+
* control, an external text host or a nested editor, for touch or pen, when
|
|
581
|
+
* the press ends in a node selection, or when a key other than a modifier,
|
|
582
|
+
* a composition, a native drag, a blur, another press or an unmount comes
|
|
583
|
+
* first.
|
|
584
|
+
*/
|
|
585
|
+
onPointerSelectionEnd?: EditablePointerSelectionEndHandler;
|
|
586
|
+
/** Reports a drop this Editable lands: the transfer outcome, or the data it inserted. */
|
|
587
|
+
onDropResult?: (result: EditableDropResult) => void;
|
|
588
|
+
placeholder?: ReactNode;
|
|
589
|
+
readOnly?: boolean;
|
|
590
|
+
ref?: React$1.Ref<HTMLDivElement>;
|
|
591
|
+
renderElement?: RenderElementRenderer<TElement>;
|
|
592
|
+
renderLeaf?: (props: RenderLeafProps) => ReactNode;
|
|
593
|
+
renderPlaceholder?: (props: RenderPlaceholderProps) => ReactNode;
|
|
594
|
+
renderText?: (props: RenderTextProps) => ReactNode;
|
|
595
|
+
renderVoid?: RenderVoidRenderer<TElement>;
|
|
596
|
+
root?: NamedRootKey<TRoot>;
|
|
597
|
+
scrollSelectionIntoView?: (editor: Editor$1, domRange: globalThis.Range) => void;
|
|
598
|
+
spellCheck?: TextareaHTMLAttributes<HTMLDivElement>['spellCheck'];
|
|
599
|
+
style?: CSSProperties;
|
|
600
|
+
} & EditableDOMHandlers<Omit<TextareaHTMLAttributes<HTMLDivElement>, 'autoFocus' | 'children' | 'className' | 'id' | 'onKeyDown' | 'placeholder' | 'readOnly' | 'spellCheck' | 'style'>>;
|
|
601
|
+
type DOMScopeEditor = {
|
|
602
|
+
api: {
|
|
603
|
+
dom: Pick<DOMApi, 'editable' | 'root' | 'scroll'>;
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
/** Return the mounted editable element for an editor root. */
|
|
607
|
+
declare const useEditorEditableElement: <const TRoot extends RootKey = RootKey>(editor: DOMScopeEditor, root?: NamedRootKey<TRoot>) => HTMLElement | null;
|
|
608
|
+
/** Return the mounted editor root element. */
|
|
609
|
+
declare const useEditorRootElement: (editor: DOMScopeEditor) => HTMLElement | null;
|
|
610
|
+
/** Return the editor scroll container element. */
|
|
611
|
+
declare const useEditorScrollElement: (editor: DOMScopeEditor) => HTMLElement | null;
|
|
612
|
+
/**
|
|
613
|
+
* Register the element that scrolls the editor, such as a page's scrolling
|
|
614
|
+
* `main`. Every editor of the document returns it from
|
|
615
|
+
* `editor.api.dom.scroll()`, and virtualized editables follow its scroll. A
|
|
616
|
+
* `fallback` registration applies only while no other element is registered.
|
|
617
|
+
*/
|
|
618
|
+
declare const useEditorScrollElementRef: (editor: DOMScopeEditor, { fallback }?: {
|
|
619
|
+
fallback?: boolean;
|
|
620
|
+
}) => (element: HTMLElement | null) => void;
|
|
621
|
+
/** Commit and view-state subscription options for `useEditorSelector`. */
|
|
622
|
+
type UseEditorSelectorOptions<T = unknown> = {
|
|
623
|
+
dependsOn?: EditorSelectorDependencies;
|
|
624
|
+
equalityFn?: (a: T, b: T) => boolean;
|
|
625
|
+
};
|
|
626
|
+
/** Standalone editing areas mounted in a view's presentation. */
|
|
627
|
+
type EditorRootAreas<TEditor extends AnyEditor = AnyEditor> = Readonly<{
|
|
628
|
+
/** Whether this view is the active shown standalone editing area for its root in this presentation. */
|
|
629
|
+
isPrimaryForRoot: boolean;
|
|
630
|
+
/** Return the mounted view of a nested content root inside this editing area, if one is mounted. */
|
|
631
|
+
nestedView: (root: NamedRootKey) => TEditor | null;
|
|
632
|
+
/** Named roots that currently have their own shown standalone editing area in this presentation. */
|
|
633
|
+
standaloneRoots: readonly NamedRootKey[];
|
|
634
|
+
}>;
|
|
635
|
+
/**
|
|
636
|
+
* Subscribe to the standalone editing areas mounted in this view's
|
|
637
|
+
* presentation, and whether this view is the active standalone area for its
|
|
638
|
+
* root.
|
|
639
|
+
*/
|
|
640
|
+
declare function useEditorRootAreas<TEditor extends AnyEditor = AnyEditor>(editor: TEditor): EditorRootAreas<TEditor>;
|
|
641
|
+
/**
|
|
642
|
+
* Selection match mode for `useElementSelected`:
|
|
643
|
+
*
|
|
644
|
+
* - `intersects`: any selection reaches the element.
|
|
645
|
+
* - `collapsed`: a collapsed selection reaches the element.
|
|
646
|
+
* - `text`: a text selection reaches the element; any node selection is false.
|
|
647
|
+
* - `node`: a node selection holds the element.
|
|
648
|
+
* - `object`: an object node selection holds the element itself.
|
|
649
|
+
*/
|
|
650
|
+
type UseElementSelectedMode = 'collapsed' | 'intersects' | 'node' | 'object' | 'text';
|
|
651
|
+
/** Options for selecting the context element or an explicit element path. */
|
|
652
|
+
type UseElementSelectedOptions = {
|
|
653
|
+
at?: NodeKey | Path | null;
|
|
654
|
+
mode?: UseElementSelectedMode;
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* Subscribe to whether an element path matches the current view's selection,
|
|
658
|
+
* including retained content in a mounted markup view.
|
|
659
|
+
*/
|
|
660
|
+
declare const useElementSelected: ({ at, mode }?: UseElementSelectedOptions) => boolean;
|
|
661
|
+
/**
|
|
662
|
+
* Resolve a stable same-runtime root key owned by an element.
|
|
663
|
+
*
|
|
664
|
+
* Prefer storing `childRoots[slot]` on the element when the child root is part
|
|
665
|
+
* of persisted document data. The node-key fallback is useful for ephemeral
|
|
666
|
+
* island roots, but it is intentionally not a persistence contract.
|
|
667
|
+
*/
|
|
668
|
+
declare function useChildRoot(element?: Element$1 | null, slot?: string): NamedRootKey;
|
|
669
|
+
/**
|
|
670
|
+
* This view's block drop indicator while a block drag hovers an admitted
|
|
671
|
+
* edge: the target key, edge, axis and the viewport line to paint.
|
|
672
|
+
*/
|
|
673
|
+
declare const useDropIndicator: () => DropIndicator | null;
|
|
674
|
+
/** Identifies the exact mounted Editable whose visible part cuts the boxes. */
|
|
675
|
+
type UseEditableClipOptions = Readonly<{
|
|
676
|
+
editableRef: RefObject<HTMLElement | null>;
|
|
677
|
+
}>;
|
|
678
|
+
type EditableClip = (rects: Iterable<Pick<ViewportRect, 'bottom' | 'left' | 'right' | 'top'>>) => readonly ViewportRect[];
|
|
679
|
+
/**
|
|
680
|
+
* Cuts viewport boxes to `RangeGeometry.clipRect` of one Editable, with the
|
|
681
|
+
* edge rule of `RangeGeometry.visible`. Returns [] when no part shows or no
|
|
682
|
+
* Editable is mounted. It reads layout, so call it where you measure. The
|
|
683
|
+
* returned function is stable.
|
|
684
|
+
*/
|
|
685
|
+
declare function useEditableClip({ editableRef }: UseEditableClipOptions): EditableClip;
|
|
686
|
+
type HistoryDirection = 'redo' | 'undo';
|
|
687
|
+
/** Focus behavior after mounted undo or redo applies a history batch. */
|
|
688
|
+
type EditorHistoryFocusPolicy = EditorHistoryFocusPolicy$1;
|
|
689
|
+
/** Options for history commands and shortcut handling. */
|
|
690
|
+
type UseEditorHistoryOptions<TRoot extends RootKey = RootKey> = {
|
|
691
|
+
focusPolicy?: EditorHistoryFocusPolicy;
|
|
692
|
+
} & ({
|
|
693
|
+
/** Bind commands and focus to this existing view, including outside an editor root. */
|
|
694
|
+
editor: Editor<any, any>;
|
|
695
|
+
root?: never;
|
|
696
|
+
} | {
|
|
697
|
+
editor?: undefined;
|
|
698
|
+
root?: NamedRootKey<TRoot>;
|
|
699
|
+
});
|
|
700
|
+
/** Undo/redo availability and command handlers for the document's history. */
|
|
701
|
+
type EditorHistoryController = {
|
|
702
|
+
canRedo: boolean;
|
|
703
|
+
canUndo: boolean;
|
|
704
|
+
onKeyDown: (event: KeyboardEvent$1) => void;
|
|
705
|
+
pending: HistoryDirection | null;
|
|
706
|
+
redo: () => void;
|
|
707
|
+
undo: () => void;
|
|
708
|
+
};
|
|
709
|
+
/** Options for mouse interaction on root-level chrome outside editable text. */
|
|
710
|
+
type UseRootChromeOptions = {
|
|
711
|
+
disabled?: boolean;
|
|
712
|
+
selection?: 'end' | 'restore';
|
|
713
|
+
};
|
|
714
|
+
/** Props and root metadata for root-level mouse interaction chrome. */
|
|
715
|
+
type RootChromeController = {
|
|
716
|
+
props: {
|
|
717
|
+
'data-editor-root-chrome'?: NamedRootKey;
|
|
718
|
+
onMouseDownCapture: MouseEventHandler<HTMLElement>;
|
|
719
|
+
onMouseMoveCapture: MouseEventHandler<HTMLElement>;
|
|
720
|
+
onMouseUpCapture: MouseEventHandler<HTMLElement>;
|
|
721
|
+
};
|
|
722
|
+
root: NamedRootKey | undefined;
|
|
723
|
+
};
|
|
724
|
+
/**
|
|
725
|
+
* Create props for root-level mouse interaction outside editable content.
|
|
726
|
+
*
|
|
727
|
+
* Each mounted `Editable` of the root is a copy of it. A press acts on the copy
|
|
728
|
+
* that the chrome surrounds, even while another copy of that root was used
|
|
729
|
+
* last. A press on a control or widget inside the chrome, such as a button,
|
|
730
|
+
* acts on no copy. When one chrome holds several copies, a press outside them
|
|
731
|
+
* acts on the copy used last, or else the first. Chrome of the primary
|
|
732
|
+
* document inside another chrome of it acts as part of the outer one. A press
|
|
733
|
+
* that an `Editable` of another root around the chrome handles first never
|
|
734
|
+
* reaches the chrome.
|
|
735
|
+
*/
|
|
736
|
+
declare function useRootChrome<const TRoot extends RootKey = RootKey>(root?: NamedRootKey<TRoot>, { disabled, selection }?: UseRootChromeOptions): RootChromeController;
|
|
737
|
+
/** Options for creating a root-specific command editor. */
|
|
738
|
+
type UseRootEditorOptions = {
|
|
739
|
+
readOnly?: boolean;
|
|
740
|
+
};
|
|
741
|
+
/** Identifies the exact mounted Editable used to resolve selection geometry. */
|
|
742
|
+
type UseSelectionGeometryOptions = Readonly<{
|
|
743
|
+
editableRef: RefObject<HTMLElement | null>;
|
|
744
|
+
}>;
|
|
745
|
+
/** Read geometry for the current selection in one exact Editable. */
|
|
746
|
+
declare function useSelectionGeometry({ editableRef }: UseSelectionGeometryOptions): RangeGeometry | null;
|
|
747
|
+
/** Selector options for subscribing to one editor state field. */
|
|
748
|
+
type UseStateFieldValueOptions<TValue = unknown> = Pick<UseEditorSelectorOptions<TValue>, 'equalityFn'>;
|
|
749
|
+
/** Setter returned by `useSetStateField` for one editor state field. */
|
|
750
|
+
type StateFieldSetter<TValue> = (value: StateFieldValueInput<TValue>, policy?: EditorUpdatePolicy) => void;
|
|
751
|
+
/** Selection-effect policies owned by the editor React runtime. */
|
|
752
|
+
declare const ReactUpdatePolicy: Readonly<{
|
|
753
|
+
preserveSelection: Readonly<{
|
|
754
|
+
tags: readonly ["skip-dom-selection", "skip-selection-focus", "skip-scroll-into-view"];
|
|
755
|
+
}>;
|
|
756
|
+
}>;
|
|
757
|
+
type EditorStaticProps<E = Editor$2> = {
|
|
758
|
+
/**
|
|
759
|
+
* A document to render instead of the editor's own, such as a streamed
|
|
760
|
+
* preview. The editor supplies the plugins and is not edited. Pass the same
|
|
761
|
+
* object again to reuse its validated view. Reads, plugin reads and plugin
|
|
762
|
+
* APIs on the rendered editor see the document; an editor captured when a
|
|
763
|
+
* plugin was created still holds its own value.
|
|
764
|
+
*/
|
|
765
|
+
document?: EditorDocumentValue;
|
|
766
|
+
/** Editor instance. */
|
|
767
|
+
editor: E;
|
|
768
|
+
style?: React$1.CSSProperties;
|
|
769
|
+
} & React$1.HTMLAttributes<HTMLDivElement>;
|
|
770
|
+
declare function EditorStatic<E = Editor$2>(props: EditorStaticProps<E>): React$1.JSX.Element;
|
|
771
|
+
export { react as $, ReactApi as A, StateFieldSetter as B, ExternalTextChange as C, ExternalTextSelectionState as D, ExternalTextSelection as E, RenderLeafProps as F, UseEditorSelectorOptions as G, TypedTextListener as H, RenderPlaceholderProps as I, UseRootChromeOptions as J, UseElementSelectedMode as K, RenderTextProps as L, ReactPluginOptions as M, ReactUpdatePolicy as N, ExternalTextState as O, RenderElementProps as P, installBrowserHandle as Q, RenderVoidProps as R, ExternalTextAdapter as S, ExternalTextOptions as T, UseEditableClipOptions as U, TypedText as V, UseEditorHistoryOptions as W, UseSelectionGeometryOptions as X, UseRootEditorOptions as Y, UseStateFieldValueOptions as Z, EditorContentProps as _, EditableDOMCoverageBoundaryPlaceholderContext as a, useEditorRootElement as at, EditorRootAreas as b, EditableDropResult as c, useElementSelected as ct, EditableHandlerResult as d, RangeGeometry as dt, useChildRoot as et, EditableHistoryReplayEvent as f, RangeRects as ft, Editor as g, EditablePasteResult as h, EditableDOMCoverageBoundaryMaterializePayload as i, useEditorRootAreas as it, ReactPlugin as j, ExternalTextView as k, EditableElementSlots as l, useRootChrome as lt, EditableInputEventContext as m, EditorStaticProps as n, useEditableClip as nt, EditableDOMCoverageBoundaryProps as o, useEditorScrollElement as ot, EditableHistoryReplayResult as p, UseElementSelectedOptions as q, EditableDOMBeforeInputContext as r, useEditorEditableElement as rt, EditableDOMCoverageBoundaryScope as s, useEditorScrollElementRef as st, EditorStatic as t, useDropIndicator as tt, EditableHandlerContext as u, useSelectionGeometry as ut, EditorHistoryController as v, ExternalTextDecoration as w, ExternalTextActions as x, EditorHistoryFocusPolicy as y, RootChromeController as z };
|