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.
Files changed (586) hide show
  1. package/THIRD_PARTY_NOTICES.md +0 -28
  2. package/dist/EditorStatic-BKBBZZn8.d.ts +771 -0
  3. package/dist/ai/index.d.ts +2 -40
  4. package/dist/ai/index.js +4 -2
  5. package/dist/ai/lib/aiDraftSession.js +984 -0
  6. package/dist/ai/{react → lib}/aiOutputLanding.internal.js +76 -97
  7. package/dist/ai/lib/aiPolicy.internal.js +403 -0
  8. package/dist/ai/lib/editorAgent.js +1696 -0
  9. package/dist/ai/lib/lockedContext.internal.js +26 -1
  10. package/dist/ai/lib/lockedContext.js +122 -30
  11. package/dist/ai/lib/registerEditorTools.js +235 -0
  12. package/dist/ai/react/AIPlugin.js +246 -0
  13. package/dist/ai/react/CopilotPlugin.js +317 -199
  14. package/dist/ai/react/copilotInline.internal.js +358 -0
  15. package/dist/ai/react/index.d.ts +200 -821
  16. package/dist/ai/react/index.js +3 -3
  17. package/dist/ai/react/useEditorAgent.js +193 -0
  18. package/dist/authored/AuthoredPlugin.js +34 -2
  19. package/dist/authored/index.d.ts +5 -4
  20. package/dist/authored/index.js +3 -2
  21. package/dist/{features/suggestion → authored}/suggestionColorOf.js +4 -4
  22. package/dist/{index-BeyI3RUg.d.ts → authored-BQAGqGhS-DN3sw1OP.d.ts} +62 -39
  23. package/dist/clipboard-format-key-CWuwPPe2-BJGVrNlz.d.ts +1 -0
  24. package/dist/code-block/codemirror/createCodeMirrorAdapter.js +224 -58
  25. package/dist/code-block/codemirror/index.d.ts +2 -1
  26. package/dist/comment-anchor.internal-L2GsNCIh.d.ts +28 -0
  27. package/dist/compiler/index.d.ts +9 -3
  28. package/dist/compiler/index.js +3 -1
  29. package/dist/{core-D8i_gkA6.d.ts → core-N8rIvQxS.d.ts} +2171 -2000
  30. package/dist/core.js +4 -8
  31. package/dist/diff/index.d.ts +2 -2
  32. package/dist/docs/ai.md +475 -387
  33. package/dist/docs/api/anchor.md +1 -1
  34. package/dist/docs/api/core/plate-components.md +12 -3
  35. package/dist/docs/api/core/plate-editor.md +1 -1
  36. package/dist/docs/api/core/plate-plugin.md +33 -21
  37. package/dist/docs/api/core/plate-store.md +14 -13
  38. package/dist/docs/api/core.md +62 -91
  39. package/dist/docs/api/document-change.md +24 -20
  40. package/dist/docs/api/dom.md +66 -102
  41. package/dist/docs/api/editor-api.md +74 -42
  42. package/dist/docs/api/editor-transforms.md +17 -39
  43. package/dist/docs/api/location.md +5 -12
  44. package/dist/docs/api/plate.md +2 -2
  45. package/dist/docs/api/react-hooks.md +108 -49
  46. package/dist/docs/api/selection.md +10 -2
  47. package/dist/docs/api/utils.md +14 -14
  48. package/dist/docs/authored-changes.md +32 -30
  49. package/dist/docs/autoformat.md +4 -1
  50. package/dist/docs/basic-marks.md +0 -1
  51. package/dist/docs/block-menu.md +2 -3
  52. package/dist/docs/block-placeholder.md +2 -3
  53. package/dist/docs/board.md +23 -20
  54. package/dist/docs/clear-formatting.md +4 -4
  55. package/dist/docs/clipboard.md +25 -18
  56. package/dist/docs/code-block.md +62 -40
  57. package/dist/docs/column.md +28 -15
  58. package/dist/docs/combobox.md +36 -51
  59. package/dist/docs/comment.md +171 -141
  60. package/dist/docs/controlled.md +5 -7
  61. package/dist/docs/copilot.md +183 -148
  62. package/dist/docs/debugging.md +5 -14
  63. package/dist/docs/discussion.md +34 -28
  64. package/dist/docs/dnd.md +7 -6
  65. package/dist/docs/document-meta.md +27 -28
  66. package/dist/docs/document-model.md +9 -8
  67. package/dist/docs/docx.md +63 -116
  68. package/dist/docs/editor.md +59 -95
  69. package/dist/docs/emoji.md +4 -5
  70. package/dist/docs/equation.md +4 -4
  71. package/dist/docs/examples/collaboration-example.md +15 -30
  72. package/dist/docs/examples/export.md +10 -9
  73. package/dist/docs/examples/version-history.md +7 -6
  74. package/dist/docs/exit-break.md +32 -59
  75. package/dist/docs/external-text.md +28 -15
  76. package/dist/docs/field.md +3 -3
  77. package/dist/docs/find.md +70 -102
  78. package/dist/docs/footnote.md +40 -80
  79. package/dist/docs/format-painter.md +1 -1
  80. package/dist/docs/history.md +49 -63
  81. package/dist/docs/html.md +59 -28
  82. package/dist/docs/indent.md +39 -29
  83. package/dist/docs/ink.md +29 -12
  84. package/dist/docs/installation/docs.md +10 -0
  85. package/dist/docs/installation/node.md +12 -8
  86. package/dist/docs/installation/plate-ui.md +12 -7
  87. package/dist/docs/line-height.md +1 -1
  88. package/dist/docs/link.md +95 -98
  89. package/dist/docs/list.md +62 -54
  90. package/dist/docs/llms.txt +11 -9
  91. package/dist/docs/lock.md +28 -21
  92. package/dist/docs/markdown.md +118 -120
  93. package/dist/docs/media.md +31 -31
  94. package/dist/docs/mention.md +6 -9
  95. package/dist/docs/multi-select.md +17 -9
  96. package/dist/docs/pagination.md +144 -127
  97. package/dist/docs/performance.md +2 -2
  98. package/dist/docs/plugin-context.md +9 -8
  99. package/dist/docs/plugin-input-rules.md +84 -125
  100. package/dist/docs/plugin-methods.md +11 -9
  101. package/dist/docs/plugin-rules.md +11 -35
  102. package/dist/docs/plugin-shortcuts.md +1 -1
  103. package/dist/docs/plugin.md +53 -2
  104. package/dist/docs/prompt-editor.md +0 -1
  105. package/dist/docs/roots.md +2 -3
  106. package/dist/docs/schema.md +12 -3
  107. package/dist/docs/selection.md +3 -1
  108. package/dist/docs/serializing.md +9 -8
  109. package/dist/docs/slash-command.md +4 -4
  110. package/dist/docs/static.md +11 -5
  111. package/dist/docs/suggestion.md +51 -71
  112. package/dist/docs/sync.md +256 -0
  113. package/dist/docs/table.md +35 -20
  114. package/dist/docs/text-align.md +4 -4
  115. package/dist/docs/toolbar.md +26 -5
  116. package/dist/docs/trailing-block.md +18 -45
  117. package/dist/docs/underline.md +2 -2
  118. package/dist/docs/unit-testing.md +1 -1
  119. package/dist/docs/upload.md +71 -36
  120. package/dist/docx/export/index.d.ts +152 -56
  121. package/dist/docx/export/lib/colors.js +268 -0
  122. package/dist/docx/export/lib/compileAst.js +1825 -0
  123. package/dist/docx/export/lib/exportDocx.js +57 -159
  124. package/dist/docx/export/lib/mathOmml.js +233 -0
  125. package/dist/docx/export/lib/ooxmlBuilder.js +1759 -0
  126. package/dist/docx/export/lib/outputSafety.js +155 -82
  127. package/dist/docx/export/lib/reviewProjection.js +31 -202
  128. package/dist/docx/export/lib/sourcePreservation.js +133 -73
  129. package/dist/docx/export/lib/wordStyles.js +399 -0
  130. package/dist/docx/import/index.d.ts +4 -4
  131. package/dist/docx/import/lib/importDocx.js +1401 -1062
  132. package/dist/docx/import/lib/opcRelationships.js +77 -0
  133. package/dist/docx/import/lib/readWordDocument.js +990 -0
  134. package/dist/docx/import/lib/wordStyles.js +534 -0
  135. package/dist/docx/internal/diagnostics.js +67 -0
  136. package/dist/docx/internal/docxPackage.js +20 -44
  137. package/dist/docx/internal/domParser.js +2 -21
  138. package/dist/docx/internal/packageParts.js +15 -16
  139. package/dist/docx/internal/readDocxNumbering.js +35 -38
  140. package/dist/docx/internal/reviewPart.js +22 -21
  141. package/dist/docx/internal/sourceEligibility.js +87 -30
  142. package/dist/docx/internal/wordMath.js +102 -137
  143. package/dist/docx/internal/xmlTree.js +262 -0
  144. package/dist/docx/internal/xmlWriter.js +44 -0
  145. package/dist/docx/paste/index.d.ts +4 -4
  146. package/dist/docx/paste/lib/WordPastePlugin.js +12 -11
  147. package/dist/dom/index.d.ts +2 -2
  148. package/dist/dom/index.js +2 -2
  149. package/dist/dom/plite-dom.internal.js +2 -2
  150. package/dist/excalidraw/index.d.ts +6 -4
  151. package/dist/excalidraw/lib/BaseExcalidrawPlugin.js +19 -7
  152. package/dist/excalidraw/react/index.d.ts +6 -4
  153. package/dist/facade.js +3 -3
  154. package/dist/features/basic-nodes/lib/BaseBlockPlugins.js +31 -11
  155. package/dist/features/basic-nodes/lib/BaseHeadingPlugins.js +19 -1
  156. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +95 -69
  157. package/dist/features/basic-styles/lib/BaseStylePlugins.js +79 -82
  158. package/dist/features/board/index.d.ts +2 -2
  159. package/dist/features/board/index.js +2 -2
  160. package/dist/features/board/lib/BaseBoardArrowPlugin.js +90 -87
  161. package/dist/features/board/lib/BaseBoardFramePlugin.js +7 -7
  162. package/dist/features/board/lib/BaseBoardGeoPlugin.js +3 -2
  163. package/dist/features/board/lib/BaseBoardImagePlugin.js +9 -6
  164. package/dist/features/board/lib/BaseBoardNotePlugin.js +3 -2
  165. package/dist/features/board/lib/BaseBoardPlugin.js +368 -283
  166. package/dist/features/board/lib/BaseBoardStrokePlugin.js +8 -5
  167. package/dist/features/board/lib/BaseBoardTextPlugin.js +3 -2
  168. package/dist/features/board/lib/boardArrow.internal.js +2 -2
  169. package/dist/features/board/lib/boardCopy.internal.js +42 -36
  170. package/dist/features/board/lib/boardFrame.internal.js +5 -7
  171. package/dist/features/board/lib/boardGeometry.internal.js +124 -0
  172. package/dist/features/board/lib/boardHtml.internal.js +36 -36
  173. package/dist/features/board/lib/boardMember.internal.js +8 -8
  174. package/dist/features/board/lib/boardShape.internal.js +10 -124
  175. package/dist/features/board/lib/boardStyle.internal.js +6 -6
  176. package/dist/features/board/lib/boardTypes.internal.js +6 -0
  177. package/dist/features/callout/index.d.ts +3 -3
  178. package/dist/features/callout/lib/BaseCalloutPlugin.js +46 -2
  179. package/dist/features/code-block/lib/BaseCodeBlockPlugin.js +207 -179
  180. package/dist/features/code-block/lib/CodeBlockRules.js +133 -14
  181. package/dist/features/column/index.d.ts +2 -0
  182. package/dist/features/column/lib/BaseColumnPlugin.js +693 -0
  183. package/dist/features/comments/BaseCommentsPlugin.js +1315 -408
  184. package/dist/features/comments/comment-thread-index.internal.js +5 -4
  185. package/dist/features/comments/index.d.ts +3 -2
  186. package/dist/features/date/index.d.ts +3 -3
  187. package/dist/features/date/lib/BaseDatePlugin.js +72 -31
  188. package/dist/features/details/index.d.ts +3 -3
  189. package/dist/features/details/lib/BaseDetailsPlugin.js +20 -22
  190. package/dist/features/field/index.d.ts +1 -1
  191. package/dist/features/field/lib/BaseFieldPlugin.js +58 -58
  192. package/dist/features/field/lib/fieldRules.internal.js +6 -6
  193. package/dist/features/find/index.d.ts +98 -34
  194. package/dist/features/find/lib/BaseFindPlugin.js +939 -370
  195. package/dist/features/footnote/index.d.ts +428 -2
  196. package/dist/features/footnote/lib/BaseFootnotePlugin.js +437 -167
  197. package/dist/features/indent/lib/BaseIndentPlugin.js +222 -75
  198. package/dist/features/indent/lib/indentHtml.internal.js +9 -0
  199. package/dist/features/indent/lib/indentLevel.internal.js +3 -3
  200. package/dist/features/ink/index.d.ts +1 -1
  201. package/dist/features/ink/lib/BaseInkPlugin.js +4 -3
  202. package/dist/features/ink/lib/inkPlaces.internal.js +3 -3
  203. package/dist/features/link/lib/BaseLinkPlugin.js +467 -186
  204. package/dist/features/lint/index.d.ts +5 -5
  205. package/dist/features/lint/lib/BaseLintPlugin.js +3 -1
  206. package/dist/features/list/lib/BaseListPlugin.js +99 -709
  207. package/dist/features/list/lib/listCommands.internal.js +161 -0
  208. package/dist/features/list/lib/listFamily.internal.js +69 -24
  209. package/dist/features/list/lib/listHtml.internal.js +185 -70
  210. package/dist/features/list/lib/listIndex.internal.js +50 -20
  211. package/dist/features/list/lib/listKeyboard.internal.js +176 -0
  212. package/dist/features/list/lib/listMarkdown.internal.js +127 -0
  213. package/dist/features/list/lib/listRules.internal.js +125 -0
  214. package/dist/features/lock/index.d.ts +2 -2
  215. package/dist/features/lock/index.js +2 -2
  216. package/dist/features/lock/lib/BaseLockPlugin.js +154 -54
  217. package/dist/features/media/index.d.ts +1 -1
  218. package/dist/features/media/lib/BaseMediaPlugin.js +117 -4
  219. package/dist/features/media/lib/image/BaseImagePlugin.js +46 -10
  220. package/dist/features/media/lib/media-embed/BaseMediaEmbedPlugin.js +26 -8
  221. package/dist/features/media/lib/mediaHtml.internal.js +2 -2
  222. package/dist/features/mention/index.d.ts +4 -11
  223. package/dist/features/mention/lib/BaseMentionPlugin.js +12 -16
  224. package/dist/features/table/index.d.ts +2 -2
  225. package/dist/features/table/lib/BaseTablePlugin.js +711 -410
  226. package/dist/features/table/lib/internal/authoredProjection.js +172 -0
  227. package/dist/features/table/lib/internal/axisMove.js +152 -0
  228. package/dist/features/table/lib/internal/docxBorders.js +39 -0
  229. package/dist/features/table/lib/internal/grid.js +34 -1
  230. package/dist/features/table/lib/internal/mutation.js +18 -121
  231. package/dist/features/table/lib/internal/selection.js +114 -3
  232. package/dist/features/table/lib/internal/tabularText.js +2 -1
  233. package/dist/features/table/lib/internal/widths.js +118 -0
  234. package/dist/features/toc/index.d.ts +1 -1
  235. package/dist/features/toc/lib/BaseTocPlugin.js +42 -2
  236. package/dist/features/upload/index.d.ts +2 -2
  237. package/dist/features/upload/index.js +3 -2
  238. package/dist/features/upload/lib/BaseUploadPlugin.js +258 -295
  239. package/dist/features/upload/lib/uploadRules.internal.js +259 -0
  240. package/dist/history/index.d.ts +2 -3
  241. package/dist/html/index.d.ts +4 -3
  242. package/dist/html/server/index.d.ts +6 -2
  243. package/dist/html/server/index.js +5 -2
  244. package/dist/{index-CfK4uv4I.d.ts → htmlConversion-DkPBUAhF.d.ts} +6 -3
  245. package/dist/{htmlTypes-zTLU3aTb.d.ts → htmlTypes-BtbQ2kEr.d.ts} +16 -2
  246. package/dist/hyperscript/index.d.ts +1 -1
  247. package/dist/{index-CX_JaDRY.d.ts → index-1OVDeYPV.d.ts} +3 -3
  248. package/dist/{index-BSBkt2bm.d.ts → index-B32tPEDz.d.ts} +112 -39
  249. package/dist/index-BG8rVWFU.d.ts +21 -0
  250. package/dist/{index-BCYBYfGM.d.ts → index-BTr77Bx4.d.ts} +65 -79
  251. package/dist/{index-yZDmK6ab.d.ts → index-Bjidr3Bh.d.ts} +89 -38
  252. package/dist/index-BrH9LjUL.d.ts +1 -0
  253. package/dist/index-C5UBSjnN.d.ts +3 -0
  254. package/dist/{index-CD_Ym9WQ.d.ts → index-C9NdczaJ.d.ts} +9 -12
  255. package/dist/{index-DoZhM7nD.d.ts → index-CQIZktRx.d.ts} +144 -55
  256. package/dist/{index-u_h6ow4e.d.ts → index-CXykQDCy.d.ts} +172 -115
  257. package/dist/{index-DM-b6jEe-BqkdOlav.d.ts → index-CkM6HC0j-Dl58Hah-.d.ts} +1 -1
  258. package/dist/{index-CfRUKYCM.d.ts → index-CpPTPirx.d.ts} +2 -2
  259. package/dist/index-DFTcRJUh.d.ts +97 -0
  260. package/dist/index-DUPlSPvg.d.ts +81 -0
  261. package/dist/{index-DuElD_q6.d.ts → index-DayqETUb.d.ts} +243 -241
  262. package/dist/{index-BPOa4Z5n.d.ts → index-DlfamnX-.d.ts} +120 -228
  263. package/dist/{index-D11C0iLb.d.ts → index-DlmWL_1-.d.ts} +29 -10
  264. package/dist/index-Dqd1rrEG-BSmp1a8x.d.ts +316 -0
  265. package/dist/{index-4PpawhYe-yelJvgk1.d.ts → index-Du3tBg6V-CtvB7eak.d.ts} +3 -3
  266. package/dist/{index-BisOdLXI.d.ts → index-MQmrgI2L.d.ts} +10 -5
  267. package/dist/{index-3CExu_fj.d.ts → index-SKTw56CW.d.ts} +9 -9
  268. package/dist/{index-DsNwo8dd.d.ts → index-drvpTZ3S.d.ts} +713 -1523
  269. package/dist/index-vP4xFieu.d.ts +184 -0
  270. package/dist/index-zK527a0f.d.ts +57 -0
  271. package/dist/index.d.ts +4 -4
  272. package/dist/index.js +7 -11
  273. package/dist/internal/comments/comment-anchor.internal.js +636 -0
  274. package/dist/internal/plugin/OverridePlugin.js +139 -56
  275. package/dist/internal/plugin/collectPlateNodeMappings.js +7 -4
  276. package/dist/internal/plugin/compilePlainTextMappings.js +67 -16
  277. package/dist/internal/plugin/compilePlateModel.js +56 -17
  278. package/dist/internal/plugin/compilePlateShortcuts.js +2 -1
  279. package/dist/internal/plugin/compilePluginInputMaps.js +126 -0
  280. package/dist/internal/plugin/createPlateModelPublication.js +261 -0
  281. package/dist/internal/plugin/createPlateRuntimePlugins.js +263 -0
  282. package/dist/internal/plugin/getPlateDecorationSources.js +2 -1
  283. package/dist/internal/plugin/indentShift.js +44 -0
  284. package/dist/internal/plugin/markdownParagraph.js +23 -1
  285. package/dist/internal/plugin/plateRuntime.js +2 -2
  286. package/dist/internal/plugin/pluginDescriptorSnapshot.js +178 -0
  287. package/dist/internal/plugin/pluginFormatOperation.js +8 -3
  288. package/dist/internal/plugin/pluginStore.js +4 -7
  289. package/dist/internal/plugin/resolvePlugin.js +32 -17
  290. package/dist/internal/plugin/resolvePluginGraph.js +354 -0
  291. package/dist/internal/plugin/resolvePlugins.js +19 -1137
  292. package/dist/internal/plugin/staticReuseKey.internal.js +15 -0
  293. package/dist/internal/plugin/uploadDrafts.js +6 -1
  294. package/dist/internal/utils/mergePlugins.js +6 -5
  295. package/dist/internal/utils/trustedContentSlice.js +1 -1
  296. package/dist/internal/utils/urlPolicy.js +19 -1
  297. package/dist/lib/editor/editorUser.internal.js +13 -5
  298. package/dist/lib/editor/withPlite.js +55 -44
  299. package/dist/lib/libs/zustand.js +31 -7
  300. package/dist/lib/plugin/basePluginFactory.internal.js +7 -0
  301. package/dist/lib/plugin/createPluginContext.internal.js +6 -24
  302. package/dist/lib/plugin/defineBasePlugin.internal.js +69 -9
  303. package/dist/lib/plugin/definePlugin.js +1 -1
  304. package/dist/lib/plugin/pluginFactoryRuntime.internal.js +40 -0
  305. package/dist/lib/plugins/affinity/AffinityPlugin.js +9 -8
  306. package/dist/lib/plugins/debug/DebugPlugin.js +1 -4
  307. package/dist/lib/plugins/dom/DOMPlugin.js +20 -7
  308. package/dist/lib/plugins/dom/clipboardFormatKey.internal.js +9 -0
  309. package/dist/lib/plugins/dom/isPlainTextPasteTarget.internal.js +13 -0
  310. package/dist/lib/plugins/getCorePlugins.internal.js +1 -3
  311. package/dist/lib/plugins/html/HtmlPlugin.js +30 -1766
  312. package/dist/lib/plugins/html/htmlAst.js +5 -2
  313. package/dist/lib/plugins/html/htmlConversion.js +4 -0
  314. package/dist/lib/plugins/html/htmlDecode.internal.js +891 -0
  315. package/dist/lib/plugins/html/htmlMatcher.internal.js +24 -1
  316. package/dist/lib/plugins/html/htmlRules.internal.js +490 -0
  317. package/dist/lib/plugins/html/htmlSerialize.internal.js +462 -0
  318. package/dist/lib/plugins/html/htmlWhitespace.internal.js +137 -0
  319. package/dist/lib/plugins/input-rules/InputRulesPlugin.js +114 -30
  320. package/dist/lib/plugins/input-rules/createInputRules.js +64 -68
  321. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +111 -9
  322. package/dist/lib/plugins/input-rules/inputRuleVeto.js +2 -2
  323. package/dist/lib/plugins/input-rules/inputRules.internal.js +20 -0
  324. package/dist/lib/plugins/input-rules/markInputRule.internal.js +64 -2
  325. package/dist/lib/plugins/paragraph/BaseParagraphPlugin.js +21 -8
  326. package/dist/lib/utils/pluginNodeClass.js +1 -5
  327. package/dist/markdown/index.d.ts +2 -2
  328. package/dist/markdown/lib/MarkdownPlugin.js +38 -45
  329. package/dist/markdown/lib/deserializer/convertNodesDeserialize.js +3 -3
  330. package/dist/markdown/lib/deserializer/mdastToSlate.js +2 -4
  331. package/dist/markdown/lib/internal/markdownBareLinks.js +265 -0
  332. package/dist/markdown/lib/internal/markdownBreaks.js +191 -0
  333. package/dist/markdown/lib/internal/markdownDiagnostics.js +2 -2
  334. package/dist/markdown/lib/internal/markdownDocument.js +13 -32
  335. package/dist/markdown/lib/internal/markdownIntrinsics.js +38 -163
  336. package/dist/markdown/lib/internal/markdownLine.js +133 -115
  337. package/dist/markdown/lib/internal/markdownMappings.js +173 -101
  338. package/dist/markdown/lib/internal/markdownParse.js +601 -0
  339. package/dist/markdown/lib/internal/markdownReferences.js +9 -3
  340. package/dist/markdown/lib/internal/markdownRuntime.js +353 -0
  341. package/dist/markdown/lib/internal/markdownSerialize.js +197 -0
  342. package/dist/markdown/lib/internal/markdownStream.js +1239 -0
  343. package/dist/markdown/lib/internal/markdownTags.js +50 -37
  344. package/dist/markdown/lib/internal/markdownTailHeal.js +813 -0
  345. package/dist/markdown/lib/serializer/convertNodesSerialize.js +14 -3
  346. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +134 -44
  347. package/dist/markdown/lib/serializer/listToMdastTree.js +23 -4
  348. package/dist/markdown/lib/serializer/reportOmittedProperties.js +1 -0
  349. package/dist/markdown/lib/utils/remarkPlugins.js +44 -23
  350. package/dist/math/index.d.ts +11 -11
  351. package/dist/math/lib/BaseEquationPlugin.js +99 -20
  352. package/dist/math/react/index.d.ts +4 -4
  353. package/dist/migrations/documentMigrationAuthored.internal.js +2 -1
  354. package/dist/migrations/documentMigrationSelection.internal.js +43 -12
  355. package/dist/migrations/documentMigrationTarget.internal.js +10 -2
  356. package/dist/migrations/documentMigrations.js +98 -30
  357. package/dist/migrations/index.d.ts +30 -44
  358. package/dist/migrations/index.js +1 -2
  359. package/dist/migrations/migratePlateV54.js +11 -7
  360. package/dist/migrations/migratePlateV54Ast.internal.js +43 -70
  361. package/dist/migrations/migratePlateV54BuiltIns.internal.js +2 -2
  362. package/dist/migrations/migratePlateV54CodeBlocks.internal.js +45 -6
  363. package/dist/migrations/migratePlateV54ListIdentity.internal.js +220 -0
  364. package/dist/migrations/migratePlateV54RetiredMarks.internal.js +2 -2
  365. package/dist/migrations/migratePlateV54Toggle.internal.js +66 -0
  366. package/dist/migrations/migratePlateV54Urls.internal.js +11 -2
  367. package/dist/pagination/index.d.ts +2 -167
  368. package/dist/pagination/index.js +2 -2
  369. package/dist/pagination/react/PaginationPlugin.js +278 -0
  370. package/dist/pagination/react/index.d.ts +94 -34
  371. package/dist/pagination/react/index.js +3 -5
  372. package/dist/plain-text.js +9 -12
  373. package/dist/react/authored/AuthoredReactPlugin.js +126 -0
  374. package/dist/react/authored/index.d.ts +34 -0
  375. package/dist/react/authored/index.js +3 -0
  376. package/dist/react/authored/useAuthored.js +82 -0
  377. package/dist/react/components/EditorContentView.internal.js +64 -45
  378. package/dist/react/components/EditorProvider.js +25 -24
  379. package/dist/react/components/EditorRefEffect.internal.js +56 -0
  380. package/dist/react/components/EditorRefEffect.js +12 -56
  381. package/dist/react/components/NodeSelection.js +435 -493
  382. package/dist/react/components/Plate.js +84 -83
  383. package/dist/react/components/PlateContainer.js +96 -43
  384. package/dist/react/components/PlateView.js +1 -1
  385. package/dist/react/components/plate-nodes.js +1 -2
  386. package/dist/react/components/writeStaticSelectionClipboardData.internal.js +1 -1
  387. package/dist/react/core.js +7 -11
  388. package/dist/react/editor/useCreateEditor.js +19 -17
  389. package/dist/react/editor/withPlate.js +10 -13
  390. package/dist/react/features/basic-styles/BasicStylePlugins.js +2 -3
  391. package/dist/react/features/board/BoardPlugin.js +1 -1
  392. package/dist/react/features/board/BoardShape.js +9 -10
  393. package/dist/react/features/board/BoardSurface.js +1 -1
  394. package/dist/react/features/board/boardCamera.internal.js +295 -0
  395. package/dist/react/features/board/boardClipboard.internal.js +20 -20
  396. package/dist/react/features/board/boardConnect.internal.js +2 -1
  397. package/dist/react/features/board/boardExport.internal.js +5 -4
  398. package/dist/react/features/board/boardGesture.internal.js +44 -38
  399. package/dist/react/features/board/boardIndex.internal.js +1 -1
  400. package/dist/react/features/board/boardKeys.internal.js +42 -46
  401. package/dist/react/features/board/boardLanding.internal.js +147 -0
  402. package/dist/react/features/board/boardPick.internal.js +2 -2
  403. package/dist/react/features/board/boardPreview.internal.js +16 -2
  404. package/dist/react/features/board/boardResize.internal.js +5 -15
  405. package/dist/react/features/board/boardStyleView.internal.js +123 -0
  406. package/dist/react/features/board/boardTextFit.internal.js +311 -0
  407. package/dist/react/features/board/boardView.internal.js +310 -915
  408. package/dist/react/features/board/boardVoice.internal.js +4 -5
  409. package/dist/react/features/board/boardWindow.internal.js +138 -0
  410. package/dist/react/features/board/index.d.ts +92 -86
  411. package/dist/react/features/callout/index.d.ts +3 -3
  412. package/dist/react/features/{layout → column}/ColumnPlugin.js +4 -3
  413. package/dist/react/features/{layout → column}/index.d.ts +61 -44
  414. package/dist/react/features/combobox/combobox.internal.js +106 -0
  415. package/dist/react/features/combobox/comboboxOwner.internal.js +19 -23
  416. package/dist/react/features/combobox/index.d.ts +47 -16
  417. package/dist/react/features/combobox/useCombobox.js +50 -13
  418. package/dist/react/features/comments/CommentsPlugin.js +3 -3
  419. package/dist/react/features/comments/index.d.ts +142 -75
  420. package/dist/react/features/comments/index.js +2 -1
  421. package/dist/react/features/comments/useCommentThreadIndex.js +288 -0
  422. package/dist/react/features/date/index.d.ts +4 -4
  423. package/dist/react/features/details/index.d.ts +4 -4
  424. package/dist/react/features/field/index.d.ts +5 -5
  425. package/dist/react/features/footnote/FootnotePlugin.js +13 -8
  426. package/dist/react/features/footnote/index.d.ts +952 -105
  427. package/dist/react/features/format-painter/index.d.ts +6 -6
  428. package/dist/react/features/ink/index.d.ts +33 -13
  429. package/dist/react/features/ink/inkCapture.internal.js +10 -4
  430. package/dist/react/features/list/ListPlugin.js +68 -36
  431. package/dist/react/features/lock/LockPlugin.js +57 -18
  432. package/dist/react/features/lock/index.d.ts +8 -8
  433. package/dist/react/features/media/index.d.ts +10 -10
  434. package/dist/react/features/mention/index.d.ts +4 -11
  435. package/dist/react/features/table/TablePlugin.js +215 -61
  436. package/dist/react/features/table/index.d.ts +158 -59
  437. package/dist/react/features/table/index.js +2 -1
  438. package/dist/react/features/table/measureTableColumnWidths.internal.js +44 -0
  439. package/dist/react/features/table/useTableControls.js +897 -0
  440. package/dist/react/features/table/useTableResize.js +33 -16
  441. package/dist/react/features/toc/index.d.ts +8 -11
  442. package/dist/react/features/upload/UploadPlugin.js +12 -3
  443. package/dist/react/features/upload/index.d.ts +36 -97
  444. package/dist/react/index.d.ts +7 -5
  445. package/dist/react/index.js +11 -15
  446. package/dist/react/internal/plate-context.js +118 -68
  447. package/dist/react/internal/useDeepCompareMemo.js +36 -7
  448. package/dist/react/internal/usePlateModelRevision.js +12 -7
  449. package/dist/react/plite-react.js +2 -2
  450. package/dist/react/plugin/pluginFactory.internal.js +1 -37
  451. package/dist/react/plugin/toReactPlugin.js +15 -4
  452. package/dist/react/plugins/navigation-feedback/NavigationFeedbackPlugin.js +2 -2
  453. package/dist/react/stores/element/useElement.js +2 -2
  454. package/dist/react/stores/element/useElementSelector.js +4 -2
  455. package/dist/react/stores/element/useElementStore.js +96 -86
  456. package/dist/react/stores/element/useElementStoreSelector.internal.js +80 -24
  457. package/dist/react/stores/element/usePath.js +32 -32
  458. package/dist/react/stores/plate/pluginStoreSelector.internal.js +44 -0
  459. package/dist/react/stores/plate/useEditor.js +62 -89
  460. package/dist/react/stores/plate/useEditorSelector.js +17 -204
  461. package/dist/react/stores/plate/usePluginStore.js +36 -43
  462. package/dist/react/stores/plate/useViewStore.js +38 -23
  463. package/dist/react/utils/BlockPlaceholderPlugin.js +13 -4
  464. package/dist/react/utils/pipeHandler.internal.js +20 -7
  465. package/dist/react/utils/pipeRenderLeaf.internal.js +1 -2
  466. package/dist/react/utils/pipeRenderText.internal.js +1 -1
  467. package/dist/react/utils/useSelectionFragment.js +8 -2
  468. package/dist/react/virtualized.d.ts +6 -5
  469. package/dist/refusal-CBecclcb-BJGVrNlz.d.ts +1 -0
  470. package/dist/registerEditorTools-dPLJZ0PP.d.ts +386 -0
  471. package/dist/root.js +7 -11
  472. package/dist/skills/plate/SKILL.md +43 -0
  473. package/dist/{source-B1rLozUs.d.ts → source-BnYE-ryK.d.ts} +14 -14
  474. package/dist/static/components/{PlateStatic.js → EditorStatic.js} +86 -31
  475. package/dist/static/components/plite-nodes.js +31 -11
  476. package/dist/static/index.d.ts +21 -15
  477. package/dist/static/index.js +1 -1
  478. package/dist/static/internal/loadStaticRenderer.js +4 -0
  479. package/dist/static/internal/staticDocumentView.js +8 -5
  480. package/dist/static/internal/staticPendingMedia.internal.js +136 -0
  481. package/dist/static/internal/staticPresentation.js +12 -12
  482. package/dist/static/pipeRenderElementStatic.internal.js +2 -10
  483. package/dist/static/pluginRenderElementStatic.internal.js +28 -5
  484. package/dist/static/pluginRenderLeafStatic.internal.js +3 -1
  485. package/dist/static/pluginRenderTextStatic.internal.js +3 -1
  486. package/dist/static/renderStaticHtml.js +31 -2
  487. package/dist/static/utils/getRenderNodeStaticProps.internal.js +8 -3
  488. package/dist/sync/SyncPlugin.js +16 -0
  489. package/dist/sync/cloudflare/index.d.ts +56 -0
  490. package/dist/sync/cloudflare/index.js +2 -0
  491. package/dist/sync/index.d.ts +3 -0
  492. package/dist/sync/index.js +3 -0
  493. package/dist/sync/react/SyncReactPlugin.js +20 -0
  494. package/dist/sync/react/hooks.js +64 -0
  495. package/dist/{yjs → sync}/react/index.d.ts +74 -68
  496. package/dist/sync/react/index.js +4 -0
  497. package/dist/sync/server/index.d.ts +3 -0
  498. package/dist/sync/server/index.js +2 -0
  499. package/dist/tabbable/index.d.ts +1 -1
  500. package/dist/tabbable/react/TabbableEffects.internal.js +5 -5
  501. package/dist/tabbable/react/index.d.ts +3 -3
  502. package/dist/testing/index.d.ts +7 -6
  503. package/dist/transport-CRrArpJZ-Bm6uVAsa.d.ts +115 -0
  504. package/dist/{tx-only-D8lpB-sT-ZiAbZRMU.d.ts → tx-only-DXWFNuXJ-DuOaZk8U.d.ts} +2761 -2694
  505. package/dist/utils/plate-keys.js +2 -8
  506. package/dist/utils/plugins/TrailingBlockPlugin.js +10 -7
  507. package/dist/utils/plugins/resolveTrailingBlockType.internal.js +8 -0
  508. package/package.json +47 -114
  509. package/dist/AIChatRequestContext-PbXTTovP.d.ts +0 -36
  510. package/dist/BaseSuggestionPlugin-Dg-cdX26.d.ts +0 -97
  511. package/dist/PlateStatic-CggiBCuD.d.ts +0 -19
  512. package/dist/ai/lib/AIChatRequestContext.js +0 -16
  513. package/dist/ai/lib/findQuotedSpan.internal.js +0 -63
  514. package/dist/ai/react/AIChatPlugin.js +0 -1639
  515. package/dist/ai/react/useAIChat.js +0 -332
  516. package/dist/combobox-CUUSZR07.d.ts +0 -22
  517. package/dist/docs/yjs.md +0 -256
  518. package/dist/docx/export/lib/comments.js +0 -311
  519. package/dist/docx/export/lib/docxStaticComponents.js +0 -381
  520. package/dist/docx/export/lib/exportHtmlToDocx.internal.js +0 -70
  521. package/dist/docx/export/lib/generatedParts.js +0 -51
  522. package/dist/docx/export/lib/hostIndex.js +0 -92
  523. package/dist/docx/export/lib/html-to-docx.internal.js +0 -40
  524. package/dist/docx/export/lib/internal/constants.js +0 -106
  525. package/dist/docx/export/lib/internal/docx-document.js +0 -652
  526. package/dist/docx/export/lib/internal/escape-xml.js +0 -4
  527. package/dist/docx/export/lib/internal/html-to-docx.js +0 -148
  528. package/dist/docx/export/lib/internal/list-item.js +0 -85
  529. package/dist/docx/export/lib/internal/list.js +0 -43
  530. package/dist/docx/export/lib/internal/math.js +0 -187
  531. package/dist/docx/export/lib/internal/namespaces.js +0 -40
  532. package/dist/docx/export/lib/internal/render-document-file.js +0 -403
  533. package/dist/docx/export/lib/internal/schemas/content-types.js +0 -25
  534. package/dist/docx/export/lib/internal/schemas/core.js +0 -26
  535. package/dist/docx/export/lib/internal/schemas/document-rels.js +0 -15
  536. package/dist/docx/export/lib/internal/schemas/document.template.js +0 -36
  537. package/dist/docx/export/lib/internal/schemas/font-table.js +0 -55
  538. package/dist/docx/export/lib/internal/schemas/generic-rels.js +0 -9
  539. package/dist/docx/export/lib/internal/schemas/numbering.js +0 -18
  540. package/dist/docx/export/lib/internal/schemas/rels.js +0 -12
  541. package/dist/docx/export/lib/internal/schemas/settings.js +0 -17
  542. package/dist/docx/export/lib/internal/schemas/styles.js +0 -142
  543. package/dist/docx/export/lib/internal/schemas/theme.js +0 -198
  544. package/dist/docx/export/lib/internal/schemas/web-settings.js +0 -10
  545. package/dist/docx/export/lib/internal/unit-conversion.js +0 -24
  546. package/dist/docx/export/lib/internal/vnode.js +0 -4
  547. package/dist/docx/export/lib/internal/word-styles.js +0 -123
  548. package/dist/docx/export/lib/internal/xml-builder.js +0 -1803
  549. package/dist/docx/export/lib/reviewPart.js +0 -234
  550. package/dist/docx/import/lib/wordFormatting.js +0 -608
  551. package/dist/features/combobox/index.d.ts +0 -3
  552. package/dist/features/combobox/index.js +0 -2
  553. package/dist/features/combobox/lib/combobox.internal.js +0 -111
  554. package/dist/features/combobox/lib/filterWords.js +0 -19
  555. package/dist/features/layout/index.d.ts +0 -2
  556. package/dist/features/layout/lib/BaseColumnPlugin.js +0 -272
  557. package/dist/features/suggestion/BaseSuggestionPlugin.js +0 -31
  558. package/dist/features/suggestion/index.d.ts +0 -10
  559. package/dist/features/suggestion/index.js +0 -3
  560. package/dist/features/upload/lib/mimeTypes.internal.js +0 -3982
  561. package/dist/index-0YxPsHwd.d.ts +0 -1
  562. package/dist/index-BODDOPEd.d.ts +0 -8
  563. package/dist/index-Bt5YI_JN.d.ts +0 -29
  564. package/dist/index-Cil7kghY.d.ts +0 -161
  565. package/dist/index-DJW6AjJ6.d.ts +0 -184
  566. package/dist/index-f3aV3Kt-.d.ts +0 -156
  567. package/dist/lib/plugins/element-state/ElementStatePlugin.js +0 -14
  568. package/dist/lib/utils/hotkeys.js +0 -113
  569. package/dist/markdown/lib/internal/markdownConversion.js +0 -1326
  570. package/dist/markdown/lib/internal/markdownOpenTail.js +0 -381
  571. package/dist/markdown/lib/internal/markdownSegments.js +0 -143
  572. package/dist/migrations/migrateListIdentity.js +0 -93
  573. package/dist/pagination/react/PagedEditorContent.js +0 -77
  574. package/dist/react/features/suggestion/SuggestionPlugin.js +0 -24
  575. package/dist/react/features/suggestion/index.d.ts +0 -45
  576. package/dist/react/features/suggestion/index.js +0 -3
  577. package/dist/react/features/suggestion/suggestion-view.internal.js +0 -114
  578. package/dist/react/features/suggestion/useSuggestion.js +0 -138
  579. package/dist/static/internal/renderStaticHtmlWithOverrides.js +0 -33
  580. package/dist/utils/plugins/ExitBreakPlugin.js +0 -26
  581. package/dist/yjs/index.d.ts +0 -2
  582. package/dist/yjs/index.js +0 -1
  583. package/dist/yjs/react/YjsPlugin.js +0 -60
  584. package/dist/yjs/react/index.js +0 -3
  585. /package/dist/features/{layout → column}/index.js +0 -0
  586. /package/dist/react/features/{layout → column}/index.js +0 -0
@@ -1,4 +1,4 @@
1
- import { createEditorCommitPublicationQueue, didCommitChangePersistedValue, getCommitDocumentValue, publishEditorCommitInVersionOrder, resetEditorCommitPublicationQueue, runEditorObserver } from "../../facade.js";
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(29);
16
+ const $ = c(30);
17
17
  const { editor, onCommit, onNodeChange, onSelectionChange, onTextChange, onValueChange } = t0;
18
18
  let t1;
19
- if ($[0] !== editor.read) {
20
- t1 = editor.read.lastCommit()?.version ?? 0;
21
- $[0] = editor.read;
22
- $[1] = t1;
23
- } else t1 = $[1];
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 ($[2] !== t1) {
26
- t2 = { version: t1 };
27
- $[2] = t1;
28
- $[3] = t2;
29
- } else t2 = $[3];
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
- let t4;
40
- if ($[6] !== onCommit || $[7] !== onNodeChange || $[8] !== onSelectionChange || $[9] !== onTextChange || $[10] !== onValueChange) {
41
- t4 = {
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
- $[6] = onCommit;
49
- $[7] = onNodeChange;
50
- $[8] = onSelectionChange;
51
- $[9] = onTextChange;
52
- $[10] = onValueChange;
53
- $[11] = t4;
54
- } else t4 = $[11];
55
- const observersRef = React.useRef(t4);
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
- let t6;
58
- if ($[12] !== onCommit || $[13] !== onNodeChange || $[14] !== onSelectionChange || $[15] !== onTextChange || $[16] !== onValueChange) {
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
- t6 = [
67
+ t5 = [
69
68
  onCommit,
70
69
  onNodeChange,
71
70
  onSelectionChange,
72
71
  onTextChange,
73
72
  onValueChange
74
73
  ];
75
- $[12] = onCommit;
76
- $[13] = onNodeChange;
77
- $[14] = onSelectionChange;
78
- $[15] = onTextChange;
79
- $[16] = onValueChange;
80
- $[17] = t5;
81
- $[18] = t6;
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
- t5 = $[17];
84
- t6 = $[18];
82
+ t4 = $[19];
83
+ t5 = $[20];
85
84
  }
86
- React.useInsertionEffect(t5, t6);
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
- let t8;
91
- if ($[19] !== editor || $[20] !== hasNodeChange || $[21] !== hasTextChange) {
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
- t8 = [
99
+ t7 = [
101
100
  editor,
102
101
  hasNodeChange,
103
102
  hasTextChange
104
103
  ];
105
- $[19] = editor;
106
- $[20] = hasNodeChange;
107
- $[21] = hasTextChange;
108
- $[22] = t7;
109
- $[23] = t8;
104
+ $[21] = editor;
105
+ $[22] = hasNodeChange;
106
+ $[23] = hasTextChange;
107
+ $[24] = t6;
108
+ $[25] = t7;
110
109
  } else {
111
- t7 = $[22];
112
- t8 = $[23];
110
+ t6 = $[24];
111
+ t7 = $[25];
113
112
  }
114
- useIsomorphicLayoutEffect(t7, t8);
115
- let t10;
113
+ useIsomorphicLayoutEffect(t6, t7);
114
+ let t8;
116
115
  let t9;
117
- if ($[24] !== commitPublicationQueue || $[25] !== editor || $[26] !== observerBaseline) {
118
- t9 = () => {
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
- resetEditorCommitPublicationQueue(commitPublicationQueue, observerBaseline.version);
124
+ lastVersionRef.current = observerBaseline.version;
122
125
  }
123
- const observeCommit = (commit, snapshot) => {
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 (commit.selectionChanged && (commit.selectionBeforeRoot === void 0 || commit.selectionAfterRoot === void 0)) runEditorObserver(editor, "commit-listener", () => {
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
- const unsubscribe = editor.subscribeCommit((commit_0, snapshot_0) => {
152
- publishEditorCommitInVersionOrder(commitPublicationQueue, commit_0, snapshot_0, observeCommit, { allowVersionGap: false });
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
- t10 = [
159
- commitPublicationQueue,
160
- editor,
161
- observerBaseline
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
- t10 = $[27];
170
- t9 = $[28];
170
+ t8 = $[28];
171
+ t9 = $[29];
171
172
  }
172
- useIsomorphicLayoutEffect(t9, t10);
173
+ useIsomorphicLayoutEffect(t8, t9);
173
174
  return null;
174
175
  }
175
176
  function _temp(state) {
176
- return state.runtime.snapshot();
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 { useComposedRef } from "../internal/react-helpers.js";
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(26);
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 ref = useComposedRef(containerRef, useEditorScrollElementRef(editor, t2));
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 ($[5] !== area || $[6] !== children || $[7] !== containerRef || $[8] !== editor || $[9] !== props || $[10] !== readOnly || $[11] !== ref) {
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 t3;
47
- if ($[15] !== area || $[16] !== children) {
48
- t3 = /* @__PURE__ */ React.createElement(PlateScopeContext, { value: area }, children);
49
- $[15] = area;
50
- $[16] = children;
51
- $[17] = t3;
52
- } else t3 = $[17];
53
- let t4;
54
- if ($[18] !== props || $[19] !== ref || $[20] !== t3) {
55
- t4 = /* @__PURE__ */ React.createElement("div", {
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
- }, t3);
59
- $[18] = props;
60
- $[19] = ref;
61
- $[20] = t3;
62
- $[21] = t4;
63
- } else t4 = $[21];
64
- mainContainer = t4;
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
- $[5] = area;
78
- $[6] = children;
79
- $[7] = containerRef;
80
- $[8] = editor;
81
- $[9] = props;
82
- $[10] = readOnly;
83
- $[11] = ref;
84
- $[12] = afterContainer;
85
- $[13] = beforeContainer;
86
- $[14] = mainContainer;
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 = $[12];
89
- beforeContainer = $[13];
90
- mainContainer = $[14];
141
+ afterContainer = $[21];
142
+ beforeContainer = $[22];
143
+ mainContainer = $[23];
91
144
  }
92
- let t3;
93
- if ($[22] !== afterContainer || $[23] !== beforeContainer || $[24] !== mainContainer) {
94
- t3 = /* @__PURE__ */ React.createElement(React.Fragment, null, beforeContainer, mainContainer, afterContainer);
95
- $[22] = afterContainer;
96
- $[23] = beforeContainer;
97
- $[24] = mainContainer;
98
- $[25] = t3;
99
- } else t3 = $[25];
100
- return t3;
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/PlateStatic.js";
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] ??= children;
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,
@@ -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, createBlockStartInputRule, createMarkInputRule, createTextSubstitutionInputRule, matchBlockStart, matchDelimitedInline } from "../lib/plugins/input-rules/createInputRules.js";
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, isPluginElementClass, isPluginNodeClass } from "../lib/utils/pluginNodeClass.js";
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, SpanApi, TextApi, authoredVeto, compileEditorSchemaContract, createEditorView, decodeEditorEffect, defineCommand, defineEditorSchema, defineEffect, definePluginPoint, definePluginSlot, defineStateField, defineUpdateAnnotation, diffEditorSchemaContracts, documentReplacement, editorCommands, editorReads, encodeEditorEffect, getEditorRuntimeOwner, invertEffect, isEditor, locateAt, mapEffect, nodeWriteVeto, property, readEditorSchemaContract, readEditorSelection, restoreEditorSchemaContract, schema, screenReaderAnnouncementEffect, setDebugValueScrubber, setEditorReadOnly, setEditorViewing, target, transfer, transferVeto, txLocate, txOnly, txSelection, valueCodecs } from "../core.js";
30
- import { ReactUpdatePolicy, installBrowserHandle, react, useChildRoot, useContentRoot, useDropIndicator, useEditableClip, useEditorEditableElement, useEditorRootAreas, useEditorRootElement, useEditorScrollElement, useEditorScrollElementRef, useElementPath, useElementSelected, useRootChrome, useSelectionGeometry } from "./plite-react.js";
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, useEditorHasSelection, useEditorId, useEditorMounted, useEditorReadOnly, useEditorSelection, useEditorValue, useModelEditor, useOptionalEditor, useRootEditor, useSetStateField, useStateFieldValue } from "./stores/plate/useEditor.js";
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 { useEditorPluginStore, usePluginStore } from "./stores/plate/usePluginStore.js";
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, ElementStatePlugin, ExitBreakPlugin, HistoryPlugin, Hotkeys, HtmlPlugin, IS_APPLE, LocationApi, NavigationFeedbackPlugin, NodeApi, NodeSelectionDrag, NodeSelectionHighlight, PLUGINS, ParagraphPlugin, PathApi, PluginPublicationError, PointApi, RangeApi, ReactUpdatePolicy, SelectionApi, SingleBlockPlugin, SingleLinePlugin, SpanApi, TextApi, TrailingBlockPlugin, TransferPlugin, applyDeepToNodes, authoredVeto, compileEditorSchemaContract, createBlockFenceInputRule, createBlockStartInputRule, createEditor, createEditorView, createHotkey, createMarkInputRule, createTextSubstitutionInputRule, decodeEditorEffect, defaultsDeepToNodes, defineCommand, defineEditorSchema, defineEffect, defineInputRule, definePlugin, definePluginPoint, definePluginSlot, defineStateField, defineUpdateAnnotation, diffEditorSchemaContracts, documentReplacement, editorCommands, editorReads, encodeEditorEffect, getEditorRuntimeOwner, getFragmentProp, getInjectMatch, getPluginNodeClass, inputRuleVeto, installBrowserHandle, invertEffect, isDefined, isEditor, isHotkey, isNominalPluginDescriptor, isPluginElementClass, isPluginNodeClass, isUrl, locateAt, mapEffect, matchBlockStart, matchDelimitedInline, mergeDeepToNodes, nanoid, nodeWriteVeto, property, react, readEditorSchemaContract, readEditorSelection, restoreEditorSchemaContract, schema, screenReaderAnnouncementEffect, setDebugValueScrubber, setEditorReadOnly, setEditorViewing, target, toReactPlugin, transfer, transferVeto, txLocate, txOnly, txSelection, useChildRoot, useComposedRef, useContentRoot, useCreateEditor, useDropIndicator, useEditableClip, useEditableRef, useEditor, useEditorComposing, useEditorContainerRef, useEditorEditableElement, useEditorFocused, useEditorHasSelection, useEditorHistory, useEditorId, useEditorMounted, useEditorPluginStore, useEditorReadOnly, useEditorRootAreas, useEditorRootElement, useEditorScrollElement, useEditorScrollElementRef, useEditorSelection, useEditorSelector, useEditorValue, useElement, useElementPath, useElementSelected, useElementSelector, useFocusedLast, useIsomorphicLayoutEffect, useModelEditor, useOptionalEditor, usePath, usePluginStore, useRootChrome, useRootEditor, useSelectionFragmentProp, useSelectionGeometry, useSetStateField, useStateFieldValue, useViewStore, valueCodecs };
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 { USE_CREATE_EDITOR_OPTION_KEYS, createDormantPlateEditor } from "./withPlate.js";
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
- assertEditorOptions(hookOptions, USE_CREATE_EDITOR_OPTION_KEYS);
11
- const { enabled, id, userId } = hookOptions;
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
- if (enabled === false) return null;
15
- const { enabled: _enabled, ...editorOptions } = readConstructorOptions(hookOptions, USE_CREATE_EDITOR_OPTION_KEYS);
17
+ const rest = readEditorOptions(hookOptions, REACT_EDITOR_OPTION_KEYS, {
18
+ omit: HOOK_DEP_KEYS,
19
+ validated: true
20
+ });
16
21
  return createEditorOwner(() => createDormantPlateEditor({
17
- ...editorOptions,
18
- id,
19
- plugins: editorOptions.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 ? owner.retire : void 0, [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?.editor ?? null;
42
+ return owner.editor;
41
43
  }
42
44
  //#endregion
43
45
  export { useCreateEditor };
@@ -1,28 +1,25 @@
1
- import { EDITOR_OPTION_KEYS, buildEditor, readConstructorOptions } from "../../lib/editor/withPlite.js";
2
- import { ReactDOMPlugin, getPlateCorePlugins } from "./getPlateCorePlugins.internal.js";
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 } = readConstructorOptions(options, REACT_EDITOR_OPTION_KEYS);
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
- plugins: [...basePlugins, ...plugins]
20
+ clipboardFormatKey,
21
+ plugins: [...corePlugins, ...plugins]
25
22
  }, dormant);
26
23
  };
27
24
  //#endregion
28
- export { USE_CREATE_EDITOR_OPTION_KEYS, createDormantPlateEditor, createEditor };
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, BaseTextIndentPlugin } from "../../../features/basic-styles/lib/BaseStylePlugins.js";
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, TextIndentPlugin };
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";