platejs 54.0.0-beta.12 → 54.0.0-beta.14
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/dist/{EditorStatic-DLn-Y0NA.d.ts → EditorStatic-eXOA489B.d.ts} +12 -11
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/lib/aiDraftSession.js +9 -7
- package/dist/ai/lib/aiPolicy.internal.js +43 -6
- package/dist/ai/lib/editorAgent.js +476 -563
- package/dist/ai/lib/editorAgentDispatcher.internal.js +205 -0
- package/dist/ai/lib/editorAgentPresence.internal.js +3 -2
- package/dist/ai/lib/editorAgentSync.internal.js +303 -0
- package/dist/ai/lib/lockedContext.js +5 -4
- package/dist/ai/lib/registerEditorTools.js +6 -3
- package/dist/ai/react/copilotInline.internal.js +6 -5
- package/dist/ai/react/index.d.ts +7 -7
- package/dist/ai/react/useEditorAgent.js +101 -41
- package/dist/authored/index.d.ts +4 -4
- package/dist/{authored-D-sIdWDF-BO8GVDW5.d.ts → authored-qetvpvU--DSWESzxK.d.ts} +3 -3
- package/dist/clipboard-format-key-BBu85J9m-BLhtd159.d.ts +1 -0
- package/dist/code-block/codemirror/index.d.ts +2 -2
- package/dist/{comment-anchor.internal-Qv9thB9E.d.ts → comment-anchor.internal-CoNK9gTD.d.ts} +2 -2
- package/dist/compiler/index.d.ts +3 -3
- package/dist/{core-BWS1N1EV.d.ts → core-By92GWYW.d.ts} +68 -23
- package/dist/diff/index.d.ts +2 -2
- package/dist/docs/agents/skills.md +26 -2
- package/dist/docs/agents.md +2 -2
- package/dist/docs/ai-agents.md +9 -5
- package/dist/docs/ai.md +81 -26
- package/dist/docs/api/core/plate-components.md +6 -2
- package/dist/docs/api/dom.md +5 -3
- package/dist/docs/api/plate.md +15 -7
- package/dist/docs/api/react-hooks.md +32 -2
- package/dist/docs/authored-changes.md +6 -2
- package/dist/docs/block-menu.md +3 -1
- package/dist/docs/board.md +4 -0
- package/dist/docs/callout.md +63 -13
- package/dist/docs/code-block.md +1 -1
- package/dist/docs/collaboration.md +6 -1
- package/dist/docs/column.md +2 -0
- package/dist/docs/combobox.md +9 -2
- package/dist/docs/comment.md +8 -3
- package/dist/docs/components/toolbar-buttons.md +1 -1
- package/dist/docs/copilot.md +4 -4
- package/dist/docs/deck.md +173 -0
- package/dist/docs/details.md +8 -4
- package/dist/docs/diff.md +5 -1
- package/dist/docs/discussion.md +6 -2
- package/dist/docs/dnd.md +4 -0
- package/dist/docs/docx.md +24 -15
- package/dist/docs/emoji.md +2 -2
- package/dist/docs/equation.md +9 -9
- package/dist/docs/examples/collaboration-example.md +4 -0
- package/dist/docs/examples/export.md +40 -34
- package/dist/docs/examples/merge.md +4 -0
- package/dist/docs/examples/version-history.md +4 -0
- package/dist/docs/external-text.md +1 -1
- package/dist/docs/field.md +4 -0
- package/dist/docs/find.md +13 -5
- package/dist/docs/footnote.md +21 -10
- package/dist/docs/format-painter.md +4 -4
- package/dist/docs/html.md +8 -3
- package/dist/docs/index.md +12 -10
- package/dist/docs/ink.md +7 -1
- package/dist/docs/installation/manual.md +2 -4
- package/dist/docs/installation/next.md +1 -3
- package/dist/docs/installation/plate-ui.md +8 -4
- package/dist/docs/installation/rsc.md +1 -1
- package/dist/docs/installation.md +4 -0
- package/dist/docs/link.md +4 -4
- package/dist/docs/llms.txt +3 -1
- package/dist/docs/lock.md +34 -2
- package/dist/docs/markdown.md +12 -7
- package/dist/docs/media.md +4 -4
- package/dist/docs/mention.md +5 -0
- package/dist/docs/pagination.md +4 -0
- package/dist/docs/prompt-editor.md +17 -1
- package/dist/docs/reference.md +192 -0
- package/dist/docs/roots.md +4 -0
- package/dist/docs/serializing.md +25 -2
- package/dist/docs/slash-command.md +58 -8
- package/dist/docs/static.md +29 -20
- package/dist/docs/suggestion.md +12 -4
- package/dist/docs/sync.md +16 -1
- package/dist/docs/table.md +36 -5
- package/dist/docs/text-align.md +3 -3
- package/dist/docs/toc.md +0 -4
- package/dist/docs/toolbar.md +4 -4
- package/dist/docs/unit-testing.md +33 -0
- package/dist/docs/upload.md +4 -0
- package/dist/docx/export/index.d.ts +7 -7
- package/dist/docx/export/lib/compileAst.js +334 -35
- package/dist/docx/export/lib/docxComments.js +26 -2
- package/dist/docx/export/lib/exportDocx.js +30 -30
- package/dist/docx/export/lib/mathOmml.js +16 -17
- package/dist/docx/export/lib/ooxmlBuilder.js +381 -227
- package/dist/docx/export/lib/outputSafety.js +9 -1
- package/dist/docx/export/lib/reviewProjection.js +99 -29
- package/dist/docx/export/lib/sourcePreservation.js +38 -51
- package/dist/docx/export/lib/wordStyles.js +23 -2
- package/dist/docx/html/cleanWordHtml.internal.js +112 -99
- package/dist/docx/{internal/domParser.js → html/domParser.internal.js} +1 -1
- package/dist/docx/import/index.d.ts +6 -6
- package/dist/docx/import/lib/docxComments.js +1 -1
- package/dist/docx/import/lib/importDocx.js +1216 -64
- package/dist/docx/import/lib/opcRelationships.js +11 -1
- package/dist/docx/import/lib/readWordDocument.js +675 -122
- package/dist/docx/import/lib/wordStyles.js +96 -36
- package/dist/docx/internal/abort.js +3 -3
- package/dist/docx/{export/lib → internal}/colors.js +1 -1
- package/dist/docx/internal/docxComments.js +1 -1
- package/dist/docx/internal/docxPackage.js +316 -28
- package/dist/docx/internal/packageParts.js +2 -2
- package/dist/docx/internal/readDocxNumbering.js +45 -22
- package/dist/docx/internal/reviewPart.js +50 -22
- package/dist/docx/internal/sourceEligibility.js +89 -16
- package/dist/docx/internal/wordMath.js +44 -39
- package/dist/docx/internal/xmlTree.js +27 -2
- package/dist/docx/internal/xmlWriter.js +1 -1
- package/dist/docx/paste/index.d.ts +4 -4
- package/dist/docx/paste/lib/WordPastePlugin.js +63 -71
- package/dist/dom/index.d.ts +1 -1
- package/dist/facade.js +3 -3
- package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +1 -1
- package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +61 -28
- package/dist/features/basic-styles/lib/BaseStylePlugins.js +68 -10
- package/dist/features/board/index.d.ts +1 -1
- package/dist/features/callout/index.d.ts +2 -160
- package/dist/features/callout/lib/BaseCalloutPlugin.js +109 -9
- package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +17 -7
- package/dist/features/column/index.d.ts +1 -1
- package/dist/features/column/lib/BaseColumnPlugin.js +163 -89
- package/dist/features/comments/BaseCommentsPlugin.js +80 -39
- package/dist/features/comments/comment-unresolved-index.internal.js +20 -10
- package/dist/features/comments/fitCommentBody.js +338 -0
- package/dist/features/comments/index.d.ts +3 -3
- package/dist/features/comments/index.js +2 -1
- package/dist/features/date/index.d.ts +3 -3
- package/dist/features/details/index.d.ts +3 -3
- package/dist/features/field/index.d.ts +1 -1
- package/dist/features/field/lib/BaseFieldPlugin.js +111 -53
- package/dist/features/field/lib/fieldCache.internal.js +9 -21
- package/dist/features/find/index.d.ts +7 -6
- package/dist/features/find/lib/BaseFindPlugin.js +226 -37
- package/dist/features/footnote/index.d.ts +4 -3
- package/dist/features/footnote/lib/BaseFootnotePlugin.js +48 -24
- package/dist/features/indent/lib/BaseIndentPlugin.js +23 -18
- package/dist/features/indent/lib/indentHtml.internal.js +30 -4
- package/dist/features/ink/index.d.ts +1 -1
- package/dist/features/link/lib/BaseLinkPlugin.js +5 -12
- package/dist/features/lint/index.d.ts +3 -3
- package/dist/features/list/lib/BaseListPlugin.js +7 -2
- package/dist/features/list/lib/listKeyboard.internal.js +7 -2
- package/dist/features/list/lib/listMarkdown.internal.js +23 -27
- package/dist/features/lock/index.d.ts +1 -1
- package/dist/features/lock/lib/BaseLockPlugin.js +40 -11
- package/dist/features/media/index.d.ts +1 -1
- package/dist/features/media/lib/image/BaseImagePlugin.js +27 -13
- package/dist/features/mention/index.d.ts +1 -1
- package/dist/features/reference/index.d.ts +236 -0
- package/dist/features/reference/index.js +2 -0
- package/dist/features/reference/lib/BaseReferencePlugin.js +589 -0
- package/dist/features/table/index.d.ts +2 -2
- package/dist/features/table/lib/BaseTablePlugin.js +3 -48
- package/dist/features/table/lib/internal/mutation.js +4 -2
- package/dist/features/table/lib/internal/paste.js +4 -3
- package/dist/features/toc/index.d.ts +1 -1
- package/dist/features/upload/index.d.ts +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/html/index.d.ts +4 -4
- package/dist/html/server/index.d.ts +2 -2
- package/dist/html/server/index.js +1 -1
- package/dist/html/server/serverCssParser.internal.js +17 -145
- package/dist/html/server/serverCssStyle.internal.js +16 -10
- package/dist/{htmlConversion-CSKHZpPj.d.ts → htmlConversion-CRnxMGw-.d.ts} +2 -2
- package/dist/{htmlTypes-BWVmZblT.d.ts → htmlTypes-3laowz-3.d.ts} +3 -3
- package/dist/hyperscript/index.d.ts +1 -1
- package/dist/{index-BcyYN0cZ.d.ts → index-B3VOCxNR.d.ts} +6 -8
- package/dist/{index-DgPZlAbx.d.ts → index-B9UlNijk.d.ts} +2 -2
- package/dist/{index-hWp8X22M.d.ts → index-BJPT0Tv_.d.ts} +11 -9
- package/dist/{index-BufRKKbx-D3xRkmBz.d.ts → index-BKPWmnLg-Bp_vItjr.d.ts} +1 -1
- package/dist/{index-BXvEAvgI.d.ts → index-BcD2RAB9.d.ts} +3 -3
- package/dist/{index-BnxfTW_D.d.ts → index-C5Xw3JDc.d.ts} +1 -1
- package/dist/{index-SOntT3DN.d.ts → index-CAshLTjV.d.ts} +103 -4
- package/dist/{index-YycKj5Rf.d.ts → index-CHlITvuq.d.ts} +7 -7
- package/dist/index-CKSwab_O.d.ts +1 -0
- package/dist/{index-Cov2Zhgo.d.ts → index-CRQoHk18.d.ts} +3 -3
- package/dist/index-CyY3O6c7.d.ts +3 -0
- package/dist/index-D8EGVCeT.d.ts +305 -0
- package/dist/{index-D0hlRs2L-CIw3VG6r.d.ts → index-DAKucat0--VOaL_NN.d.ts} +4 -4
- package/dist/{index-nO2mlsRF.d.ts → index-DCTRNYwy.d.ts} +2 -2
- package/dist/{index-Dsj3VBEr.d.ts → index-DQpHoxDX.d.ts} +1 -1
- package/dist/{index-BYUrsInt.d.ts → index-DTd1D-BF.d.ts} +3 -3
- package/dist/index-DUhUT9bV.d.ts +1 -0
- package/dist/{index-Cnj81Ocd.d.ts → index-DXm_v0Qq.d.ts} +3 -3
- package/dist/{index-Bwli-ZAF.d.ts → index-Djwcl0Ff.d.ts} +3 -3
- package/dist/{index-CsmfJqlG.d.ts → index-Dyw6BJx8.d.ts} +3 -3
- package/dist/{index-C_c8FQDA.d.ts → index-KG95XVaC.d.ts} +26 -5
- package/dist/{index-BwvwktHw-CcWHZqCi.d.ts → index-LEcSTRgn-BR_p4GVY.d.ts} +2 -2
- package/dist/{index-QhGbk8ma.d.ts → index-k-wvVxKl.d.ts} +2 -2
- package/dist/{index-BC79Ewsl.d.ts → index-s34W6hUI.d.ts} +5 -5
- package/dist/{index-DOdoRr4z.d.ts → index-wEkvA-wI.d.ts} +58 -31
- package/dist/index.d.ts +3 -3
- package/dist/internal/comments/comment-anchor.internal.js +4 -0
- package/dist/internal/plugin/conversionLaws.js +41 -13
- package/dist/internal/plugin/createPlateRuntimePlugins.js +5 -2
- package/dist/internal/plugin/endMatterPartition.js +28 -0
- package/dist/internal/plugin/plateRuntime.js +3 -1
- package/dist/internal/plugin/pluginDescriptorSnapshot.js +1 -0
- package/dist/internal/plugin/pluginInjectNodeProps.js +33 -5
- package/dist/internal/plugin/resolvePlugin.js +2 -1
- package/dist/internal/utils/urlPolicy.js +19 -2
- package/dist/lib/editor/withPlite.js +21 -31
- package/dist/lib/plugins/dom/DOMPlugin.js +14 -11
- package/dist/lib/plugins/html/HtmlPlugin.js +6 -3
- package/dist/lib/plugins/html/cssLexer.internal.js +399 -0
- package/dist/lib/plugins/html/cssSafety.internal.js +100 -0
- package/dist/lib/plugins/html/htmlAst.js +17 -2
- package/dist/lib/plugins/html/htmlConversion.js +8 -4
- package/dist/lib/plugins/html/htmlDecode.internal.js +3 -3
- package/dist/lib/plugins/html/htmlDom.js +3 -4
- package/dist/lib/plugins/html/htmlMatcher.internal.js +1 -1
- package/dist/lib/plugins/html/htmlRules.internal.js +8 -59
- package/dist/lib/plugins/html/htmlSafety.js +30 -24
- package/dist/lib/plugins/html/htmlSerialize.internal.js +17 -3
- package/dist/lib/plugins/html/htmlStyleInline.internal.js +680 -0
- package/dist/lib/plugins/html/htmlWhitespace.internal.js +1 -1
- package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +27 -1
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/lib/MarkdownPlugin.js +33 -37
- package/dist/markdown/lib/internal/markdownAttributes.js +18 -8
- package/dist/markdown/lib/internal/markdownDiagnostics.js +14 -3
- package/dist/markdown/lib/internal/markdownDocument.js +2 -2
- package/dist/markdown/lib/internal/markdownIntrinsics.js +1 -3
- package/dist/markdown/lib/internal/markdownLine.js +42 -28
- package/dist/markdown/lib/internal/markdownMappings.js +131 -19
- package/dist/markdown/lib/internal/markdownParse.js +40 -77
- package/dist/markdown/lib/internal/markdownRuntime.js +13 -8
- package/dist/markdown/lib/internal/markdownStream.js +10 -18
- package/dist/markdown/lib/internal/markdownTailHeal.js +69 -42
- package/dist/markdown/lib/serializer/convertNodesSerialize.js +10 -10
- package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +16 -1
- package/dist/markdown/lib/serializer/listToMdastTree.js +7 -6
- package/dist/math/index.d.ts +3 -3
- package/dist/math/react/index.d.ts +4 -4
- package/dist/migrations/index.d.ts +4 -4
- package/dist/migrations/migratePlateV54Urls.internal.js +63 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/react/index.d.ts +3 -3
- package/dist/plain-text.js +10 -4
- package/dist/{protocol-CikFZBQT-CkSt_wOg.d.ts → protocol-Cp9xayOe-0OSfTMnt.d.ts} +1 -1
- package/dist/react/authored/AuthoredReactPlugin.js +4 -3
- package/dist/react/authored/index.d.ts +12 -9
- package/dist/react/authored/useAuthored.js +57 -21
- package/dist/react/components/NodeSelection.js +6 -30
- package/dist/react/components/PlateView.js +7 -1
- package/dist/react/features/board/boardCamera.internal.js +1 -1
- package/dist/react/features/board/boardClipboard.internal.js +5 -8
- package/dist/react/features/board/boardGesture.internal.js +1 -1
- package/dist/react/features/board/boardKeys.internal.js +1 -1
- package/dist/react/features/board/boardLanding.internal.js +1 -1
- package/dist/react/features/board/index.d.ts +5 -5
- package/dist/react/features/callout/index.d.ts +93 -4
- package/dist/react/features/column/index.d.ts +172 -9
- package/dist/react/features/combobox/combobox.internal.js +35 -22
- package/dist/react/features/combobox/comboboxOwner.internal.js +29 -2
- package/dist/react/features/combobox/index.d.ts +8 -6
- package/dist/react/features/comments/index.d.ts +8 -8
- package/dist/react/features/comments/useCommentThreadIndex.js +23 -9
- 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/FieldPlugin.js +2 -2
- package/dist/react/features/field/index.d.ts +5 -5
- package/dist/react/features/footnote/index.d.ts +6 -6
- package/dist/react/features/format-painter/FormatPainterPlugin.js +31 -38
- package/dist/react/features/format-painter/index.d.ts +8 -8
- package/dist/react/features/ink/index.d.ts +5 -5
- package/dist/react/features/ink/inkCapture.internal.js +2 -1
- package/dist/react/features/ink/inkPick.internal.js +1 -0
- package/dist/react/features/lock/index.d.ts +5 -5
- package/dist/react/features/media/index.d.ts +5 -5
- package/dist/react/features/mention/index.d.ts +4 -4
- package/dist/react/features/resizable/Resizable.js +1 -1
- package/dist/react/features/table/TablePlugin.js +41 -28
- package/dist/react/features/table/index.d.ts +8 -8
- package/dist/react/features/table/measureTableColumnWidths.internal.js +5 -1
- package/dist/react/features/table/useTableControls.js +43 -21
- package/dist/react/features/table/useTableResize.js +24 -9
- package/dist/react/features/toc/index.d.ts +2 -2
- package/dist/react/features/upload/UploadPlugin.js +2 -2
- package/dist/react/features/upload/index.d.ts +5 -5
- package/dist/react/index.d.ts +6 -6
- package/dist/react/virtualized.d.ts +3 -3
- package/dist/refusal-CwFxNUf7-BLhtd159.d.ts +1 -0
- package/dist/{registerEditorTools-CyPL0VPh.d.ts → registerEditorTools-D_3hPpTx.d.ts} +135 -98
- package/dist/shared-room-26tNRhZE-BLhtd159.d.ts +1 -0
- package/dist/skills/plate/SKILL.md +4 -3
- package/dist/skills/plate/references/ai-and-agents.md +4 -4
- package/dist/skills/plate/references/pricing.md +3 -3
- package/dist/skills/plate/references/setup.md +6 -0
- package/dist/skills/plate/references/ui-and-sync.md +4 -2
- package/dist/{source-pnhMdrj3.d.ts → source-BW7JD_oS.d.ts} +5 -3
- package/dist/static/components/EditorStatic.js +60 -7
- package/dist/static/components/plite-nodes.js +0 -2
- package/dist/static/index.d.ts +23 -9
- package/dist/static/internal/staticDocumentView.js +72 -20
- package/dist/static/internal/staticPendingMedia.internal.js +30 -46
- package/dist/static/internal/staticPresentation.js +8 -17
- package/dist/static/internal/staticViewState.internal.js +47 -0
- package/dist/static/pipeRenderElementStatic.internal.js +0 -1
- package/dist/static/pluginRenderElementStatic.internal.js +0 -1
- package/dist/static/pluginRenderMarkStatic.internal.js +90 -0
- package/dist/static/renderStaticHtml.js +87 -36
- package/dist/{storage-Be0SAaPi-CAmIGvmd.d.ts → storage-C7xSH1I5-BJLoUfo9.d.ts} +2 -2
- package/dist/sync/cloudflare/index.d.ts +3 -3
- package/dist/sync/index.d.ts +5 -5
- package/dist/sync/index.js +2 -2
- package/dist/sync/postgres/index.d.ts +1 -1
- package/dist/sync/react/index.d.ts +12 -12
- package/dist/sync/server/index.d.ts +5 -5
- package/dist/tabbable/react/TabbableEffects.internal.js +7 -7
- package/dist/tabbable/react/index.d.ts +4 -4
- package/dist/testing/index.d.ts +3 -3
- package/dist/{transport-DhoWUkMZ-Dg4M_Ihs.d.ts → transport-B-ON68Y4-DCfT5-eN.d.ts} +1 -1
- package/dist/{tx-only-mEsamESa-Bzy5hDat.d.ts → tx-only-sIj7BcYh-BMFkGMuq.d.ts} +28 -2
- package/dist/utils/plate-keys.js +1 -0
- package/dist/{widths-Dlj60VjK.d.ts → widths-9NNziDRW.d.ts} +5 -5
- package/package.json +10 -7
- package/dist/clipboard-format-key-C8pLG2_c-D8fWV8GB.d.ts +0 -1
- package/dist/index-B3oYKAuz.d.ts +0 -1
- package/dist/index-BTjtVYbH.d.ts +0 -1
- package/dist/index-z7QR7V33.d.ts +0 -3
- package/dist/refusal-C6nSOIMX-D8fWV8GB.d.ts +0 -1
- package/dist/shared-room-BxXvrWve-D8fWV8GB.d.ts +0 -1
- package/dist/static/pluginRenderLeafStatic.internal.js +0 -82
- package/dist/static/pluginRenderTextStatic.internal.js +0 -83
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $o as Range,
|
|
2
|
-
import "./htmlTypes-
|
|
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-
|
|
4
|
-
import { o as Editor$2, st as BasePluginInput } from "./core-
|
|
1
|
+
import { $o as Range, Al as TransferPlugin, Cl as TransferIntent, El as TransferOutcome, Hc as StateFieldValueInput, O as DecorationAttributes, Oi as HistoryOutcome, Qa as Plugin, Sl as TransferInput, Wa as Path, Wl as Value, Xc as Text, Yi as NamedRootKey, _t as EditorDocumentValue, d as AnyEditor, fo as PluginDependencyContractReference, fs as RootKey, gi as Element$1, ja as NodeTarget, ma as NodeKey, mo as PluginDependencyReferenceFor, ti as EditorUpdatePolicy, tr as EditorSelectorDependencies, vl as TransferApi, yl as TransferCheck } from "./tx-only-sIj7BcYh-BMFkGMuq.js";
|
|
2
|
+
import "./htmlTypes-3laowz-3.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-B9UlNijk.js";
|
|
4
|
+
import { o as Editor$2, st as BasePluginInput } from "./core-By92GWYW.js";
|
|
5
5
|
import React$1, { CSSProperties, KeyboardEvent as KeyboardEvent$1, MouseEventHandler, ReactNode, Ref, RefObject, TextareaHTMLAttributes } from "react";
|
|
6
6
|
type DecorationSlice = Readonly<{
|
|
7
7
|
attributes: DecorationAttributes;
|
|
@@ -572,13 +572,14 @@ type EditorContentProps<TElement extends Element$1 = Element$1, TRoot extends Ro
|
|
|
572
572
|
*/
|
|
573
573
|
onPasteResult?: (result: EditablePasteResult) => void;
|
|
574
574
|
/**
|
|
575
|
-
* Called once after a primary
|
|
576
|
-
* text has its final text range: after the
|
|
577
|
-
* write of that press, such as a drag released outside
|
|
578
|
-
* click inside selected text that collapses it
|
|
579
|
-
*
|
|
580
|
-
*
|
|
581
|
-
*
|
|
575
|
+
* Called once after a primary pointer press (mouse, touch, or pen) that began
|
|
576
|
+
* on this editable's own text has its final text range: after the release's
|
|
577
|
+
* import and every later write of that press, such as a drag released outside
|
|
578
|
+
* the editable, a click inside selected text that collapses it, or a touch
|
|
579
|
+
* long-press word selection. Not called for a press on a control, an external
|
|
580
|
+
* text host or a nested editor, for a cancelled scroll or pinch, when the
|
|
581
|
+
* press ends in a node selection, or when a key other than a modifier, a
|
|
582
|
+
* composition, a native drag, a blur, another press or an unmount comes
|
|
582
583
|
* first.
|
|
583
584
|
*/
|
|
584
585
|
onPointerSelectionEnd?: EditablePointerSelectionEndHandler;
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { AILockedBlockRef, EditorAgent, EditorAgentAccess, EditorAgentExecuteOptions, EditorAgentOptions, EditorAgentPresence, EditorAgentPresenceState, EditorCommentEntry, EditorCommentsListResult, EditorDebugResult, EditorFindResult, EditorIdempotencyEntry, EditorIdempotencyStore, EditorInkPassage, EditorInkPassageImage, EditorReadBlock, EditorReadInkResult, EditorReadResult, EditorReadSelection, EditorSuggestionsListResult, EditorToolAnnotation, EditorToolCall, EditorToolDefinition, EditorToolErrorCode, EditorToolErrorResult, EditorToolResult, EditorVisibilityFilter, EditorWriteReceipt, GetEditorToolsOptions, HasEditableAISelectionRefs, LOCKED_BLOCK_PLACEHOLDER_TAG, RegisterEditorToolsOptions, SerializeAIEditContextOptions, SerializeAISelectionMarkdownOptions, SerializedAIEditContext, SyncServerAgentGrant, SyncServerAgentHost, SyncServerAgentOptions, SyncServerAgentPresenceInput, SyncServerAgentPresenceOptions, SyncServerAgentPresencePoint, SyncServerAgentPresenceSelection, SyncServerAgentReceipt, SyncServerAgentRunResult, WebMCPProducerContext, createEditorAgent, createSyncServerAgent, getEditorTools, hasEditableAISelection, registerEditorTools, serializeAIEditContext, serializeAISelectionMarkdown };
|
|
1
|
+
import { $ as SyncServerAgentPresencePoint, A as EditorReadBlock, B as EditorToolResult, C as EditorCommentsListResult, D as EditorIdempotencyStore, E as EditorIdempotencyEntry, F as EditorToolAnnotation, G as createEditorAgent, H as EditorVisibilityPredicate, I as EditorToolCall, J as SyncServerAgentGrant, K as createSyncServerAgent, L as EditorToolDefinition, M as EditorReadResult, N as EditorReadSelection, O as EditorInkPassage, P as EditorSuggestionsListResult, Q as SyncServerAgentPresenceOptions, R as EditorToolErrorCode, S as EditorCommentThreadItem, T as EditorFindResult, U as EditorWriteReceipt, V as EditorVisibilityFilter, W as GetEditorToolsOptions, X as SyncServerAgentOptions, Y as SyncServerAgentHost, Z as SyncServerAgentPresenceInput, _ as EditorAgentPresence, a as HasEditableAISelectionRefs, b as EditorCommentAction, c as SerializeAISelectionMarkdownOptions, d as serializeAIEditContext, et as SyncServerAgentPresenceSelection, f as serializeAISelectionMarkdown, g as EditorAgentOptions, h as EditorAgentExecuteOptions, i as AILockedBlockRef, j as EditorReadInkResult, k as EditorInkPassageImage, l as SerializedAIEditContext, m as EditorAgentAccess, n as WebMCPProducerContext, nt as SyncServerAgentRunResult, o as LOCKED_BLOCK_PLACEHOLDER_TAG, p as EditorAgent, q as getEditorTools, r as registerEditorTools, s as SerializeAIEditContextOptions, t as RegisterEditorToolsOptions, tt as SyncServerAgentReceipt, u as hasEditableAISelection, v as EditorAgentPresenceState, w as EditorDebugResult, x as EditorCommentEntry, y as EditorAgentTraceEvent, z as EditorToolErrorResult } from "../registerEditorTools-D_3hPpTx.js";
|
|
2
|
+
export { AILockedBlockRef, EditorAgent, EditorAgentAccess, EditorAgentExecuteOptions, EditorAgentOptions, EditorAgentPresence, EditorAgentPresenceState, EditorAgentTraceEvent, EditorCommentAction, EditorCommentEntry, EditorCommentThreadItem, EditorCommentsListResult, EditorDebugResult, EditorFindResult, EditorIdempotencyEntry, EditorIdempotencyStore, EditorInkPassage, EditorInkPassageImage, EditorReadBlock, EditorReadInkResult, EditorReadResult, EditorReadSelection, EditorSuggestionsListResult, EditorToolAnnotation, EditorToolCall, EditorToolDefinition, EditorToolErrorCode, EditorToolErrorResult, EditorToolResult, EditorVisibilityFilter, EditorVisibilityPredicate, EditorWriteReceipt, GetEditorToolsOptions, HasEditableAISelectionRefs, LOCKED_BLOCK_PLACEHOLDER_TAG, RegisterEditorToolsOptions, SerializeAIEditContextOptions, SerializeAISelectionMarkdownOptions, SerializedAIEditContext, type SyncServerAgentGrant, type SyncServerAgentHost, type SyncServerAgentOptions, type SyncServerAgentPresenceInput, type SyncServerAgentPresenceOptions, type SyncServerAgentPresencePoint, type SyncServerAgentPresenceSelection, type SyncServerAgentReceipt, type SyncServerAgentRunResult, WebMCPProducerContext, createEditorAgent, createSyncServerAgent, getEditorTools, hasEditableAISelection, registerEditorTools, serializeAIEditContext, serializeAISelectionMarkdown };
|
|
@@ -5,7 +5,7 @@ import { isListItem } from "../../features/list/lib/listIndex.internal.js";
|
|
|
5
5
|
import { AuthoredPlugin } from "../../authored/AuthoredPlugin.js";
|
|
6
6
|
import { MarkdownPlugin } from "../../markdown/lib/MarkdownPlugin.js";
|
|
7
7
|
import { applyMinimalTextBlockEdits, fillEmptyListItem, landAIOutput, normalizeUnlockedListRun, suggestionBlocks } from "./aiOutputLanding.internal.js";
|
|
8
|
-
import { findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isPathVisible, isRangeVisible, pruneHiddenDescendants, sanitizeRemoteMediaNodes } from "./aiPolicy.internal.js";
|
|
8
|
+
import { findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isEditorVisibilityFilter, isPathVisible, isRangeVisible, pruneHiddenDescendants, resolveVisibilityFilter, sanitizeRemoteMediaNodes } from "./aiPolicy.internal.js";
|
|
9
9
|
import { areAIBlockTargetsContiguous, isAIPathNonWritable, resolveAISelectedBlocks } from "./lockedContext.internal.js";
|
|
10
10
|
import { LOCKED_BLOCK_PLACEHOLDER_TAG } from "./lockedContext.js";
|
|
11
11
|
import isEqual from "lodash/isEqual.js";
|
|
@@ -85,9 +85,10 @@ const toElementValue = (nodes) => nodes.filter((node) => ElementApi.isElement(no
|
|
|
85
85
|
*/
|
|
86
86
|
const createAIDraftSession = (editor, options) => {
|
|
87
87
|
if (typeof options.authorId !== "string" || options.authorId.trim().length === 0) throw new TypeError("createAIDraftSession requires a non-empty authorId.");
|
|
88
|
-
if (options.filter
|
|
88
|
+
if (!isEditorVisibilityFilter(options.filter)) throw new TypeError("createAIDraftSession requires filter to be \"allow-all\", a function, or { forDocument }.");
|
|
89
89
|
const { authorId } = options;
|
|
90
90
|
const { filter } = options;
|
|
91
|
+
const currentFilter = (target = editor) => resolveVisibilityFilter(target, filter);
|
|
91
92
|
const { mode } = options;
|
|
92
93
|
const pinnedRoot = editor.read.view.root();
|
|
93
94
|
const baselineRevision = editor.read.revision();
|
|
@@ -95,8 +96,9 @@ const createAIDraftSession = (editor, options) => {
|
|
|
95
96
|
const capturedSelection = currentSelection ? cloneDeep(currentSelection) : null;
|
|
96
97
|
const resolvedSelection = resolveAISelectedBlocks(editor);
|
|
97
98
|
const initialRoots = editor.read.value().roots;
|
|
98
|
-
const
|
|
99
|
-
const
|
|
99
|
+
const initialFilter = currentFilter(editor);
|
|
100
|
+
const selectionContainsHiddenBlocks = resolvedSelection.entries.some(([node, path]) => !isPathVisible(editor, initialFilter, path, pinnedRoot) || hasHiddenDescendant(initialFilter, node, path, pinnedRoot, initialRoots));
|
|
101
|
+
const visibleEntries = resolvedSelection.entries.filter(([node, path]) => isPathVisible(editor, initialFilter, path, pinnedRoot) && pruneHiddenDescendants(initialFilter, node, path, pinnedRoot) !== null);
|
|
100
102
|
const selectionAnchor = capturedSelection && RangeApi.isExpanded(capturedSelection) ? editor.anchor(capturedSelection, {
|
|
101
103
|
association: "inward",
|
|
102
104
|
deletion: "drop"
|
|
@@ -333,7 +335,7 @@ const createAIDraftSession = (editor, options) => {
|
|
|
333
335
|
};
|
|
334
336
|
const hasHiddenEditableTarget = (entries) => {
|
|
335
337
|
const { roots } = editor.read.value();
|
|
336
|
-
return selectionContainsHiddenBlocks || entries.some(([node, path]) => hasHiddenDescendant(
|
|
338
|
+
return selectionContainsHiddenBlocks || entries.some(([node, path]) => hasHiddenDescendant(currentFilter(editor), node, path, pinnedRoot, roots));
|
|
337
339
|
};
|
|
338
340
|
const isRevisionCurrent = () => isTargetAnchorCurrent(getRootView());
|
|
339
341
|
const landLockedSuggestion = (proposeView, rawDisallowedUrls) => {
|
|
@@ -799,7 +801,7 @@ const createAIDraftSession = (editor, options) => {
|
|
|
799
801
|
const wasTargetAnchorCurrent = isTargetAnchorCurrent();
|
|
800
802
|
const cellEntry = proposeView.read.nodes.get(cellKey, { match: ElementApi.isElement });
|
|
801
803
|
if (!cellEntry || !isPathVisible(proposeView, filter, cellEntry[1], pinnedRoot)) return Object.freeze({ status: "stale" });
|
|
802
|
-
if (hasHiddenDescendant(
|
|
804
|
+
if (hasHiddenDescendant(currentFilter(proposeView), cellEntry[0], cellEntry[1], pinnedRoot, editor.read.value().roots)) return Object.freeze({
|
|
803
805
|
refusal: {
|
|
804
806
|
reason: "hidden-content",
|
|
805
807
|
ref: record.ref
|
|
@@ -904,7 +906,7 @@ const createAIDraftSession = (editor, options) => {
|
|
|
904
906
|
const segments = [];
|
|
905
907
|
let flat = "";
|
|
906
908
|
const appendBlockTexts = (node, blockPath, clipStart, clipEnd) => {
|
|
907
|
-
if (!pruneHiddenDescendants(
|
|
909
|
+
if (!pruneHiddenDescendants(currentFilter(rootView), node, blockPath, pinnedRoot)) return;
|
|
908
910
|
let addedAny = false;
|
|
909
911
|
for (const [textNode, relPath] of NodeApi.texts(node)) {
|
|
910
912
|
const leafPath = [...blockPath, ...relPath];
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { PLUGINS } from "../../utils/plate-keys.js";
|
|
2
2
|
import { ElementApi, SelectionApi, TextApi, createEditorView } from "../../core.js";
|
|
3
3
|
//#region src/ai/lib/aiPolicy.internal.ts
|
|
4
|
+
const visibilityFilterCache = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
/**
|
|
6
|
+
* Validate that `value` is a supported `EditorVisibilityFilter` (`'allow-all'`,
|
|
7
|
+
* a per-block predicate, or `{ forDocument }`).
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const isEditorVisibilityFilter = (value) => value === "allow-all" || typeof value === "function" || typeof value === "object" && value !== null && typeof value.forDocument === "function";
|
|
12
|
+
/**
|
|
13
|
+
* Compile a document-scoped `{ forDocument }` visibility filter once per stored
|
|
14
|
+
* document revision and cache the resulting predicate per `(filter, editor)`.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
const resolveVisibilityFilter = (editor, filter) => {
|
|
19
|
+
if (filter === "allow-all" || typeof filter === "function") return filter;
|
|
20
|
+
const revision = editor.read.revision();
|
|
21
|
+
let perEditor = visibilityFilterCache.get(filter);
|
|
22
|
+
const cached = perEditor?.get(editor);
|
|
23
|
+
if (cached && cached.revision === revision) return cached.predicate;
|
|
24
|
+
const predicate = filter.forDocument(editor.read.value());
|
|
25
|
+
if (typeof predicate !== "function") throw new TypeError("EditorVisibilityFilter.forDocument must return a predicate function.");
|
|
26
|
+
if (!perEditor) {
|
|
27
|
+
perEditor = /* @__PURE__ */ new WeakMap();
|
|
28
|
+
visibilityFilterCache.set(filter, perEditor);
|
|
29
|
+
}
|
|
30
|
+
perEditor.set(editor, {
|
|
31
|
+
predicate,
|
|
32
|
+
revision
|
|
33
|
+
});
|
|
34
|
+
return predicate;
|
|
35
|
+
};
|
|
4
36
|
const REMOTE_URL_SCHEME_RE = /^(?:https?:|[/\\]{2})/i;
|
|
5
37
|
const REMOTE_URL_BASE = "https://editor.invalid";
|
|
6
38
|
const stripControlChars = (input) => {
|
|
@@ -56,10 +88,12 @@ const isElementAllowed = (filter, block, path, root) => {
|
|
|
56
88
|
*/
|
|
57
89
|
const isPathVisible = (editor, filter, path, root) => {
|
|
58
90
|
if (filter === "allow-all") return true;
|
|
91
|
+
const resolved = resolveVisibilityFilter(editor, filter);
|
|
92
|
+
if (resolved === "allow-all") return true;
|
|
59
93
|
for (let depth = 1; depth <= path.length; depth += 1) {
|
|
60
94
|
const ancestorPath = path.slice(0, depth);
|
|
61
95
|
const entry = editor.read.nodes.get(ancestorPath, { match: ElementApi.isElement });
|
|
62
|
-
if (entry && !isElementAllowed(
|
|
96
|
+
if (entry && !isElementAllowed(resolved, entry[0], entry[1], root)) return false;
|
|
63
97
|
}
|
|
64
98
|
return true;
|
|
65
99
|
};
|
|
@@ -158,12 +192,14 @@ const isRangeVisible = (editor, filter, range, root) => {
|
|
|
158
192
|
path: range.focus.path
|
|
159
193
|
}
|
|
160
194
|
};
|
|
161
|
-
|
|
162
|
-
if (
|
|
195
|
+
const resolved = resolveVisibilityFilter(editor, filter);
|
|
196
|
+
if (resolved === "allow-all") return true;
|
|
197
|
+
if (!isPathVisible(view, resolved, localRange.anchor.path, rangeRoot)) return false;
|
|
198
|
+
if (!isPathVisible(view, resolved, localRange.focus.path, rangeRoot)) return false;
|
|
163
199
|
for (const [node, path] of view.read.nodes.entries({
|
|
164
200
|
at: localRange,
|
|
165
201
|
match: ElementApi.isElement
|
|
166
|
-
})) if (!isElementAllowed(
|
|
202
|
+
})) if (!isElementAllowed(resolved, node, path, rangeRoot)) return false;
|
|
167
203
|
return true;
|
|
168
204
|
};
|
|
169
205
|
const hasChildRootRefs = (items) => {
|
|
@@ -187,6 +223,7 @@ const buildFilteredSerializeDocument = (editor, nodes, filter, options) => {
|
|
|
187
223
|
const needsRoots = hasChildRootRefs(nodes);
|
|
188
224
|
if (!includeRecords && !needsRoots) return { children: [...nodes] };
|
|
189
225
|
const value = editor.read.value();
|
|
226
|
+
const resolved = resolveVisibilityFilter(editor, filter);
|
|
190
227
|
const root = editor.read.view.root();
|
|
191
228
|
let roots;
|
|
192
229
|
if (needsRoots && value.roots) {
|
|
@@ -215,7 +252,7 @@ const buildFilteredSerializeDocument = (editor, nodes, filter, options) => {
|
|
|
215
252
|
for (let index = 0; index < rootNodes.length; index += 1) {
|
|
216
253
|
const child = rootNodes[index];
|
|
217
254
|
if (!child || !ElementApi.isElement(child)) continue;
|
|
218
|
-
const pruned = pruneHiddenDescendants(
|
|
255
|
+
const pruned = pruneHiddenDescendants(resolved, child, [index], key);
|
|
219
256
|
if (pruned) filteredRootNodes.push(pruned);
|
|
220
257
|
}
|
|
221
258
|
roots ??= {};
|
|
@@ -399,4 +436,4 @@ const sanitizeRemoteMediaNodes = (nodes, allowRemoteMediaUrl) => {
|
|
|
399
436
|
};
|
|
400
437
|
};
|
|
401
438
|
//#endregion
|
|
402
|
-
export { buildFilteredSerializeDocument, findDisallowedRemoteMediaUrls, findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isElementAllowed, isPathVisible, isRangeVisible, isRemoteMediaUrl, pruneHiddenDescendants, sanitizeRemoteMediaNodes };
|
|
439
|
+
export { buildFilteredSerializeDocument, findDisallowedRemoteMediaUrls, findDisallowedRemoteMediaUrlsInMarkdown, hasHiddenDescendant, isEditorVisibilityFilter, isElementAllowed, isPathVisible, isRangeVisible, isRemoteMediaUrl, pruneHiddenDescendants, resolveVisibilityFilter, sanitizeRemoteMediaNodes };
|