platejs 54.0.0-beta.13 → 54.0.0-beta.15

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 (226) hide show
  1. package/dist/{EditorStatic-CKG5xM3y.d.ts → EditorStatic-ldAMJg-F.d.ts} +4 -4
  2. package/dist/ai/index.d.ts +2 -2
  3. package/dist/ai/lib/aiDraftSession.js +9 -7
  4. package/dist/ai/lib/aiPolicy.internal.js +43 -6
  5. package/dist/ai/lib/editorAgent.js +30 -21
  6. package/dist/ai/lib/editorAgentSync.internal.js +2 -2
  7. package/dist/ai/lib/lockedContext.js +5 -4
  8. package/dist/ai/react/copilotInline.internal.js +6 -5
  9. package/dist/ai/react/index.d.ts +7 -7
  10. package/dist/ai/react/useEditorAgent.js +14 -3
  11. package/dist/authored/index.d.ts +4 -4
  12. package/dist/{authored-CJL7S8qI-BxC9ip4d.d.ts → authored-Cux94E76-fEDdP_BS.d.ts} +3 -3
  13. package/dist/clipboard-format-key-B_rCped5-BJzbgrSZ.d.ts +1 -0
  14. package/dist/code-block/codemirror/index.d.ts +2 -2
  15. package/dist/{comment-anchor.internal-DTBP1huU.d.ts → comment-anchor.internal-Ck30WbG4.d.ts} +2 -2
  16. package/dist/compiler/index.d.ts +3 -3
  17. package/dist/{core-CTB0OBoh.d.ts → core-DoxvjG5W.d.ts} +69 -23
  18. package/dist/diff/index.d.ts +2 -2
  19. package/dist/docs/agents/skills.md +6 -2
  20. package/dist/docs/agents.md +1 -1
  21. package/dist/docs/ai-agents.md +8 -4
  22. package/dist/docs/ai.md +5 -0
  23. package/dist/docs/api/plate.md +15 -7
  24. package/dist/docs/api/react-hooks.md +32 -2
  25. package/dist/docs/authored-changes.md +4 -0
  26. package/dist/docs/block-menu.md +4 -0
  27. package/dist/docs/board.md +4 -0
  28. package/dist/docs/callout.md +63 -9
  29. package/dist/docs/collaboration.md +6 -1
  30. package/dist/docs/combobox.md +9 -2
  31. package/dist/docs/comment.md +8 -4
  32. package/dist/docs/components/toolbar-buttons.md +1 -1
  33. package/dist/docs/copilot.md +4 -0
  34. package/dist/docs/deck.md +173 -0
  35. package/dist/docs/details.md +4 -0
  36. package/dist/docs/diff.md +4 -0
  37. package/dist/docs/discussion.md +4 -0
  38. package/dist/docs/dnd.md +4 -0
  39. package/dist/docs/docx.md +6 -0
  40. package/dist/docs/emoji.md +2 -2
  41. package/dist/docs/equation.md +4 -0
  42. package/dist/docs/examples/collaboration-example.md +4 -0
  43. package/dist/docs/examples/export.md +41 -31
  44. package/dist/docs/examples/merge.md +4 -0
  45. package/dist/docs/examples/version-history.md +4 -0
  46. package/dist/docs/field.md +4 -0
  47. package/dist/docs/footnote.md +4 -0
  48. package/dist/docs/format-painter.md +1 -1
  49. package/dist/docs/html.md +4 -0
  50. package/dist/docs/index.md +4 -0
  51. package/dist/docs/ink.md +6 -0
  52. package/dist/docs/installation/manual.md +2 -4
  53. package/dist/docs/installation/next.md +1 -3
  54. package/dist/docs/installation/plate-ui.md +6 -2
  55. package/dist/docs/installation/rsc.md +1 -1
  56. package/dist/docs/installation.md +4 -0
  57. package/dist/docs/link.md +6 -0
  58. package/dist/docs/lint.md +18 -0
  59. package/dist/docs/llms.txt +4 -1
  60. package/dist/docs/lock.md +34 -2
  61. package/dist/docs/markdown.md +8 -0
  62. package/dist/docs/media.md +4 -0
  63. package/dist/docs/mention.md +5 -0
  64. package/dist/docs/mobile.md +415 -0
  65. package/dist/docs/pagination.md +4 -0
  66. package/dist/docs/prompt-editor.md +17 -1
  67. package/dist/docs/reference.md +192 -0
  68. package/dist/docs/roots.md +34 -0
  69. package/dist/docs/serializing.md +23 -0
  70. package/dist/docs/slash-command.md +58 -4
  71. package/dist/docs/static.md +29 -20
  72. package/dist/docs/suggestion.md +4 -0
  73. package/dist/docs/sync.md +4 -0
  74. package/dist/docs/table.md +31 -0
  75. package/dist/docs/toc.md +14 -0
  76. package/dist/docs/toolbar.md +4 -0
  77. package/dist/docs/unit-testing.md +4 -0
  78. package/dist/docs/upload.md +4 -0
  79. package/dist/docx/export/index.d.ts +5 -5
  80. package/dist/docx/import/index.d.ts +5 -5
  81. package/dist/docx/paste/index.d.ts +4 -4
  82. package/dist/dom/index.d.ts +1 -1
  83. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +1 -1
  84. package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +61 -28
  85. package/dist/features/basic-styles/lib/BaseStylePlugins.js +28 -7
  86. package/dist/features/board/index.d.ts +1 -1
  87. package/dist/features/callout/index.d.ts +2 -160
  88. package/dist/features/callout/lib/BaseCalloutPlugin.js +109 -9
  89. package/dist/features/column/index.d.ts +1 -1
  90. package/dist/features/comments/index.d.ts +2 -2
  91. package/dist/features/date/index.d.ts +3 -3
  92. package/dist/features/details/index.d.ts +3 -3
  93. package/dist/features/field/index.d.ts +1 -1
  94. package/dist/features/field/lib/BaseFieldPlugin.js +111 -53
  95. package/dist/features/field/lib/fieldCache.internal.js +9 -21
  96. package/dist/features/find/index.d.ts +3 -3
  97. package/dist/features/footnote/index.d.ts +3 -3
  98. package/dist/features/ink/index.d.ts +1 -1
  99. package/dist/features/link/lib/BaseLinkPlugin.js +5 -2
  100. package/dist/features/lint/index.d.ts +3 -3
  101. package/dist/features/list/lib/listKeyboard.internal.js +7 -2
  102. package/dist/features/lock/index.d.ts +1 -1
  103. package/dist/features/media/index.d.ts +1 -1
  104. package/dist/features/mention/index.d.ts +1 -1
  105. package/dist/features/reference/index.d.ts +240 -0
  106. package/dist/features/reference/index.js +2 -0
  107. package/dist/features/reference/lib/BaseReferencePlugin.js +598 -0
  108. package/dist/features/table/index.d.ts +2 -2
  109. package/dist/features/toc/index.d.ts +1 -1
  110. package/dist/features/upload/index.d.ts +1 -1
  111. package/dist/history/index.d.ts +1 -1
  112. package/dist/html/index.d.ts +4 -4
  113. package/dist/html/server/index.d.ts +2 -2
  114. package/dist/html/server/serverCssParser.internal.js +14 -25
  115. package/dist/html/server/serverCssStyle.internal.js +4 -7
  116. package/dist/{htmlConversion-Y-M6PLRi.d.ts → htmlConversion-CHcWrkh5.d.ts} +2 -2
  117. package/dist/{htmlTypes-CNhoCFjK.d.ts → htmlTypes-9HQ8p7c5.d.ts} +3 -3
  118. package/dist/hyperscript/index.d.ts +1 -1
  119. package/dist/index-1JPYTyFo.d.ts +305 -0
  120. package/dist/index-B-SGl9uM.d.ts +1 -0
  121. package/dist/{index-qqrnWAk_.d.ts → index-B048Z6JD.d.ts} +7 -7
  122. package/dist/index-BFkl1TNK.d.ts +1 -0
  123. package/dist/{index-DYuqsDrP.d.ts → index-BRwhNV78.d.ts} +3 -3
  124. package/dist/{index-B0R9sXv2-T1dxG9oM.d.ts → index-BYv6zIL_-DWmaXzbX.d.ts} +4 -4
  125. package/dist/{index-B-8L9f6a2.d.ts → index-Bm8V8SS4.d.ts} +5 -5
  126. package/dist/{index-B8JeECEk.d.ts → index-BujEk356.d.ts} +2 -2
  127. package/dist/{index-CHud6Aa-.d.ts → index-C4KIDKwP.d.ts} +3 -3
  128. package/dist/{index-B4aToRMv.d.ts → index-CAFKQNqu.d.ts} +3 -3
  129. package/dist/{index-Bqva6PJc.d.ts → index-CXJwwbAJ.d.ts} +3 -3
  130. package/dist/index-CfqQvdcO.d.ts +3 -0
  131. package/dist/{index-D54VPeky.d.ts → index-Cj09P2Qp.d.ts} +2 -2
  132. package/dist/{index-mcBtG6pK-CitQV9Bq.d.ts → index-CnumypT3-DGx8_6Ye.d.ts} +2 -2
  133. package/dist/{index-CWutqVQ_-BO-UgVeK.d.ts → index-DTTSk3WQ-D0TA0B5z.d.ts} +1 -1
  134. package/dist/{index-CLPMcGC5.d.ts → index-DsKfZoY4.d.ts} +4 -4
  135. package/dist/{index-UYpvOBXG.d.ts → index-UrJ6V3_e.d.ts} +2 -2
  136. package/dist/{index-DXCdafUk.d.ts → index-UuSQ_p3c.d.ts} +43 -20
  137. package/dist/{index-BEXBAmJf.d.ts → index-YNMmixU5.d.ts} +3 -3
  138. package/dist/{index-CXd5hwaH.d.ts → index-Zj4bj9bZ.d.ts} +1 -1
  139. package/dist/{index-BfJKfAwk.d.ts → index-eWzk-bcU.d.ts} +3 -3
  140. package/dist/{index-DhsryaAC.d.ts → index-h2HH9Rw8.d.ts} +1 -1
  141. package/dist/{index-DJhwDkfd.d.ts → index-l9R_LyGx.d.ts} +3 -3
  142. package/dist/{index-BFWK852j.d.ts → index-lD9iIU3j.d.ts} +3 -3
  143. package/dist/{index-D3bhjdRz.d.ts → index-lgeYbG68.d.ts} +3 -3
  144. package/dist/index.d.ts +3 -3
  145. package/dist/internal/plugin/compilePlateModel.js +24 -5
  146. package/dist/internal/plugin/pluginInjectNodeProps.js +33 -5
  147. package/dist/internal/utils/urlPolicy.js +11 -1
  148. package/dist/lib/editor/withPlite.js +8 -6
  149. package/dist/lib/plugins/html/cssLexer.internal.js +144 -37
  150. package/dist/lib/plugins/html/cssSafety.internal.js +100 -0
  151. package/dist/lib/plugins/html/htmlDecode.internal.js +2 -2
  152. package/dist/lib/plugins/html/htmlMatcher.internal.js +1 -1
  153. package/dist/lib/plugins/html/htmlRules.internal.js +2 -13
  154. package/dist/lib/plugins/html/htmlSafety.js +28 -27
  155. package/dist/lib/plugins/html/htmlSerialize.internal.js +16 -2
  156. package/dist/lib/plugins/html/htmlStyleInline.internal.js +38 -31
  157. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +27 -1
  158. package/dist/markdown/index.d.ts +1 -1
  159. package/dist/markdown/lib/internal/markdownAttributes.js +16 -7
  160. package/dist/markdown/lib/internal/markdownMappings.js +123 -16
  161. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +16 -1
  162. package/dist/math/index.d.ts +3 -3
  163. package/dist/math/react/index.d.ts +4 -4
  164. package/dist/migrations/index.d.ts +4 -4
  165. package/dist/migrations/migratePlateV54Urls.internal.js +63 -1
  166. package/dist/pagination/index.d.ts +1 -1
  167. package/dist/pagination/react/PaginationPlugin.js +46 -43
  168. package/dist/pagination/react/index.d.ts +13 -7
  169. package/dist/{protocol-CSuP7AWG-DAorqpaF.d.ts → protocol-CYflJUT3-CRJPCqOO.d.ts} +1 -1
  170. package/dist/react/authored/index.d.ts +4 -4
  171. package/dist/react/components/PlateView.js +7 -1
  172. package/dist/react/features/board/index.d.ts +5 -5
  173. package/dist/react/features/callout/index.d.ts +93 -4
  174. package/dist/react/features/column/index.d.ts +5 -5
  175. package/dist/react/features/combobox/combobox.internal.js +35 -22
  176. package/dist/react/features/combobox/comboboxOwner.internal.js +29 -2
  177. package/dist/react/features/combobox/index.d.ts +8 -6
  178. package/dist/react/features/comments/index.d.ts +6 -6
  179. package/dist/react/features/date/index.d.ts +4 -4
  180. package/dist/react/features/details/index.d.ts +4 -4
  181. package/dist/react/features/field/FieldPlugin.js +2 -2
  182. package/dist/react/features/field/index.d.ts +5 -5
  183. package/dist/react/features/footnote/index.d.ts +4 -4
  184. package/dist/react/features/format-painter/FormatPainterPlugin.js +27 -34
  185. package/dist/react/features/format-painter/index.d.ts +4 -4
  186. package/dist/react/features/ink/index.d.ts +5 -5
  187. package/dist/react/features/lock/index.d.ts +5 -5
  188. package/dist/react/features/media/index.d.ts +5 -5
  189. package/dist/react/features/mention/index.d.ts +4 -4
  190. package/dist/react/features/table/index.d.ts +6 -6
  191. package/dist/react/features/toc/index.d.ts +2 -2
  192. package/dist/react/features/upload/index.d.ts +5 -5
  193. package/dist/react/index.d.ts +6 -6
  194. package/dist/react/virtualized.d.ts +3 -3
  195. package/dist/refusal-VX2Y6Wmd-BJzbgrSZ.d.ts +1 -0
  196. package/dist/{registerEditorTools-Cl-o_Wnq.d.ts → registerEditorTools-DoRs57-M.d.ts} +16 -8
  197. package/dist/shared-room-BZxUmqjV-BJzbgrSZ.d.ts +1 -0
  198. package/dist/skills/plate/SKILL.md +4 -3
  199. package/dist/skills/plate/references/ai-and-agents.md +2 -2
  200. package/dist/skills/plate/references/pricing.md +3 -3
  201. package/dist/skills/plate/references/setup.md +6 -0
  202. package/dist/skills/plate/references/ui-and-sync.md +4 -3
  203. package/dist/{source-DUP5aKcT.d.ts → source-PTxjcq4_.d.ts} +3 -3
  204. package/dist/static/index.d.ts +23 -9
  205. package/dist/static/internal/staticPendingMedia.internal.js +2 -1
  206. package/dist/static/internal/staticPresentation.js +1 -0
  207. package/dist/static/renderStaticHtml.js +85 -39
  208. package/dist/{storage-EzfLDqRy-Cu4DQ-Rf.d.ts → storage-CkRL-SHq-CBP6PGqr.d.ts} +2 -2
  209. package/dist/sync/cloudflare/index.d.ts +3 -3
  210. package/dist/sync/index.d.ts +4 -4
  211. package/dist/sync/postgres/index.d.ts +1 -1
  212. package/dist/sync/react/index.d.ts +6 -6
  213. package/dist/sync/server/index.d.ts +5 -5
  214. package/dist/tabbable/react/index.d.ts +4 -4
  215. package/dist/testing/index.d.ts +3 -3
  216. package/dist/{transport-DAforzBt-BFwAhC-N.d.ts → transport-2koNcrqA-Dp_RYE3n.d.ts} +1 -1
  217. package/dist/utils/plate-keys.js +1 -0
  218. package/dist/{widths-BjIZxtaJ.d.ts → widths-DN1W6m66.d.ts} +5 -5
  219. package/package.json +9 -2
  220. package/dist/clipboard-format-key-D9rnh20X-CR00YA0H.d.ts +0 -1
  221. package/dist/index-CKAkaSJK.d.ts +0 -3
  222. package/dist/index-CxyK4HrT.d.ts +0 -1
  223. package/dist/index-zcb_RtZC.d.ts +0 -1
  224. package/dist/refusal-DCzeB9nD-CR00YA0H.d.ts +0 -1
  225. package/dist/shared-room-Bg8qMvm1-CR00YA0H.d.ts +0 -1
  226. /package/dist/{tx-only-CWT-IURY-BqIFhy44.d.ts → tx-only-x32UA-pQ-OQbgWQrN.d.ts} +0 -0
@@ -272,7 +272,7 @@ const BaseKbdPlugin = definePlugin(PLUGINS.kbd, {
272
272
  }),
273
273
  component: "kbd",
274
274
  rules: { selection: { affinity: "hard" } }
275
- });
275
+ }).extend((context) => ({ contributions: [inputRuleVeto.of({ mark: context.schema.key })] }));
276
276
  /** Enables subscript and superscript through one enum-valued mark. */
277
277
  const BaseScriptPlugin = definePlugin(PLUGINS.script, {
278
278
  schema: { mark: property.enum(scriptValues) },
@@ -1,9 +1,9 @@
1
- import { MAIN_ROOT_KEY, definePluginPoint, getPluginContributions, landNodePropertiesAt, vetoesWrite } from "../../../facade.js";
1
+ import { MAIN_ROOT_KEY, definePluginPoint, getPluginContributions, hasNonWritableAt, landNodePropertiesAt, resolveLocationRoot, vetoesWrite } from "../../../facade.js";
2
2
  import { getCompiledPlatePlugin } from "../../../internal/plugin/compilePlateModel.js";
3
3
  import { definePlugin } from "../../../lib/plugin/definePlugin.js";
4
4
  import { BaseParagraphPlugin } from "../../../lib/plugins/paragraph/BaseParagraphPlugin.js";
5
5
  import { PLUGINS } from "../../../utils/plate-keys.js";
6
- import { NodeApi, PathApi, RangeApi, locateAt, txLocate } from "../../../core.js";
6
+ import { NodeApi, PathApi, PointApi, RangeApi, locateAt, txLocate } from "../../../core.js";
7
7
  //#region src/features/basic-styles/lib/BaseFormattingPlugin.ts
8
8
  /**
9
9
  * Contribute the block properties clear formatting removes, and the blocks
@@ -37,6 +37,17 @@ const BaseFormattingPlugin = definePlugin(PLUGINS.formatting, {
37
37
  capture: (options = {}) => {
38
38
  const source = options.at ?? state.selection();
39
39
  if (!source || !RangeApi.isRange(source)) return void 0;
40
+ const sourceRoot = resolveLocationRoot(editor, source);
41
+ const rootChildren = sourceRoot === MAIN_ROOT_KEY ? state.children() : state.root(sourceRoot);
42
+ if (!rootChildren) return void 0;
43
+ const nodeAt = (path) => {
44
+ let current = rootChildren[path[0] ?? -1];
45
+ for (let i = 1; i < path.length; i += 1) {
46
+ if (!current || !NodeApi.isElement(current)) return void 0;
47
+ current = current.children[path[i]];
48
+ }
49
+ return current;
50
+ };
40
51
  const start = RangeApi.start(source);
41
52
  const collapsed = RangeApi.isCollapsed(source);
42
53
  const first = state.nodes.entries({
@@ -44,17 +55,18 @@ capture: (options = {}) => {
44
55
  match: (node, path) => {
45
56
  if (!NodeApi.isText(node)) return false;
46
57
  if (!collapsed && PathApi.equals(path, start.path) && start.offset === node.text.length) return false;
47
- const [parent] = state.nodes.parent(path) ?? [];
58
+ const parent = nodeAt(PathApi.parent(path));
48
59
  return !!parent && NodeApi.isElement(parent) && (!state.schema.isVoid(parent) || state.schema.isMarkableVoid(parent));
49
60
  },
50
61
  voids: true
51
62
  }).next().value;
52
63
  if (!first || !NodeApi.isText(first[0])) return void 0;
53
64
  const [leaf, leafPath] = first;
54
- const types = Array.from(state.nodes.levels({
55
- at: PathApi.parent(leafPath),
56
- reverse: true
57
- })).flatMap(([node]) => NodeApi.isElement(node) ? [node.type] : []);
65
+ const types = PathApi.ancestors(leafPath, { reverse: true }).flatMap((ancestorPath) => {
66
+ if (ancestorPath.length === 0) return [];
67
+ const ancestor = nodeAt(ancestorPath);
68
+ return ancestor && NodeApi.isElement(ancestor) ? [ancestor.type] : [];
69
+ });
58
70
  const text = Object.fromEntries(Object.entries(leaf).filter(([key]) => key !== "text" && state.schema.property({
59
71
  ancestors: types.slice(1),
60
72
  key,
@@ -72,11 +84,13 @@ capture: (options = {}) => {
72
84
  });
73
85
  const [block, blockPath] = covered;
74
86
  const contributions = getPluginContributions(editor, formatting);
87
+ const parentPath = PathApi.parent(blockPath);
88
+ const parentBlock = parentPath.length > 0 ? nodeAt(parentPath) : void 0;
75
89
  const entry = {
76
90
  index: blockPath.at(-1) ?? 0,
77
91
  node: block,
78
92
  path: blockPath,
79
- siblings: state.nodes.children(PathApi.parent(blockPath))
93
+ siblings: parentPath.length === 0 ? rootChildren : parentBlock && NodeApi.isElement(parentBlock) ? parentBlock.children : []
80
94
  };
81
95
  const kept = (key) => contributions.some((contribution) => contribution.keeps?.[key]?.(entry));
82
96
  const settings = Object.fromEntries([...new Set(contributions.flatMap((contribution) => contribution.block ?? []))].filter((key) => key in block && !kept(key)).map((key) => [key, block[key]]));
@@ -136,10 +150,11 @@ capture: (options = {}) => {
136
150
  };
137
151
  });
138
152
  };
139
- const isStyledText = (isInside) => (node, path) => {
153
+ const isWritablePath = (path, root) => !hasNonWritableAt(editor, path, { root });
154
+ const isStyledText = (isInside, root) => (node, path) => {
140
155
  if (!NodeApi.isText(node) || !isInside(path)) return false;
141
156
  const [parent] = tx.nodes.parent(path) ?? [];
142
- return !!parent && NodeApi.isElement(parent) && (!tx.schema.isVoid(parent) || tx.schema.isMarkableVoid(parent));
157
+ return !!parent && NodeApi.isElement(parent) && (!tx.schema.isVoid(parent) || tx.schema.isMarkableVoid(parent)) && isWritablePath(path, root);
143
158
  };
144
159
  const patchTexts = (target, match, write, pending) => {
145
160
  if (!target.resolve) {
@@ -170,13 +185,13 @@ capture: (options = {}) => {
170
185
  voids: true
171
186
  });
172
187
  };
173
- const clearTexts = (target, isInside) => {
174
- const styled = isStyledText(isInside);
188
+ const clearTexts = (target, isInside, root) => {
189
+ const styled = isStyledText(isInside, root);
175
190
  const uniform = /* @__PURE__ */ new Set();
176
191
  const contextual = /* @__PURE__ */ new Set();
177
192
  for (const [text] of tx.nodes.entries({
178
193
  at: target.at,
179
- match: (node, path) => NodeApi.isText(node) && isInside(path),
194
+ match: (node, path) => NodeApi.isText(node) && styled(node, path),
180
195
  voids: true
181
196
  })) for (const key of Object.keys(text)) {
182
197
  if (key === "text") continue;
@@ -194,12 +209,13 @@ capture: (options = {}) => {
194
209
  unset([...uniform], styled);
195
210
  for (const key of contextual) unset([key], (node, path) => styled(node, path) && roleAt(key, PathApi.parent(path)) === "content");
196
211
  };
197
- const clearBlocks = (entries) => {
198
- const blockAt = regionOf(entries.map(({ node, path }) => [node, path]));
212
+ const clearBlocks = (entries, root) => {
213
+ const writable = entries.filter((entry) => isWritablePath(entry.path, root));
214
+ const blockAt = regionOf(writable.map(({ node, path }) => [node, path]));
199
215
  if (!blockAt) return;
200
216
  const { blockKeys, keeps } = keepRules();
201
217
  const writes = /* @__PURE__ */ new Map();
202
- for (const entry of entries) {
218
+ for (const entry of writable) {
203
219
  const keys = blockKeys.filter((key) => key in entry.node && !keeps.some(([keptKey, keep]) => keptKey === key && keep(entry)));
204
220
  if (keys.length === 0) continue;
205
221
  const group = JSON.stringify(keys);
@@ -233,6 +249,24 @@ capture: (options = {}) => {
233
249
  const data = capturedFormats.get(format);
234
250
  const target = options.at ?? tx.selection();
235
251
  if (!data || !target || !options.at && tx.selection.nodeMode() !== null || RangeApi.isCollapsed(target)) return false;
252
+ const root = resolveLocationRoot(editor, target);
253
+ const styled = isStyledText(() => true, root);
254
+ const entries = data.block ? toEntries(tx.nodes.blocks({
255
+ at: target,
256
+ coverage: "full",
257
+ mode: "lowest"
258
+ })).filter((entry) => isWritablePath(entry.path, root)) : [];
259
+ const [start, end] = RangeApi.edges(target);
260
+ const crossesTexts = !PathApi.equals(start.path, end.path);
261
+ if (!!tx.nodes.entries({
262
+ at: target,
263
+ match: (node, path) => {
264
+ if (!NodeApi.isText(node)) return false;
265
+ if (crossesTexts && (PathApi.equals(path, start.path) && start.offset === node.text.length || PathApi.equals(path, end.path) && end.offset === 0)) return false;
266
+ return styled(node, path);
267
+ },
268
+ voids: true
269
+ }).next().done && entries.length === 0) return false;
236
270
  tx.history.newBatch();
237
271
  const anchor = tx.anchor(target, {
238
272
  association: "inward",
@@ -242,13 +276,8 @@ capture: (options = {}) => {
242
276
  at: target,
243
277
  resolve: () => anchor.resolve()
244
278
  };
245
- const entries = data.block ? toEntries(tx.nodes.blocks({
246
- at: target,
247
- coverage: "full",
248
- mode: "lowest"
249
- })) : [];
250
- clearTexts(textTarget, () => true);
251
- clearBlocks(entries);
279
+ clearTexts(textTarget, () => true, root);
280
+ clearBlocks(entries, root);
252
281
  const blockAt = regionOf(entries.map(({ node, path }) => [node, path]));
253
282
  const { keeps } = keepRules();
254
283
  const kept = (key, entry) => keeps.some(([keptKey, keep]) => keptKey === key && keep(entry));
@@ -271,7 +300,6 @@ capture: (options = {}) => {
271
300
  level: identity.level,
272
301
  type: headingType
273
302
  } : null;
274
- const root = tx.view.root() ?? MAIN_ROOT_KEY;
275
303
  const retyped = /* @__PURE__ */ new Set();
276
304
  if (data.block && blockAt) {
277
305
  const shape = (type) => {
@@ -317,8 +345,7 @@ capture: (options = {}) => {
317
345
  mode: "all"
318
346
  });
319
347
  }
320
- if (retyped.size > 0) clearTexts(textTarget, isWithin(retyped));
321
- const styled = isStyledText(() => true);
348
+ if (retyped.size > 0) clearTexts(textTarget, isWithin(retyped), root);
322
349
  const looks = /* @__PURE__ */ new Map();
323
350
  const lookAt = (path) => {
324
351
  const types = ancestorTypes(path);
@@ -361,8 +388,14 @@ capture: (options = {}) => {
361
388
  clear: txLocate(locateAt(0), (options = {}) => {
362
389
  const target = options.at ?? tx.selection();
363
390
  if (!target) return;
391
+ const root = resolveLocationRoot(editor, target);
364
392
  const blockSelection = !options.at && tx.selection.nodeMode() !== null;
365
393
  if (!blockSelection && RangeApi.isCollapsed(target)) {
394
+ if (hasNonWritableAt(editor, target, { root })) return;
395
+ if (options.at) {
396
+ const currentSelection = tx.selection();
397
+ if (!currentSelection || !RangeApi.isRange(currentSelection) || !RangeApi.isCollapsed(currentSelection) || !PointApi.equals(currentSelection.anchor, target.anchor) || resolveLocationRoot(editor, currentSelection) !== root) return;
398
+ }
366
399
  const marks = tx.marks();
367
400
  if (!marks) return;
368
401
  const parentPath = PathApi.parent(target.anchor.path);
@@ -383,9 +416,9 @@ capture: (options = {}) => {
383
416
  clearTexts({
384
417
  at: textAt,
385
418
  resolve: anchor ? () => anchor.resolve() : void 0
386
- }, blockSelection ? isWithin(new Set(selectedEntries.map(([, path]) => pathKey(path)))) : () => true);
419
+ }, blockSelection ? isWithin(new Set(selectedEntries.map(([, path]) => pathKey(path)))) : () => true, root);
387
420
  }
388
- clearBlocks(toEntries(covered));
421
+ clearBlocks(toEntries(covered), root);
389
422
  })
390
423
  };
391
424
  }
@@ -1,5 +1,6 @@
1
1
  import { hasNonWritableAt } from "../../../facade.js";
2
2
  import { definePlugin } from "../../../lib/plugin/definePlugin.js";
3
+ import { isSafeStyleValue } from "../../../lib/plugins/html/cssSafety.internal.js";
3
4
  import { BaseParagraphPlugin } from "../../../lib/plugins/paragraph/BaseParagraphPlugin.js";
4
5
  import { getInjectMatch } from "../../../lib/utils/getInjectMatch.js";
5
6
  import { PLUGINS } from "../../../utils/plate-keys.js";
@@ -48,7 +49,7 @@ const ALIGNMENTS = [
48
49
  const isAlignment = (value) => typeof value === "string" && ALIGNMENTS.some((alignment) => alignment === value);
49
50
  const docsPastes = /* @__PURE__ */ new WeakMap();
50
51
  const markDocsPaste = ({ document }) => {
51
- docsPastes.set(document, document.body.querySelector("[id^=\"docs-internal-guid\"]") !== null);
52
+ docsPastes.set(document, Boolean(document.body?.querySelector("[id^=\"docs-internal-guid\"]")));
52
53
  };
53
54
  const docsBlack = ["#000000", "rgb(0,0,0)"];
54
55
  const docsNormal = {
@@ -85,10 +86,25 @@ const docsDefaults = (context, key) => {
85
86
  return context.registry.has(PLUGINS.heading) ? headingStyle.asHeading[key] : headingStyle.asParagraph[key];
86
87
  };
87
88
  const hasBackground = (element) => !!element?.style.backgroundColor && !isDocsDefault(element.style.backgroundColor, docsNormal.backgroundColor);
89
+ const CSS_STYLE_NAMES = {
90
+ backgroundColor: "background-color",
91
+ color: "color",
92
+ fontFamily: "font-family",
93
+ fontSize: "font-size"
94
+ };
88
95
  const decodeTextStyle = (context, key) => {
89
- const { element, registry } = context;
96
+ const { element, registry, report } = context;
90
97
  const value = element.style[key];
91
- if (!value || docsPastes.get(element.ownerDocument) !== true) return value || void 0;
98
+ if (!value) return void 0;
99
+ if (!isSafeStyleValue(value)) {
100
+ report({
101
+ action: "dropped",
102
+ kind: "style",
103
+ message: `HTML style "${CSS_STYLE_NAMES[key]}" has an unsupported value; it was omitted.`
104
+ });
105
+ return;
106
+ }
107
+ if (docsPastes.get(element.ownerDocument) !== true) return value;
92
108
  if (element.tagName !== "SPAN") return void 0;
93
109
  if (key === "color" && (registry.has(PLUGINS.backgroundColor) && hasBackground(element) || registry.has(PLUGINS.tableCell) && hasBackground(element.closest("td, th")))) return value;
94
110
  return isDocsDefault(value, docsDefaults(context, key)) ? void 0 : value;
@@ -104,8 +120,13 @@ const parseFontSizePt = (value) => {
104
120
  if (unit === "em" || unit === "rem") return amount * 12;
105
121
  return amount;
106
122
  };
123
+ const isSafeStyleString = (value) => typeof value === "string" && isSafeStyleValue(value);
124
+ const safeStyleMark = property.string({
125
+ validate: isSafeStyleString,
126
+ validationVersion: 1
127
+ });
107
128
  const BaseFontBackgroundColorPlugin = definePlugin(PLUGINS.backgroundColor, {
108
- schema: { mark: property.string() },
129
+ schema: { mark: safeStyleMark },
109
130
  formats: ({ defineFormats }) => defineFormats({
110
131
  docx: {
111
132
  decode: ({ value }) => value,
@@ -129,7 +150,7 @@ const BaseFontBackgroundColorPlugin = definePlugin(PLUGINS.backgroundColor, {
129
150
  inject: { nodeProps: { styleKey: "backgroundColor" } }
130
151
  });
131
152
  const BaseFontColorPlugin = definePlugin(PLUGINS.color, {
132
- schema: { mark: property.string() },
153
+ schema: { mark: safeStyleMark },
133
154
  formats: ({ defineFormats }) => defineFormats({
134
155
  docx: {
135
156
  decode: ({ value }) => value,
@@ -153,7 +174,7 @@ const BaseFontColorPlugin = definePlugin(PLUGINS.color, {
153
174
  inject: { nodeProps: { styleKey: "color" } }
154
175
  });
155
176
  const BaseFontFamilyPlugin = definePlugin(PLUGINS.fontFamily, {
156
- schema: { mark: property.string() },
177
+ schema: { mark: safeStyleMark },
157
178
  formats: ({ defineFormats }) => defineFormats({
158
179
  docx: { encode: ({ value }) => typeof value === "string" && value.trim().length > 0 ? { fontFamily: value } : null },
159
180
  html: {
@@ -173,7 +194,7 @@ const BaseFontFamilyPlugin = definePlugin(PLUGINS.fontFamily, {
173
194
  inject: { nodeProps: { styleKey: "fontFamily" } }
174
195
  });
175
196
  const BaseFontSizePlugin = definePlugin(PLUGINS.fontSize, {
176
- schema: { mark: property.string() },
197
+ schema: { mark: safeStyleMark },
177
198
  formats: ({ defineFormats }) => defineFormats({
178
199
  docx: { encode: ({ value }) => {
179
200
  const fontSizePt = typeof value === "string" ? parseFontSizePt(value) : void 0;
@@ -1,2 +1,2 @@
1
- import { A as BoardArrowEnd, C as BoardArrowElement, F as BoardFrameEntry, H as BoardPlace, I as BoardMemberEntry, L as BoardShapeEntry, M as BoardArrowSide, P as BoardArrowEntry, R as BoardFramePlace, S as BaseBoardArrowPlugin, U as BoardRestackDirection, W as BoardSize, _ as BoardGeoElement, a as BaseBoardPlugin, b as BaseBoardFramePlugin, c as BoardStrokePath, d as BaseBoardNotePlugin, f as BoardNoteElement, g as BoardGeo, h as BaseBoardGeoPlugin, i as BoardStrokeElement, j as BoardArrowEnds, k as BoardArrowAnchor, m as BoardImageElement, n as BoardTextElement, o as BoardElement, p as BaseBoardImagePlugin, r as BaseBoardStrokePlugin, t as BaseBoardTextPlugin, w as BoardArrowEndInput, x as BoardFrameElement, y as defineBoardShape, z as BoardShapePlace } from "../../index-DYuqsDrP.js";
1
+ import { A as BoardArrowEnd, C as BoardArrowElement, F as BoardFrameEntry, H as BoardPlace, I as BoardMemberEntry, L as BoardShapeEntry, M as BoardArrowSide, P as BoardArrowEntry, R as BoardFramePlace, S as BaseBoardArrowPlugin, U as BoardRestackDirection, W as BoardSize, _ as BoardGeoElement, a as BaseBoardPlugin, b as BaseBoardFramePlugin, c as BoardStrokePath, d as BaseBoardNotePlugin, f as BoardNoteElement, g as BoardGeo, h as BaseBoardGeoPlugin, i as BoardStrokeElement, j as BoardArrowEnds, k as BoardArrowAnchor, m as BoardImageElement, n as BoardTextElement, o as BoardElement, p as BaseBoardImagePlugin, r as BaseBoardStrokePlugin, t as BaseBoardTextPlugin, w as BoardArrowEndInput, x as BoardFrameElement, y as defineBoardShape, z as BoardShapePlace } from "../../index-BRwhNV78.js";
2
2
  export { BaseBoardArrowPlugin, BaseBoardFramePlugin, BaseBoardGeoPlugin, BaseBoardImagePlugin, BaseBoardNotePlugin, BaseBoardPlugin, BaseBoardStrokePlugin, BaseBoardTextPlugin, type BoardArrowAnchor, BoardArrowElement, type BoardArrowEnd, BoardArrowEndInput, type BoardArrowEnds, type BoardArrowEntry, type BoardArrowSide, BoardElement, BoardFrameElement, type BoardFrameEntry, type BoardFramePlace, BoardGeo, BoardGeoElement, BoardImageElement, type BoardMemberEntry, BoardNoteElement, type BoardPlace, type BoardRestackDirection, type BoardShapeEntry, type BoardShapePlace, type BoardSize, BoardStrokeElement, type BoardStrokePath, BoardTextElement, defineBoardShape };
@@ -1,160 +1,2 @@
1
- import { Bi as Location, Da as NodeSelection, Es as SchemaContentRule, Mt as EditorJsonValue, Qo as PropertyValueOptions, Vl as TxDeclaredMethod, gs as SchemaContentDefault, qo as PropertyStringDescriptor, wi as ElementOf } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { fo as PluginReference, lt as BlockUpsertOptions, p as BasePlugin, uo as PluginDependency } from "../../core-CTB0OBoh.js";
4
- type CalloutProps = Readonly<{
5
- backgroundColor?: string;
6
- icon?: string;
7
- variant?: string;
8
- }>;
9
- type CalloutWrapOptions = CalloutProps & Readonly<{
10
- at?: Location | NodeSelection;
11
- }>;
12
- /** Enables multi-block callout containers with optional icon, variant, and background color. */
13
- declare const BaseCalloutPlugin: BasePlugin<Readonly<{
14
- formats: true;
15
- rules: true;
16
- }> & Readonly<{
17
- name: "callout";
18
- }> & Readonly<{
19
- dependencies: readonly [PluginReference<"paragraph"> & PluginDependency<Readonly<{
20
- name: "paragraph";
21
- }> & Readonly<{
22
- __pluginWritableProperties: never;
23
- }> & Readonly<Record<"schema", {
24
- readonly element: Readonly<{
25
- content: Readonly<{
26
- allowed: Readonly<{
27
- kind: 'any';
28
- rules: readonly [Readonly<{
29
- kind: 'text';
30
- }>, Readonly<{
31
- group: 'inline';
32
- kind: 'group';
33
- }>];
34
- }>;
35
- prefix?: readonly Readonly<{
36
- element: string | Readonly<{
37
- source: string;
38
- type: string;
39
- }>;
40
- properties?: Readonly<Record<string, EditorJsonValue>>;
41
- }>[] | undefined;
42
- } & Readonly<{
43
- default: 'text';
44
- min: 1;
45
- }> & Readonly<{
46
- '~schema.content.rule'?: Readonly<{
47
- kind: 'any';
48
- rules: readonly [Readonly<{
49
- kind: 'text';
50
- }>, Readonly<{
51
- group: 'inline';
52
- kind: 'group';
53
- }>];
54
- }> | undefined;
55
- }>>;
56
- }>;
57
- }>> & Readonly<Record<never, never>>> & Pick<BasePlugin<Readonly<{
58
- formats: true;
59
- rules: true;
60
- }> & Readonly<{
61
- name: "paragraph";
62
- }> & Readonly<Record<never, never>> & Readonly<{
63
- __pluginWritableProperties: never;
64
- schema: {
65
- readonly element: Readonly<{
66
- content: Readonly<{
67
- allowed: Readonly<{
68
- kind: 'any';
69
- rules: readonly [Readonly<{
70
- kind: 'text';
71
- }>, Readonly<{
72
- group: 'inline';
73
- kind: 'group';
74
- }>];
75
- }>;
76
- prefix?: readonly Readonly<{
77
- element: string | Readonly<{
78
- source: string;
79
- type: string;
80
- }>;
81
- properties?: Readonly<Record<string, EditorJsonValue>>;
82
- }>[] | undefined;
83
- } & Readonly<{
84
- default: 'text';
85
- min: 1;
86
- }> & Readonly<{
87
- '~schema.content.rule'?: Readonly<{
88
- kind: 'any';
89
- rules: readonly [Readonly<{
90
- kind: 'text';
91
- }>, Readonly<{
92
- group: 'inline';
93
- kind: 'group';
94
- }>];
95
- }> | undefined;
96
- }>>;
97
- }>;
98
- };
99
- }>>, "~schema.plugins">];
100
- }> & Readonly<Record<never, never>> & Readonly<{
101
- update: {
102
- readonly toggle: TxDeclaredMethod<(options?: CalloutWrapOptions) => boolean>;
103
- readonly unwrap: TxDeclaredMethod<({ at }?: {
104
- at?: Location | NodeSelection;
105
- }) => boolean>;
106
- readonly upsert: TxDeclaredMethod<(data?: CalloutProps, options?: BlockUpsertOptions) => boolean>;
107
- readonly wrap: TxDeclaredMethod<({ at, ...rest }?: CalloutWrapOptions) => boolean>;
108
- };
109
- }> & Readonly<{
110
- __pluginWritableProperties: Readonly<{
111
- descriptor: PropertyStringDescriptor<PropertyValueOptions<string>>;
112
- key: "backgroundColor";
113
- localId: "backgroundColor";
114
- ownerName: "callout";
115
- placement: "element";
116
- unaliased: true;
117
- value: string;
118
- }> | Readonly<{
119
- descriptor: PropertyStringDescriptor<PropertyValueOptions<string>>;
120
- key: "icon";
121
- localId: "icon";
122
- ownerName: "callout";
123
- placement: "element";
124
- unaliased: true;
125
- value: string;
126
- }> | Readonly<{
127
- descriptor: PropertyStringDescriptor<PropertyValueOptions<string>>;
128
- key: "variant";
129
- localId: "variant";
130
- ownerName: "callout";
131
- placement: "element";
132
- unaliased: true;
133
- value: string;
134
- }>;
135
- schema: {
136
- readonly element: {
137
- content: Readonly<{
138
- allowed: SchemaContentRule;
139
- prefix?: readonly Readonly<{
140
- element: string | Readonly<{
141
- source: string;
142
- type: string;
143
- }>;
144
- properties?: Readonly<Record<string, EditorJsonValue>>;
145
- }>[] | undefined;
146
- } & Readonly<{
147
- default?: SchemaContentDefault;
148
- max?: number;
149
- min?: number;
150
- }>>;
151
- properties: {
152
- backgroundColor: PropertyStringDescriptor<PropertyValueOptions<string>>;
153
- icon: PropertyStringDescriptor<PropertyValueOptions<string>>;
154
- variant: PropertyStringDescriptor<PropertyValueOptions<string>>;
155
- };
156
- };
157
- };
158
- }>>;
159
- type CalloutElement = ElementOf<typeof BaseCalloutPlugin>;
160
- export { BaseCalloutPlugin, CalloutElement };
1
+ import { n as CalloutAction, r as CalloutElement, t as BaseCalloutPlugin } from "../../index-1JPYTyFo.js";
2
+ export { BaseCalloutPlugin, CalloutAction, CalloutElement };
@@ -22,7 +22,76 @@ const CALLOUT_GFM_ALLOWED_KEYS = /* @__PURE__ */ new Set([
22
22
  "type",
23
23
  "variant"
24
24
  ]);
25
- const pickCalloutProps = ({ backgroundColor, icon, variant }) => ({
25
+ const MAX_CALLOUT_ACTIONS = 16;
26
+ const MAX_ACTION_ID_LENGTH = 64;
27
+ const MAX_ACTION_LABEL_LENGTH = 120;
28
+ const MAX_ACTION_KIND_LENGTH = 64;
29
+ const MAX_ACTION_CONFIRM_LENGTH = 500;
30
+ const MAX_PAYLOAD_DEPTH = 6;
31
+ const MAX_PAYLOAD_KEYS = 64;
32
+ const CALLOUT_ACTION_KEYS = /* @__PURE__ */ new Set([
33
+ "confirm",
34
+ "id",
35
+ "kind",
36
+ "label",
37
+ "payload"
38
+ ]);
39
+ const FORBIDDEN_JSON_KEYS = /* @__PURE__ */ new Set([
40
+ "__proto__",
41
+ "constructor",
42
+ "prototype"
43
+ ]);
44
+ const isPlainObject = (value) => {
45
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
46
+ const proto = Object.getPrototypeOf(value);
47
+ return proto === Object.prototype || proto === null;
48
+ };
49
+ const isNonEmptyBoundedString = (value, maxLength) => typeof value === "string" && value.trim().length > 0 && value.length <= maxLength;
50
+ const isSafeJsonValue = (value, depth, budget) => {
51
+ if (value === null || typeof value === "boolean" || typeof value === "string") return true;
52
+ if (typeof value === "number") return Number.isFinite(value);
53
+ if (depth >= MAX_PAYLOAD_DEPTH) return false;
54
+ if (Array.isArray(value)) {
55
+ for (const item of value) {
56
+ budget.remainingKeys -= 1;
57
+ if (budget.remainingKeys < 0) return false;
58
+ if (!isSafeJsonValue(item, depth + 1, budget)) return false;
59
+ }
60
+ return true;
61
+ }
62
+ if (!isPlainObject(value)) return false;
63
+ for (const [key, entry] of Object.entries(value)) {
64
+ if (FORBIDDEN_JSON_KEYS.has(key)) return false;
65
+ budget.remainingKeys -= 1;
66
+ if (budget.remainingKeys < 0) return false;
67
+ if (!isSafeJsonValue(entry, depth + 1, budget)) return false;
68
+ }
69
+ return true;
70
+ };
71
+ const isSafeJsonObject = (value) => {
72
+ if (!isPlainObject(value)) return false;
73
+ return isSafeJsonValue(value, 0, { remainingKeys: MAX_PAYLOAD_KEYS });
74
+ };
75
+ const isCalloutActions = (value) => {
76
+ if (!Array.isArray(value) || value.length === 0 || value.length > MAX_CALLOUT_ACTIONS) return false;
77
+ const seenIds = /* @__PURE__ */ new Set();
78
+ for (const item of value) {
79
+ if (!isPlainObject(item)) return false;
80
+ for (const key of Object.keys(item)) if (!CALLOUT_ACTION_KEYS.has(key) || FORBIDDEN_JSON_KEYS.has(key)) return false;
81
+ const { confirm, id, kind, label, payload } = item;
82
+ if (!isNonEmptyBoundedString(id, MAX_ACTION_ID_LENGTH)) return false;
83
+ const trimmedId = id.trim();
84
+ if (id !== trimmedId || seenIds.has(trimmedId)) return false;
85
+ seenIds.add(trimmedId);
86
+ if (!isNonEmptyBoundedString(label, MAX_ACTION_LABEL_LENGTH)) return false;
87
+ if (kind !== void 0 && !isNonEmptyBoundedString(kind, MAX_ACTION_KIND_LENGTH)) return false;
88
+ if (confirm !== void 0 && !isNonEmptyBoundedString(confirm, MAX_ACTION_CONFIRM_LENGTH)) return false;
89
+ if (payload !== void 0 && !isSafeJsonObject(payload)) return false;
90
+ }
91
+ return true;
92
+ };
93
+ const pickCalloutProps = ({ actions, backgroundColor, icon, variant }) => ({
94
+ ...actions !== void 0 ? { actions } : {},
26
95
  ...backgroundColor !== void 0 ? { backgroundColor } : {},
27
96
  ...icon !== void 0 ? { icon } : {},
28
97
  ...variant !== void 0 ? { variant } : {}
@@ -85,36 +154,67 @@ const BaseCalloutPlugin = definePlugin(PLUGINS.callout, {
85
154
  min: 1
86
155
  }),
87
156
  properties: {
157
+ actions: property.json({
158
+ validate: isCalloutActions,
159
+ validationVersion: 1
160
+ }),
88
161
  backgroundColor: property.string(),
89
162
  icon: property.string(),
90
163
  variant: property.string()
91
164
  }
92
165
  } }),
93
166
  formats: ({ defineFormats, schema: { type } }) => defineFormats({
94
- docx: { encode: ({ encodeBlocks, node }) => ({
95
- ...node.backgroundColor ? { backgroundColor: node.backgroundColor } : {},
96
- ...node.icon ? { icon: node.icon } : {},
97
- ...node.variant ? { variant: node.variant } : {},
98
- children: encodeBlocks(),
99
- kind: "callout"
100
- }) },
167
+ docx: { encode: ({ encodeBlocks, node, report }) => {
168
+ const encodedChildren = encodeBlocks();
169
+ if (node.actions && node.actions.length > 0) report({
170
+ action: "replaced",
171
+ code: "lossy-content",
172
+ feature: "callout.actions",
173
+ impact: "lossy",
174
+ message: "Word export renders workflow callout actions as plain labels and drops interactive handlers."
175
+ });
176
+ return {
177
+ ...node.backgroundColor ? { backgroundColor: node.backgroundColor } : {},
178
+ ...node.icon ? { icon: node.icon } : {},
179
+ ...node.variant ? { variant: node.variant } : {},
180
+ children: node.actions && node.actions.length > 0 ? [...encodedChildren, {
181
+ children: [{
182
+ kind: "text",
183
+ text: `Actions: ${node.actions.map((action) => `[${action.label}]`).join(" ")}`
184
+ }],
185
+ kind: "paragraph"
186
+ }] : encodedChildren,
187
+ kind: "callout"
188
+ };
189
+ } },
101
190
  html: {
102
191
  decode: ({ element, preserve }) => {
103
192
  preserve("data-editor-html-callout", "data-editor-html-callout-background-color", "data-editor-html-callout-icon", "data-editor-html-callout-variant");
193
+ const rawActions = element.getAttribute("data-editor-html-callout-actions");
194
+ let actions;
195
+ if (rawActions !== null) try {
196
+ const parsed = JSON.parse(rawActions);
197
+ if (isCalloutActions(parsed)) {
198
+ preserve("data-editor-html-callout-actions");
199
+ actions = parsed;
200
+ }
201
+ } catch {}
104
202
  const backgroundColor = element.getAttribute("data-editor-html-callout-background-color");
105
203
  const icon = element.getAttribute("data-editor-html-callout-icon");
106
204
  const variant = element.getAttribute("data-editor-html-callout-variant");
107
205
  return {
206
+ ...actions !== void 0 ? { actions } : {},
108
207
  ...backgroundColor !== null ? { backgroundColor } : {},
109
208
  ...icon !== null ? { icon } : {},
110
209
  ...variant !== null ? { variant } : {}
111
210
  };
112
211
  },
113
212
  encode: ({ content, node, preserve }) => {
114
- preserve("backgroundColor", "icon", "variant");
213
+ preserve("actions", "backgroundColor", "icon", "variant");
115
214
  return {
116
215
  attributes: {
117
216
  "data-editor-html-callout": "true",
217
+ "data-editor-html-callout-actions": node.actions ? JSON.stringify(node.actions) : void 0,
118
218
  "data-editor-html-callout-background-color": node.backgroundColor,
119
219
  "data-editor-html-callout-icon": node.icon,
120
220
  "data-editor-html-callout-variant": node.variant
@@ -1,2 +1,2 @@
1
- import { a as ColumnTargetOptions, c as ResizeColumnsOptions, i as ColumnGroupElement, l as SetColumnsOptions, n as BaseColumnItemPlugin, o as InsertColumnGroupInput, r as ColumnElement, s as InsertColumnOptions, t as BaseColumnGroupPlugin, u as ToggleColumnGroupOptions } from "../../index-BEXBAmJf.js";
1
+ import { a as ColumnTargetOptions, c as ResizeColumnsOptions, i as ColumnGroupElement, l as SetColumnsOptions, n as BaseColumnItemPlugin, o as InsertColumnGroupInput, r as ColumnElement, s as InsertColumnOptions, t as BaseColumnGroupPlugin, u as ToggleColumnGroupOptions } from "../../index-YNMmixU5.js";
2
2
  export { BaseColumnGroupPlugin, BaseColumnItemPlugin, ColumnElement, ColumnGroupElement, ColumnTargetOptions, InsertColumnGroupInput, InsertColumnOptions, ResizeColumnsOptions, SetColumnsOptions, ToggleColumnGroupOptions };
@@ -1,3 +1,3 @@
1
- import { i as CommentAnchors, n as CommentAnchorEndpoint, r as CommentAnchorQuote, t as CommentAnchor } from "../../comment-anchor.internal-DTBP1huU.js";
2
- import { A as PendingComment, C as CommentsChange, D as CommentsSnapshot, E as CommentsPluginViewState, M as encodeCommentAnchor, N as CommentAttachmentChange, O as CreateCommentThreadInput, S as CommentThread, T as CommentsPluginState, _ as CommentRemoteDelete, a as CommentChangeMember, b as CommentResolution, c as CommentDataList, d as CommentMessage, f as CommentMutationDecision, g as CommentOperation, h as CommentMutationResult, i as CommentAttachment, j as SavedComments, k as CreateCommentThreadTarget, l as CommentDataValue, m as CommentMutationRequest, n as fitCommentBody, o as CommentChangeTargetStatus, p as CommentMutationOptions, r as BaseCommentsPlugin, s as CommentData, t as FitCommentBodyOptions, u as CommentInvalidReason, v as CommentRemoteUpdate, w as CommentsLoadIssue, x as CommentTarget, y as CommentRemoteUpsert } from "../../index-CLPMcGC5.js";
1
+ import { i as CommentAnchors, n as CommentAnchorEndpoint, r as CommentAnchorQuote, t as CommentAnchor } from "../../comment-anchor.internal-Ck30WbG4.js";
2
+ import { A as PendingComment, C as CommentsChange, D as CommentsSnapshot, E as CommentsPluginViewState, M as encodeCommentAnchor, N as CommentAttachmentChange, O as CreateCommentThreadInput, S as CommentThread, T as CommentsPluginState, _ as CommentRemoteDelete, a as CommentChangeMember, b as CommentResolution, c as CommentDataList, d as CommentMessage, f as CommentMutationDecision, g as CommentOperation, h as CommentMutationResult, i as CommentAttachment, j as SavedComments, k as CreateCommentThreadTarget, l as CommentDataValue, m as CommentMutationRequest, n as fitCommentBody, o as CommentChangeTargetStatus, p as CommentMutationOptions, r as BaseCommentsPlugin, s as CommentData, t as FitCommentBodyOptions, u as CommentInvalidReason, v as CommentRemoteUpdate, w as CommentsLoadIssue, x as CommentTarget, y as CommentRemoteUpsert } from "../../index-DsKfZoY4.js";
3
3
  export { BaseCommentsPlugin, type CommentAnchor, type CommentAnchorEndpoint, type CommentAnchorQuote, type CommentAnchors, CommentAttachment, type CommentAttachmentChange, CommentChangeMember, CommentChangeTargetStatus, CommentData, CommentDataList, CommentDataValue, CommentInvalidReason, CommentMessage, CommentMutationDecision, CommentMutationOptions, CommentMutationRequest, CommentMutationResult, CommentOperation, CommentRemoteDelete, CommentRemoteUpdate, CommentRemoteUpsert, CommentResolution, CommentTarget, CommentThread, CommentsChange, CommentsLoadIssue, CommentsPluginState, CommentsPluginViewState, CommentsSnapshot, CreateCommentThreadInput, CreateCommentThreadTarget, FitCommentBodyOptions, PendingComment, SavedComments, encodeCommentAnchor, fitCommentBody };
@@ -1,6 +1,6 @@
1
- import { Vl as TxDeclaredMethod, qo as PropertyStringDescriptor, wi as ElementOf } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { p as BasePlugin, vt as NodeInsertOptions } from "../../core-CTB0OBoh.js";
1
+ import { Vl as TxDeclaredMethod, qo as PropertyStringDescriptor, wi as ElementOf } from "../../tx-only-x32UA-pQ-OQbgWQrN.js";
2
+ import "../../htmlTypes-9HQ8p7c5.js";
3
+ import { p as BasePlugin, vt as NodeInsertOptions } from "../../core-DoxvjG5W.js";
4
4
  declare const BaseDatePlugin: BasePlugin<Readonly<{
5
5
  readonly __pluginWritableProperties: Readonly<{
6
6
  descriptor: PropertyStringDescriptor<{
@@ -1,6 +1,6 @@
1
- import { Bi as Location, Da as NodeSelection, Es as SchemaContentRule, Mt as EditorJsonValue, Vl as TxDeclaredMethod, Vo as PropertyJsonDescriptor, gs as SchemaContentDefault, ma as NodeKey, wi as ElementOf, ys as SchemaContentPrefixSlot } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { Sa as HeadingLevel, ct as BlockInsertOptions, fo as PluginReference, lt as BlockUpsertOptions, p as BasePlugin, uo as PluginDependency } from "../../core-CTB0OBoh.js";
1
+ import { Bi as Location, Da as NodeSelection, Es as SchemaContentRule, Mt as EditorJsonValue, Vl as TxDeclaredMethod, Vo as PropertyJsonDescriptor, gs as SchemaContentDefault, ma as NodeKey, wi as ElementOf, ys as SchemaContentPrefixSlot } from "../../tx-only-x32UA-pQ-OQbgWQrN.js";
2
+ import "../../htmlTypes-9HQ8p7c5.js";
3
+ import { Sa as HeadingLevel, ct as BlockInsertOptions, fo as PluginReference, lt as BlockUpsertOptions, p as BasePlugin, uo as PluginDependency } from "../../core-DoxvjG5W.js";
4
4
  declare const isSummaryHeadingLevel: (value: unknown) => value is HeadingLevel;
5
5
  type BaseDetailsViewState = {
6
6
  openKeys: Set<NodeKey>;