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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectionApi, didCommitChangePersistedValue, getCommitDocumentValue, isDocumentView, isRootSelectionChanged, projectEditorViewCommit, runEditorObserver, subscribePublishedCommits } from "../../facade.js";
|
|
2
2
|
import { failInvariant } from "../../internal/failInvariant.js";
|
|
3
3
|
import { subscribePlateChangeCallbacks } from "../../internal/plugin/plateChangeHandlers.js";
|
|
4
4
|
import { EditorRoot as EditorRoot$1 } from "../internal/plite-components.js";
|
|
@@ -13,50 +13,49 @@ import { c } from "react/compiler-runtime";
|
|
|
13
13
|
//#region src/react/components/Plate.tsx
|
|
14
14
|
const useIsomorphicLayoutEffect = typeof document === "undefined" ? React.useEffect : React.useLayoutEffect;
|
|
15
15
|
function PlateEditorObservers(t0) {
|
|
16
|
-
const $ = c(
|
|
16
|
+
const $ = c(30);
|
|
17
17
|
const { editor, onCommit, onNodeChange, onSelectionChange, onTextChange, onValueChange } = t0;
|
|
18
18
|
let t1;
|
|
19
|
-
if ($[0] !== editor
|
|
20
|
-
t1 = editor
|
|
21
|
-
$[0] = editor
|
|
22
|
-
$[1] =
|
|
23
|
-
|
|
19
|
+
if ($[0] !== editor || $[1] !== onCommit || $[2] !== onSelectionChange || $[3] !== onValueChange) {
|
|
20
|
+
t1 = !isDocumentView(editor) && Boolean(onCommit || onSelectionChange || onValueChange);
|
|
21
|
+
$[0] = editor;
|
|
22
|
+
$[1] = onCommit;
|
|
23
|
+
$[2] = onSelectionChange;
|
|
24
|
+
$[3] = onValueChange;
|
|
25
|
+
$[4] = t1;
|
|
26
|
+
} else t1 = $[4];
|
|
27
|
+
const hasCommitObserver = t1;
|
|
24
28
|
let t2;
|
|
25
|
-
if ($[
|
|
26
|
-
t2 = { version:
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
|
|
29
|
+
if ($[5] !== editor || $[6] !== hasCommitObserver) {
|
|
30
|
+
t2 = hasCommitObserver ? { version: editor.read.lastCommit()?.version ?? 0 } : null;
|
|
31
|
+
$[5] = editor;
|
|
32
|
+
$[6] = hasCommitObserver;
|
|
33
|
+
$[7] = t2;
|
|
34
|
+
} else t2 = $[7];
|
|
30
35
|
const observerBaseline = t2;
|
|
31
|
-
let t3;
|
|
32
|
-
if ($[4] !== observerBaseline) {
|
|
33
|
-
t3 = () => createEditorCommitPublicationQueue(observerBaseline.version);
|
|
34
|
-
$[4] = observerBaseline;
|
|
35
|
-
$[5] = t3;
|
|
36
|
-
} else t3 = $[5];
|
|
37
|
-
const [commitPublicationQueue] = React.useState(t3);
|
|
38
36
|
const observerBaselineRef = React.useRef(null);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
const lastVersionRef = React.useRef(observerBaseline?.version ?? 0);
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[8] !== onCommit || $[9] !== onNodeChange || $[10] !== onSelectionChange || $[11] !== onTextChange || $[12] !== onValueChange) {
|
|
40
|
+
t3 = {
|
|
42
41
|
onCommit,
|
|
43
42
|
onNodeChange,
|
|
44
43
|
onSelectionChange,
|
|
45
44
|
onTextChange,
|
|
46
45
|
onValueChange
|
|
47
46
|
};
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
$[
|
|
54
|
-
} else
|
|
55
|
-
const observersRef = React.useRef(
|
|
47
|
+
$[8] = onCommit;
|
|
48
|
+
$[9] = onNodeChange;
|
|
49
|
+
$[10] = onSelectionChange;
|
|
50
|
+
$[11] = onTextChange;
|
|
51
|
+
$[12] = onValueChange;
|
|
52
|
+
$[13] = t3;
|
|
53
|
+
} else t3 = $[13];
|
|
54
|
+
const observersRef = React.useRef(t3);
|
|
55
|
+
let t4;
|
|
56
56
|
let t5;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
t5 = () => {
|
|
57
|
+
if ($[14] !== onCommit || $[15] !== onNodeChange || $[16] !== onSelectionChange || $[17] !== onTextChange || $[18] !== onValueChange) {
|
|
58
|
+
t4 = () => {
|
|
60
59
|
observersRef.current = {
|
|
61
60
|
onCommit,
|
|
62
61
|
onNodeChange,
|
|
@@ -65,31 +64,31 @@ function PlateEditorObservers(t0) {
|
|
|
65
64
|
onValueChange
|
|
66
65
|
};
|
|
67
66
|
};
|
|
68
|
-
|
|
67
|
+
t5 = [
|
|
69
68
|
onCommit,
|
|
70
69
|
onNodeChange,
|
|
71
70
|
onSelectionChange,
|
|
72
71
|
onTextChange,
|
|
73
72
|
onValueChange
|
|
74
73
|
];
|
|
75
|
-
$[
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
74
|
+
$[14] = onCommit;
|
|
75
|
+
$[15] = onNodeChange;
|
|
76
|
+
$[16] = onSelectionChange;
|
|
77
|
+
$[17] = onTextChange;
|
|
78
|
+
$[18] = onValueChange;
|
|
79
|
+
$[19] = t4;
|
|
80
|
+
$[20] = t5;
|
|
82
81
|
} else {
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
t4 = $[19];
|
|
83
|
+
t5 = $[20];
|
|
85
84
|
}
|
|
86
|
-
React.useInsertionEffect(
|
|
85
|
+
React.useInsertionEffect(t4, t5);
|
|
87
86
|
const hasNodeChange = Boolean(onNodeChange);
|
|
88
87
|
const hasTextChange = Boolean(onTextChange);
|
|
88
|
+
let t6;
|
|
89
89
|
let t7;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
t7 = () => subscribePlateChangeCallbacks(editor, {
|
|
90
|
+
if ($[21] !== editor || $[22] !== hasNodeChange || $[23] !== hasTextChange) {
|
|
91
|
+
t6 = () => subscribePlateChangeCallbacks(editor, {
|
|
93
92
|
onNodeChange: hasNodeChange ? (context) => {
|
|
94
93
|
observersRef.current.onNodeChange?.(context);
|
|
95
94
|
} : void 0,
|
|
@@ -97,32 +96,42 @@ function PlateEditorObservers(t0) {
|
|
|
97
96
|
observersRef.current.onTextChange?.(context_0);
|
|
98
97
|
} : void 0
|
|
99
98
|
});
|
|
100
|
-
|
|
99
|
+
t7 = [
|
|
101
100
|
editor,
|
|
102
101
|
hasNodeChange,
|
|
103
102
|
hasTextChange
|
|
104
103
|
];
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
104
|
+
$[21] = editor;
|
|
105
|
+
$[22] = hasNodeChange;
|
|
106
|
+
$[23] = hasTextChange;
|
|
107
|
+
$[24] = t6;
|
|
108
|
+
$[25] = t7;
|
|
110
109
|
} else {
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
t6 = $[24];
|
|
111
|
+
t7 = $[25];
|
|
113
112
|
}
|
|
114
|
-
useIsomorphicLayoutEffect(
|
|
115
|
-
let
|
|
113
|
+
useIsomorphicLayoutEffect(t6, t7);
|
|
114
|
+
let t8;
|
|
116
115
|
let t9;
|
|
117
|
-
if ($[
|
|
118
|
-
|
|
116
|
+
if ($[26] !== editor || $[27] !== observerBaseline) {
|
|
117
|
+
t8 = () => {
|
|
118
|
+
if (!observerBaseline) {
|
|
119
|
+
observerBaselineRef.current = null;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
119
122
|
if (observerBaselineRef.current !== observerBaseline) {
|
|
120
123
|
observerBaselineRef.current = observerBaseline;
|
|
121
|
-
|
|
124
|
+
lastVersionRef.current = observerBaseline.version;
|
|
122
125
|
}
|
|
123
|
-
const
|
|
126
|
+
const mountedRoot = editor.read(_temp) ?? "main";
|
|
127
|
+
const observeCommit = (sourceCommit) => {
|
|
128
|
+
if (sourceCommit.version <= lastVersionRef.current) return;
|
|
129
|
+
lastVersionRef.current = sourceCommit.version;
|
|
124
130
|
const { onCommit: innerOnCommit, onSelectionChange: innerOnSelectionChange, onValueChange: innerOnValueChange } = observersRef.current;
|
|
125
131
|
if (!innerOnCommit && !innerOnSelectionChange && !innerOnValueChange) return;
|
|
132
|
+
const projected = projectEditorViewCommit(editor, sourceCommit);
|
|
133
|
+
const { commit } = projected;
|
|
134
|
+
const snapshot = projected.getSnapshot();
|
|
126
135
|
const valueChanged = didCommitChangePersistedValue(editor, commit);
|
|
127
136
|
const context_1 = {
|
|
128
137
|
commit,
|
|
@@ -141,39 +150,31 @@ function PlateEditorObservers(t0) {
|
|
|
141
150
|
});
|
|
142
151
|
}, "EditorRoot");
|
|
143
152
|
}
|
|
144
|
-
if (
|
|
145
|
-
innerOnSelectionChange
|
|
153
|
+
if (innerOnSelectionChange && isRootSelectionChanged(mountedRoot, commit) && !SelectionApi.equals(projected.getBeforeSnapshot().selection, snapshot.selection)) runEditorObserver(editor, "commit-listener", () => {
|
|
154
|
+
innerOnSelectionChange({
|
|
146
155
|
...context_1,
|
|
147
156
|
selection: snapshot.selection
|
|
148
157
|
});
|
|
149
158
|
}, "EditorRoot");
|
|
150
159
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
});
|
|
154
|
-
const latestCommit = editor.read.lastCommit();
|
|
155
|
-
if (latestCommit && latestCommit.version > commitPublicationQueue.lastVersion) publishEditorCommitInVersionOrder(commitPublicationQueue, latestCommit, editor.read(_temp), observeCommit, { allowVersionGap: true });
|
|
156
|
-
return unsubscribe;
|
|
160
|
+
return subscribePublishedCommits(editor, (commit_0) => {
|
|
161
|
+
observeCommit(commit_0);
|
|
162
|
+
}, { catchUpFromVersion: lastVersionRef.current });
|
|
157
163
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
];
|
|
163
|
-
$[24] = commitPublicationQueue;
|
|
164
|
-
$[25] = editor;
|
|
165
|
-
$[26] = observerBaseline;
|
|
166
|
-
$[27] = t10;
|
|
167
|
-
$[28] = t9;
|
|
164
|
+
t9 = [editor, observerBaseline];
|
|
165
|
+
$[26] = editor;
|
|
166
|
+
$[27] = observerBaseline;
|
|
167
|
+
$[28] = t8;
|
|
168
|
+
$[29] = t9;
|
|
168
169
|
} else {
|
|
169
|
-
|
|
170
|
-
t9 = $[
|
|
170
|
+
t8 = $[28];
|
|
171
|
+
t9 = $[29];
|
|
171
172
|
}
|
|
172
|
-
useIsomorphicLayoutEffect(
|
|
173
|
+
useIsomorphicLayoutEffect(t8, t9);
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
175
176
|
function _temp(state) {
|
|
176
|
-
return state.
|
|
177
|
+
return state.view.root();
|
|
177
178
|
}
|
|
178
179
|
function PlateInner(t0) {
|
|
179
180
|
const $ = c(33);
|
|
@@ -2,7 +2,7 @@ import { failInvariant } from "../../internal/failInvariant.js";
|
|
|
2
2
|
import { getCompiledPlatePlugin, getPlateRuntime } from "../../internal/plugin/compilePlateModel.js";
|
|
3
3
|
import { isEditOnly } from "../../internal/plugin/isEditOnlyDisabled.js";
|
|
4
4
|
import { useEditorScrollElementRef } from "../plite-react.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useIsomorphicLayoutEffect } from "../internal/react-helpers.js";
|
|
6
6
|
import { PlateScopeContext, useAreaScope, usePlateScope, useScopeTarget } from "../internal/plate-context.js";
|
|
7
7
|
import { useEditorSelector } from "../stores/plate/useEditorSelector.js";
|
|
8
8
|
import { usePlateModelRevision } from "../internal/usePlateModelRevision.js";
|
|
@@ -10,7 +10,7 @@ import React from "react";
|
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
//#region src/react/components/PlateContainer.tsx
|
|
12
12
|
const EditorContainer = (t0) => {
|
|
13
|
-
const $ = c(
|
|
13
|
+
const $ = c(35);
|
|
14
14
|
let children;
|
|
15
15
|
let props;
|
|
16
16
|
if ($[0] !== t0) {
|
|
@@ -36,32 +36,85 @@ const EditorContainer = (t0) => {
|
|
|
36
36
|
t2 = { fallback: true };
|
|
37
37
|
$[4] = t2;
|
|
38
38
|
} else t2 = $[4];
|
|
39
|
-
const
|
|
39
|
+
const scrollElementRef = useEditorScrollElementRef(editor, t2);
|
|
40
|
+
const scrollRefRef = React.useRef(scrollElementRef);
|
|
41
|
+
const attachedScrollRef = React.useRef(null);
|
|
42
|
+
let t3;
|
|
43
|
+
let t4;
|
|
44
|
+
if ($[5] !== scrollElementRef) {
|
|
45
|
+
t3 = () => {
|
|
46
|
+
scrollRefRef.current = scrollElementRef;
|
|
47
|
+
};
|
|
48
|
+
t4 = [scrollElementRef];
|
|
49
|
+
$[5] = scrollElementRef;
|
|
50
|
+
$[6] = t3;
|
|
51
|
+
$[7] = t4;
|
|
52
|
+
} else {
|
|
53
|
+
t3 = $[6];
|
|
54
|
+
t4 = $[7];
|
|
55
|
+
}
|
|
56
|
+
React.useInsertionEffect(t3, t4);
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[8] !== containerRef) {
|
|
59
|
+
t5 = (node) => {
|
|
60
|
+
containerRef.current = node;
|
|
61
|
+
if (node) {
|
|
62
|
+
attachedScrollRef.current = scrollRefRef.current;
|
|
63
|
+
scrollRefRef.current(node);
|
|
64
|
+
} else {
|
|
65
|
+
attachedScrollRef.current?.(null);
|
|
66
|
+
attachedScrollRef.current = null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
$[8] = containerRef;
|
|
70
|
+
$[9] = t5;
|
|
71
|
+
} else t5 = $[9];
|
|
72
|
+
const ref = t5;
|
|
73
|
+
let t6;
|
|
74
|
+
let t7;
|
|
75
|
+
if ($[10] !== containerRef || $[11] !== scrollElementRef) {
|
|
76
|
+
t6 = () => {
|
|
77
|
+
const node_0 = containerRef.current;
|
|
78
|
+
if (!node_0 || attachedScrollRef.current === scrollElementRef) return;
|
|
79
|
+
attachedScrollRef.current?.(null);
|
|
80
|
+
attachedScrollRef.current = scrollElementRef;
|
|
81
|
+
scrollElementRef(node_0);
|
|
82
|
+
};
|
|
83
|
+
t7 = [containerRef, scrollElementRef];
|
|
84
|
+
$[10] = containerRef;
|
|
85
|
+
$[11] = scrollElementRef;
|
|
86
|
+
$[12] = t6;
|
|
87
|
+
$[13] = t7;
|
|
88
|
+
} else {
|
|
89
|
+
t6 = $[12];
|
|
90
|
+
t7 = $[13];
|
|
91
|
+
}
|
|
92
|
+
useIsomorphicLayoutEffect(t6, t7);
|
|
40
93
|
let afterContainer;
|
|
41
94
|
let beforeContainer;
|
|
42
95
|
let mainContainer;
|
|
43
|
-
if ($[
|
|
96
|
+
if ($[14] !== area || $[15] !== children || $[16] !== containerRef || $[17] !== editor || $[18] !== props || $[19] !== readOnly || $[20] !== ref) {
|
|
44
97
|
afterContainer = null;
|
|
45
98
|
beforeContainer = null;
|
|
46
|
-
let
|
|
47
|
-
if ($[
|
|
48
|
-
|
|
49
|
-
$[
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
} else
|
|
53
|
-
let
|
|
54
|
-
if ($[
|
|
55
|
-
|
|
99
|
+
let t8;
|
|
100
|
+
if ($[24] !== area || $[25] !== children) {
|
|
101
|
+
t8 = /* @__PURE__ */ React.createElement(PlateScopeContext, { value: area }, children);
|
|
102
|
+
$[24] = area;
|
|
103
|
+
$[25] = children;
|
|
104
|
+
$[26] = t8;
|
|
105
|
+
} else t8 = $[26];
|
|
106
|
+
let t9;
|
|
107
|
+
if ($[27] !== props || $[28] !== ref || $[29] !== t8) {
|
|
108
|
+
t9 = /* @__PURE__ */ React.createElement("div", {
|
|
56
109
|
ref,
|
|
57
110
|
...props
|
|
58
|
-
},
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
} else
|
|
64
|
-
mainContainer =
|
|
111
|
+
}, t8);
|
|
112
|
+
$[27] = props;
|
|
113
|
+
$[28] = ref;
|
|
114
|
+
$[29] = t8;
|
|
115
|
+
$[30] = t9;
|
|
116
|
+
} else t9 = $[30];
|
|
117
|
+
mainContainer = t9;
|
|
65
118
|
getPlateRuntime(editor).pluginCache.slots.beforeContainer.forEach((name) => {
|
|
66
119
|
const plugin = getCompiledPlatePlugin(editor, name) ?? failInvariant("Expected value to be defined");
|
|
67
120
|
if (isEditOnly(readOnly, plugin, "slots")) return;
|
|
@@ -74,30 +127,30 @@ const EditorContainer = (t0) => {
|
|
|
74
127
|
const AfterContainer = plugin_0.slots.afterContainer ?? failInvariant("Expected value to be defined");
|
|
75
128
|
afterContainer = /* @__PURE__ */ React.createElement(React.Fragment, null, afterContainer, /* @__PURE__ */ React.createElement(AfterContainer, { containerRef }));
|
|
76
129
|
});
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
$[
|
|
84
|
-
$[
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
130
|
+
$[14] = area;
|
|
131
|
+
$[15] = children;
|
|
132
|
+
$[16] = containerRef;
|
|
133
|
+
$[17] = editor;
|
|
134
|
+
$[18] = props;
|
|
135
|
+
$[19] = readOnly;
|
|
136
|
+
$[20] = ref;
|
|
137
|
+
$[21] = afterContainer;
|
|
138
|
+
$[22] = beforeContainer;
|
|
139
|
+
$[23] = mainContainer;
|
|
87
140
|
} else {
|
|
88
|
-
afterContainer = $[
|
|
89
|
-
beforeContainer = $[
|
|
90
|
-
mainContainer = $[
|
|
141
|
+
afterContainer = $[21];
|
|
142
|
+
beforeContainer = $[22];
|
|
143
|
+
mainContainer = $[23];
|
|
91
144
|
}
|
|
92
|
-
let
|
|
93
|
-
if ($[
|
|
94
|
-
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
} else
|
|
100
|
-
return
|
|
145
|
+
let t8;
|
|
146
|
+
if ($[31] !== afterContainer || $[32] !== beforeContainer || $[33] !== mainContainer) {
|
|
147
|
+
t8 = /* @__PURE__ */ React.createElement(React.Fragment, null, beforeContainer, mainContainer, afterContainer);
|
|
148
|
+
$[31] = afterContainer;
|
|
149
|
+
$[32] = beforeContainer;
|
|
150
|
+
$[33] = mainContainer;
|
|
151
|
+
$[34] = t8;
|
|
152
|
+
} else t8 = $[34];
|
|
153
|
+
return t8;
|
|
101
154
|
};
|
|
102
155
|
EditorContainer.displayName = "EditorContainer";
|
|
103
156
|
function _temp(current) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getStaticDocumentView } from "../../static/internal/staticDocumentView.js";
|
|
2
|
-
import { EditorStatic } from "../../static/components/
|
|
2
|
+
import { EditorStatic } from "../../static/components/EditorStatic.js";
|
|
3
3
|
import { writeStaticSelectionClipboardData } from "./writeStaticSelectionClipboardData.internal.js";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
@@ -130,8 +130,7 @@ const NonBreakingSpace = () => {
|
|
|
130
130
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
131
|
t1 = /* @__PURE__ */ React.createElement("span", {
|
|
132
132
|
style: t0,
|
|
133
|
-
contentEditable: false
|
|
134
|
-
"data-editor-inset": true
|
|
133
|
+
contentEditable: false
|
|
135
134
|
}, String.fromCodePoint(160));
|
|
136
135
|
$[1] = t1;
|
|
137
136
|
} else t1 = $[1];
|
|
@@ -157,7 +157,7 @@ const getStaticSelectionPayload = (editor, host) => {
|
|
|
157
157
|
const lastSlice = slices.at(-1);
|
|
158
158
|
if (!firstSlice || !lastSlice) return null;
|
|
159
159
|
const roots = {};
|
|
160
|
-
for (const slice of slices) for (const [root, children] of Object.entries(slice.roots ?? {})) roots[root]
|
|
160
|
+
for (const slice of slices) for (const [root, children] of Object.entries(slice.roots ?? {})) if (!Object.hasOwn(roots, root)) roots[root] = children;
|
|
161
161
|
const assembled = ContentSlice.fromJSON({
|
|
162
162
|
content: slices.flatMap((slice) => slice.content),
|
|
163
163
|
openEnd: lastSlice.openEnd,
|
package/dist/react/core.js
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
import "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { isNominalPluginDescriptor } from "../internal/utils/mergePlugins.js";
|
|
3
2
|
import { HtmlPlugin } from "../lib/plugins/html/HtmlPlugin.js";
|
|
4
3
|
import { DebugPlugin, EditorError } from "../lib/plugins/debug/DebugPlugin.js";
|
|
5
4
|
import { AffinityPlugin } from "../lib/plugins/affinity/AffinityPlugin.js";
|
|
6
|
-
import { ElementStatePlugin } from "../lib/plugins/element-state/ElementStatePlugin.js";
|
|
7
5
|
import { HistoryPlugin } from "../lib/plugins/HistoryPlugin.js";
|
|
8
6
|
import { inputRuleVeto } from "../lib/plugins/input-rules/inputRuleVeto.js";
|
|
9
7
|
import { BaseParagraphPlugin } from "../lib/plugins/paragraph/BaseParagraphPlugin.js";
|
|
10
8
|
import { TransferPlugin } from "../lib/plugins/TransferPlugin.js";
|
|
11
9
|
import { nanoid } from "../lib/libs/nanoid.js";
|
|
12
10
|
import { defineInputRule } from "../lib/plugins/input-rules/defineInputRule.js";
|
|
13
|
-
import { createBlockFenceInputRule,
|
|
11
|
+
import { createBlockFenceInputRule, createMarkInputRule, createTextSubstitutionInputRule, matchBlockStart, matchDelimitedInline } from "../lib/plugins/input-rules/createInputRules.js";
|
|
14
12
|
import { applyDeepToNodes } from "../lib/utils/applyDeepToNodes.js";
|
|
15
13
|
import { defaultsDeepToNodes } from "../lib/utils/defaultsDeepToNodes.js";
|
|
16
14
|
import { IS_APPLE } from "../lib/utils/environment.js";
|
|
17
15
|
import { getFragmentProp } from "../lib/utils/getFragmentProp.js";
|
|
18
16
|
import { getInjectMatch } from "../lib/utils/getInjectMatch.js";
|
|
19
|
-
import { Hotkeys, createHotkey, isHotkey } from "../lib/utils/hotkeys.js";
|
|
20
17
|
import { isDefined } from "../lib/utils/isDefined.js";
|
|
21
18
|
import { isUrl } from "../lib/utils/isUrl.js";
|
|
22
19
|
import { mergeDeepToNodes } from "../lib/utils/mergeDeepToNodes.js";
|
|
23
|
-
import { getPluginNodeClass
|
|
20
|
+
import { getPluginNodeClass } from "../lib/utils/pluginNodeClass.js";
|
|
24
21
|
import { PLUGINS } from "../utils/plate-keys.js";
|
|
25
|
-
import { ExitBreakPlugin } from "../utils/plugins/ExitBreakPlugin.js";
|
|
26
22
|
import { SingleBlockPlugin } from "../utils/plugins/SingleBlockPlugin.js";
|
|
27
23
|
import { SingleLinePlugin } from "../utils/plugins/SingleLinePlugin.js";
|
|
28
24
|
import { TrailingBlockPlugin } from "../utils/plugins/TrailingBlockPlugin.js";
|
|
29
|
-
import { ContentSlice, DocumentChange, EditorSchemaValidationError, ElementApi, LocationApi, NodeApi, PathApi, PluginPublicationError, PointApi, RangeApi, SelectionApi,
|
|
30
|
-
import { ReactUpdatePolicy, installBrowserHandle, react, useChildRoot,
|
|
25
|
+
import { ContentSlice, DocumentChange, EditorSchemaValidationError, ElementApi, LocationApi, NodeApi, PathApi, PluginPublicationError, PointApi, RangeApi, SelectionApi, TextApi, authoredVeto, createEditorView, defineCommand, defineEditorSchema, defineEffect, definePluginCompartment, definePluginPoint, defineStateField, defineUpdateAnnotation, documentReplacement, editorCommands, editorReads, getEditorRuntimeOwner, isEditor, locateAt, nodeWriteVeto, property, schema, screenReaderAnnouncementEffect, setDebugValueScrubber, setEditorReadOnly, setEditorViewing, target, transfer, transferVeto, txLocate, txOnly, txSelection, valueCodecs } from "../core.js";
|
|
26
|
+
import { ReactUpdatePolicy, installBrowserHandle, react, useChildRoot, useDropIndicator, useEditableClip, useEditorEditableElement, useEditorRootAreas, useEditorRootElement, useEditorScrollElement, useEditorScrollElementRef, useElementSelected, useRootChrome, useSelectionGeometry } from "./plite-react.js";
|
|
31
27
|
import { useComposedRef, useIsomorphicLayoutEffect } from "./internal/react-helpers.js";
|
|
32
28
|
import { useEditorSelector } from "./stores/plate/useEditorSelector.js";
|
|
33
|
-
import { useEditableRef, useEditor, useEditorComposing, useEditorContainerRef, useEditorFocused,
|
|
29
|
+
import { useEditableRef, useEditor, useEditorComposing, useEditorContainerRef, useEditorFocused, useEditorReadOnly, useModelEditor, useOptionalEditor, useRootEditor, useSetStateField, useStateFieldValue } from "./stores/plate/useEditor.js";
|
|
34
30
|
import { NodeSelectionDrag, NodeSelectionHighlight } from "./components/NodeSelection.js";
|
|
35
31
|
import { EditorRoot } from "./components/Plate.js";
|
|
36
32
|
import { EditorContainer } from "./components/PlateContainer.js";
|
|
@@ -38,7 +34,7 @@ import { useElement } from "./stores/element/useElement.js";
|
|
|
38
34
|
import { useElementSelector } from "./stores/element/useElementSelector.js";
|
|
39
35
|
import { usePath } from "./stores/element/usePath.js";
|
|
40
36
|
import { useEditorHistory } from "./stores/plate/useEditorHistory.js";
|
|
41
|
-
import {
|
|
37
|
+
import { usePluginStore } from "./stores/plate/usePluginStore.js";
|
|
42
38
|
import { useViewStore } from "./stores/plate/useViewStore.js";
|
|
43
39
|
import { useFocusedLast } from "./stores/plate-controller/useFocusedLast.js";
|
|
44
40
|
import { EditorPreview } from "./components/PlateView.js";
|
|
@@ -55,4 +51,4 @@ import { useCreateEditor } from "./editor/useCreateEditor.js";
|
|
|
55
51
|
import { BlockPlaceholderPlugin } from "./utils/BlockPlaceholderPlugin.js";
|
|
56
52
|
import { useSelectionFragmentProp } from "./utils/useSelectionFragment.js";
|
|
57
53
|
export * from "plitejs";
|
|
58
|
-
export { AffinityPlugin, BaseParagraphPlugin, BlockPlaceholderPlugin, ContentSlice, DebugPlugin, DocumentChange, EditorContainer, EditorContent, EditorController, EditorElement, EditorError, EditorLeaf, EditorPreview, EditorProvider, EditorRoot, EditorSchemaValidationError, EditorText, ElementApi,
|
|
54
|
+
export { AffinityPlugin, BaseParagraphPlugin, BlockPlaceholderPlugin, ContentSlice, DebugPlugin, DocumentChange, EditorContainer, EditorContent, EditorController, EditorElement, EditorError, EditorLeaf, EditorPreview, EditorProvider, EditorRoot, EditorSchemaValidationError, EditorText, ElementApi, HistoryPlugin, HtmlPlugin, IS_APPLE, LocationApi, NavigationFeedbackPlugin, NodeApi, NodeSelectionDrag, NodeSelectionHighlight, PLUGINS, ParagraphPlugin, PathApi, PluginPublicationError, PointApi, RangeApi, ReactUpdatePolicy, SelectionApi, SingleBlockPlugin, SingleLinePlugin, TextApi, TrailingBlockPlugin, TransferPlugin, applyDeepToNodes, authoredVeto, createBlockFenceInputRule, createEditor, createEditorView, createMarkInputRule, createTextSubstitutionInputRule, defaultsDeepToNodes, defineCommand, defineEditorSchema, defineEffect, defineInputRule, definePlugin, definePluginCompartment, definePluginPoint, defineStateField, defineUpdateAnnotation, documentReplacement, editorCommands, editorReads, getEditorRuntimeOwner, getFragmentProp, getInjectMatch, getPluginNodeClass, inputRuleVeto, installBrowserHandle, isDefined, isEditor, isUrl, locateAt, matchBlockStart, matchDelimitedInline, mergeDeepToNodes, nanoid, nodeWriteVeto, property, react, schema, screenReaderAnnouncementEffect, setDebugValueScrubber, setEditorReadOnly, setEditorViewing, target, toReactPlugin, transfer, transferVeto, txLocate, txOnly, txSelection, useChildRoot, useComposedRef, useCreateEditor, useDropIndicator, useEditableClip, useEditableRef, useEditor, useEditorComposing, useEditorContainerRef, useEditorEditableElement, useEditorFocused, useEditorHistory, useEditorReadOnly, useEditorRootAreas, useEditorRootElement, useEditorScrollElement, useEditorScrollElementRef, useEditorSelector, useElement, useElementSelected, useElementSelector, useFocusedLast, useIsomorphicLayoutEffect, useModelEditor, useOptionalEditor, usePath, usePluginStore, useRootChrome, useRootEditor, useSelectionFragmentProp, useSelectionGeometry, useSetStateField, useStateFieldValue, useViewStore, valueCodecs };
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { createEditorOwner } from "../../facade.js";
|
|
1
|
+
import { createEditorOwner, readEditorOptions } from "../../facade.js";
|
|
2
2
|
import { resolveEditorUserId } from "../../lib/editor/editorUser.internal.js";
|
|
3
|
-
import { assertEditorOptions, readConstructorOptions } from "../../lib/editor/withPlite.js";
|
|
4
3
|
import { useIsomorphicLayoutEffect } from "../internal/react-helpers.js";
|
|
5
|
-
import {
|
|
4
|
+
import { REACT_EDITOR_OPTION_KEYS, createDormantPlateEditor } from "./withPlate.js";
|
|
6
5
|
import React from "react";
|
|
7
6
|
//#region src/react/editor/useCreateEditor.ts
|
|
7
|
+
const HOOK_DEP_KEYS = {
|
|
8
|
+
id: true,
|
|
9
|
+
userId: true
|
|
10
|
+
};
|
|
8
11
|
function useCreateEditor(options = {}, deps = []) {
|
|
9
12
|
const hookOptions = options;
|
|
10
|
-
|
|
11
|
-
const {
|
|
13
|
+
const picked = readEditorOptions(hookOptions, REACT_EDITOR_OPTION_KEYS, { pick: HOOK_DEP_KEYS });
|
|
14
|
+
const { id, userId } = picked;
|
|
12
15
|
const userKey = resolveEditorUserId(userId);
|
|
13
16
|
const owner = React.useMemo(() => {
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
const rest = readEditorOptions(hookOptions, REACT_EDITOR_OPTION_KEYS, {
|
|
18
|
+
omit: HOOK_DEP_KEYS,
|
|
19
|
+
validated: true
|
|
20
|
+
});
|
|
16
21
|
return createEditorOwner(() => createDormantPlateEditor({
|
|
17
|
-
...
|
|
18
|
-
id,
|
|
19
|
-
plugins:
|
|
20
|
-
userId
|
|
21
|
-
}));
|
|
22
|
+
...rest,
|
|
23
|
+
..."id" in picked ? { id } : {},
|
|
24
|
+
plugins: rest.plugins ?? [],
|
|
25
|
+
..."userId" in picked ? { userId } : {}
|
|
26
|
+
}, true));
|
|
22
27
|
}, [
|
|
23
28
|
id,
|
|
24
29
|
userKey,
|
|
25
|
-
enabled,
|
|
26
30
|
...deps
|
|
27
31
|
]);
|
|
28
|
-
React.useInsertionEffect(() => owner
|
|
32
|
+
React.useInsertionEffect(() => owner.retire, [owner]);
|
|
29
33
|
useIsomorphicLayoutEffect(() => {
|
|
30
|
-
if (!owner) return void 0;
|
|
31
34
|
owner.startUnlessViewStarted();
|
|
32
35
|
owner.layoutConnected();
|
|
33
36
|
return owner.layoutDisconnected;
|
|
34
37
|
}, [owner]);
|
|
35
38
|
React.useEffect(() => {
|
|
36
|
-
if (!owner) return void 0;
|
|
37
39
|
owner.passiveConnected();
|
|
38
40
|
return owner.passiveDisconnected;
|
|
39
41
|
}, [owner]);
|
|
40
|
-
return owner
|
|
42
|
+
return owner.editor;
|
|
41
43
|
}
|
|
42
44
|
//#endregion
|
|
43
45
|
export { useCreateEditor };
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { readEditorOptions } from "../../facade.js";
|
|
2
|
+
import { EDITOR_OPTION_KEYS, buildEditor } from "../../lib/editor/withPlite.js";
|
|
3
|
+
import { getPlateCorePlugins } from "./getPlateCorePlugins.internal.js";
|
|
3
4
|
//#region src/react/editor/withPlate.ts
|
|
5
|
+
/** @internal */
|
|
4
6
|
const REACT_EDITOR_OPTION_KEYS = {
|
|
5
7
|
...EDITOR_OPTION_KEYS,
|
|
6
8
|
clipboardFormatKey: true
|
|
7
9
|
};
|
|
8
|
-
/** @internal */
|
|
9
|
-
const USE_CREATE_EDITOR_OPTION_KEYS = {
|
|
10
|
-
...REACT_EDITOR_OPTION_KEYS,
|
|
11
|
-
enabled: true
|
|
12
|
-
};
|
|
13
10
|
function createEditor(options = {}) {
|
|
14
11
|
return createPlateEditor(options, false);
|
|
15
12
|
}
|
|
16
13
|
/** @internal */
|
|
17
|
-
const createDormantPlateEditor = (options) => createPlateEditor(options, true);
|
|
18
|
-
const createPlateEditor = (options, dormant) => {
|
|
19
|
-
const { clipboardFormatKey, plugins = [], ...rest } =
|
|
14
|
+
const createDormantPlateEditor = (options, validated = false) => createPlateEditor(options, true, validated);
|
|
15
|
+
const createPlateEditor = (options, dormant, validated = false) => {
|
|
16
|
+
const { clipboardFormatKey, plugins = [], ...rest } = validated ? options : readEditorOptions(options, REACT_EDITOR_OPTION_KEYS);
|
|
20
17
|
const corePlugins = getPlateCorePlugins();
|
|
21
|
-
const basePlugins = clipboardFormatKey === void 0 ? corePlugins : [...corePlugins, ReactDOMPlugin.configure({ initialState: { clipboardFormatKey } })];
|
|
22
18
|
return buildEditor({
|
|
23
19
|
...rest,
|
|
24
|
-
|
|
20
|
+
clipboardFormatKey,
|
|
21
|
+
plugins: [...corePlugins, ...plugins]
|
|
25
22
|
}, dormant);
|
|
26
23
|
};
|
|
27
24
|
//#endregion
|
|
28
|
-
export {
|
|
25
|
+
export { REACT_EDITOR_OPTION_KEYS, createDormantPlateEditor, createEditor };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseFormattingPlugin } from "../../../features/basic-styles/lib/BaseFormattingPlugin.js";
|
|
2
|
-
import { BaseFontBackgroundColorPlugin, BaseFontColorPlugin, BaseFontFamilyPlugin, BaseFontSizePlugin, BaseLineHeightPlugin, BaseTextAlignPlugin
|
|
2
|
+
import { BaseFontBackgroundColorPlugin, BaseFontColorPlugin, BaseFontFamilyPlugin, BaseFontSizePlugin, BaseLineHeightPlugin, BaseTextAlignPlugin } from "../../../features/basic-styles/lib/BaseStylePlugins.js";
|
|
3
3
|
import { toReactPlugin } from "../../plugin/toReactPlugin.js";
|
|
4
4
|
//#region src/react/features/basic-styles/BasicStylePlugins.tsx
|
|
5
5
|
const FontBackgroundColorPlugin = toReactPlugin(BaseFontBackgroundColorPlugin);
|
|
@@ -8,8 +8,7 @@ const FontFamilyPlugin = toReactPlugin(BaseFontFamilyPlugin);
|
|
|
8
8
|
const FontSizePlugin = toReactPlugin(BaseFontSizePlugin);
|
|
9
9
|
const LineHeightPlugin = toReactPlugin(BaseLineHeightPlugin);
|
|
10
10
|
const TextAlignPlugin = toReactPlugin(BaseTextAlignPlugin);
|
|
11
|
-
const TextIndentPlugin = toReactPlugin(BaseTextIndentPlugin);
|
|
12
11
|
/** Clear formatting in React editors, bound to `Mod+\`. */
|
|
13
12
|
const FormattingPlugin = toReactPlugin(BaseFormattingPlugin, { shortcuts: { clear: { keys: ["mod+\\", "mod+backslash"] } } });
|
|
14
13
|
//#endregion
|
|
15
|
-
export { FontBackgroundColorPlugin, FontColorPlugin, FontFamilyPlugin, FontSizePlugin, FormattingPlugin, LineHeightPlugin, TextAlignPlugin
|
|
14
|
+
export { FontBackgroundColorPlugin, FontColorPlugin, FontFamilyPlugin, FontSizePlugin, FormattingPlugin, LineHeightPlugin, TextAlignPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toReactPlugin } from "../../plugin/toReactPlugin.js";
|
|
2
|
-
import { BaseBoardArrowPlugin } from "../../../features/board/lib/BaseBoardArrowPlugin.js";
|
|
3
2
|
import { BaseBoardFramePlugin } from "../../../features/board/lib/BaseBoardFramePlugin.js";
|
|
3
|
+
import { BaseBoardArrowPlugin } from "../../../features/board/lib/BaseBoardArrowPlugin.js";
|
|
4
4
|
import { BaseBoardGeoPlugin } from "../../../features/board/lib/BaseBoardGeoPlugin.js";
|
|
5
5
|
import { BaseBoardImagePlugin } from "../../../features/board/lib/BaseBoardImagePlugin.js";
|
|
6
6
|
import { BaseBoardNotePlugin } from "../../../features/board/lib/BaseBoardNotePlugin.js";
|