platejs 54.0.0-beta.13 → 54.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/{EditorStatic-CKG5xM3y.d.ts → EditorStatic-eXOA489B.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-qetvpvU--DSWESzxK.d.ts} +3 -3
  13. package/dist/clipboard-format-key-BBu85J9m-BLhtd159.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-CoNK9gTD.d.ts} +2 -2
  16. package/dist/compiler/index.d.ts +3 -3
  17. package/dist/{core-CTB0OBoh.d.ts → core-By92GWYW.d.ts} +45 -20
  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 +4 -0
  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 +40 -28
  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 +4 -0
  58. package/dist/docs/llms.txt +3 -1
  59. package/dist/docs/lock.md +34 -2
  60. package/dist/docs/markdown.md +4 -0
  61. package/dist/docs/media.md +4 -0
  62. package/dist/docs/mention.md +5 -0
  63. package/dist/docs/pagination.md +4 -0
  64. package/dist/docs/prompt-editor.md +17 -1
  65. package/dist/docs/reference.md +192 -0
  66. package/dist/docs/roots.md +4 -0
  67. package/dist/docs/serializing.md +23 -0
  68. package/dist/docs/slash-command.md +58 -4
  69. package/dist/docs/static.md +29 -20
  70. package/dist/docs/suggestion.md +4 -0
  71. package/dist/docs/sync.md +4 -0
  72. package/dist/docs/table.md +31 -0
  73. package/dist/docs/toolbar.md +4 -0
  74. package/dist/docs/unit-testing.md +4 -0
  75. package/dist/docs/upload.md +4 -0
  76. package/dist/docx/export/index.d.ts +5 -5
  77. package/dist/docx/import/index.d.ts +5 -5
  78. package/dist/docx/paste/index.d.ts +4 -4
  79. package/dist/dom/index.d.ts +1 -1
  80. package/dist/features/basic-nodes/lib/BaseMarkPlugins.js +1 -1
  81. package/dist/features/basic-styles/lib/BaseFormattingPlugin.js +61 -28
  82. package/dist/features/basic-styles/lib/BaseStylePlugins.js +28 -7
  83. package/dist/features/board/index.d.ts +1 -1
  84. package/dist/features/callout/index.d.ts +2 -160
  85. package/dist/features/callout/lib/BaseCalloutPlugin.js +109 -9
  86. package/dist/features/column/index.d.ts +1 -1
  87. package/dist/features/comments/index.d.ts +2 -2
  88. package/dist/features/date/index.d.ts +3 -3
  89. package/dist/features/details/index.d.ts +3 -3
  90. package/dist/features/field/index.d.ts +1 -1
  91. package/dist/features/field/lib/BaseFieldPlugin.js +111 -53
  92. package/dist/features/field/lib/fieldCache.internal.js +9 -21
  93. package/dist/features/find/index.d.ts +3 -3
  94. package/dist/features/footnote/index.d.ts +3 -3
  95. package/dist/features/ink/index.d.ts +1 -1
  96. package/dist/features/link/lib/BaseLinkPlugin.js +5 -2
  97. package/dist/features/lint/index.d.ts +3 -3
  98. package/dist/features/list/lib/listKeyboard.internal.js +7 -2
  99. package/dist/features/lock/index.d.ts +1 -1
  100. package/dist/features/media/index.d.ts +1 -1
  101. package/dist/features/mention/index.d.ts +1 -1
  102. package/dist/features/reference/index.d.ts +236 -0
  103. package/dist/features/reference/index.js +2 -0
  104. package/dist/features/reference/lib/BaseReferencePlugin.js +589 -0
  105. package/dist/features/table/index.d.ts +2 -2
  106. package/dist/features/toc/index.d.ts +1 -1
  107. package/dist/features/upload/index.d.ts +1 -1
  108. package/dist/history/index.d.ts +1 -1
  109. package/dist/html/index.d.ts +4 -4
  110. package/dist/html/server/index.d.ts +2 -2
  111. package/dist/html/server/serverCssParser.internal.js +14 -25
  112. package/dist/html/server/serverCssStyle.internal.js +4 -7
  113. package/dist/{htmlConversion-Y-M6PLRi.d.ts → htmlConversion-CRnxMGw-.d.ts} +2 -2
  114. package/dist/{htmlTypes-CNhoCFjK.d.ts → htmlTypes-3laowz-3.d.ts} +3 -3
  115. package/dist/hyperscript/index.d.ts +1 -1
  116. package/dist/{index-B-8L9f6a2.d.ts → index-B3VOCxNR.d.ts} +5 -5
  117. package/dist/{index-B8JeECEk.d.ts → index-B9UlNijk.d.ts} +2 -2
  118. package/dist/{index-Bqva6PJc.d.ts → index-BJPT0Tv_.d.ts} +3 -3
  119. package/dist/{index-CWutqVQ_-BO-UgVeK.d.ts → index-BKPWmnLg-Bp_vItjr.d.ts} +1 -1
  120. package/dist/{index-BFWK852j.d.ts → index-BcD2RAB9.d.ts} +3 -3
  121. package/dist/{index-DhsryaAC.d.ts → index-C5Xw3JDc.d.ts} +1 -1
  122. package/dist/{index-BEXBAmJf.d.ts → index-CAshLTjV.d.ts} +3 -3
  123. package/dist/{index-qqrnWAk_.d.ts → index-CHlITvuq.d.ts} +7 -7
  124. package/dist/index-CKSwab_O.d.ts +1 -0
  125. package/dist/{index-DJhwDkfd.d.ts → index-CRQoHk18.d.ts} +3 -3
  126. package/dist/index-CyY3O6c7.d.ts +3 -0
  127. package/dist/index-D8EGVCeT.d.ts +305 -0
  128. package/dist/{index-B0R9sXv2-T1dxG9oM.d.ts → index-DAKucat0--VOaL_NN.d.ts} +4 -4
  129. package/dist/{index-UYpvOBXG.d.ts → index-DCTRNYwy.d.ts} +2 -2
  130. package/dist/{index-CXd5hwaH.d.ts → index-DQpHoxDX.d.ts} +1 -1
  131. package/dist/{index-BfJKfAwk.d.ts → index-DTd1D-BF.d.ts} +3 -3
  132. package/dist/index-DUhUT9bV.d.ts +1 -0
  133. package/dist/{index-B4aToRMv.d.ts → index-DXm_v0Qq.d.ts} +3 -3
  134. package/dist/{index-D3bhjdRz.d.ts → index-Djwcl0Ff.d.ts} +3 -3
  135. package/dist/{index-DYuqsDrP.d.ts → index-Dyw6BJx8.d.ts} +3 -3
  136. package/dist/{index-CLPMcGC5.d.ts → index-KG95XVaC.d.ts} +4 -4
  137. package/dist/{index-mcBtG6pK-CitQV9Bq.d.ts → index-LEcSTRgn-BR_p4GVY.d.ts} +2 -2
  138. package/dist/{index-D54VPeky.d.ts → index-k-wvVxKl.d.ts} +2 -2
  139. package/dist/{index-CHud6Aa-.d.ts → index-s34W6hUI.d.ts} +3 -3
  140. package/dist/{index-DXCdafUk.d.ts → index-wEkvA-wI.d.ts} +43 -20
  141. package/dist/index.d.ts +3 -3
  142. package/dist/internal/plugin/pluginInjectNodeProps.js +33 -5
  143. package/dist/internal/utils/urlPolicy.js +11 -1
  144. package/dist/lib/editor/withPlite.js +8 -6
  145. package/dist/lib/plugins/html/cssLexer.internal.js +126 -29
  146. package/dist/lib/plugins/html/cssSafety.internal.js +100 -0
  147. package/dist/lib/plugins/html/htmlDecode.internal.js +2 -2
  148. package/dist/lib/plugins/html/htmlMatcher.internal.js +1 -1
  149. package/dist/lib/plugins/html/htmlRules.internal.js +2 -13
  150. package/dist/lib/plugins/html/htmlSafety.js +17 -24
  151. package/dist/lib/plugins/html/htmlSerialize.internal.js +16 -2
  152. package/dist/lib/plugins/html/htmlStyleInline.internal.js +22 -23
  153. package/dist/lib/plugins/input-rules/inputRuleVeto.internal.js +27 -1
  154. package/dist/markdown/index.d.ts +1 -1
  155. package/dist/markdown/lib/internal/markdownAttributes.js +16 -7
  156. package/dist/markdown/lib/internal/markdownMappings.js +123 -16
  157. package/dist/markdown/lib/serializer/convertPhrasingSerialize.js +16 -1
  158. package/dist/math/index.d.ts +3 -3
  159. package/dist/math/react/index.d.ts +4 -4
  160. package/dist/migrations/index.d.ts +4 -4
  161. package/dist/migrations/migratePlateV54Urls.internal.js +63 -1
  162. package/dist/pagination/index.d.ts +1 -1
  163. package/dist/pagination/react/index.d.ts +3 -3
  164. package/dist/{protocol-CSuP7AWG-DAorqpaF.d.ts → protocol-Cp9xayOe-0OSfTMnt.d.ts} +1 -1
  165. package/dist/react/authored/index.d.ts +4 -4
  166. package/dist/react/components/PlateView.js +7 -1
  167. package/dist/react/features/board/index.d.ts +5 -5
  168. package/dist/react/features/callout/index.d.ts +93 -4
  169. package/dist/react/features/column/index.d.ts +5 -5
  170. package/dist/react/features/combobox/combobox.internal.js +35 -22
  171. package/dist/react/features/combobox/comboboxOwner.internal.js +29 -2
  172. package/dist/react/features/combobox/index.d.ts +8 -6
  173. package/dist/react/features/comments/index.d.ts +6 -6
  174. package/dist/react/features/date/index.d.ts +4 -4
  175. package/dist/react/features/details/index.d.ts +4 -4
  176. package/dist/react/features/field/FieldPlugin.js +2 -2
  177. package/dist/react/features/field/index.d.ts +5 -5
  178. package/dist/react/features/footnote/index.d.ts +4 -4
  179. package/dist/react/features/format-painter/FormatPainterPlugin.js +27 -34
  180. package/dist/react/features/format-painter/index.d.ts +4 -4
  181. package/dist/react/features/ink/index.d.ts +5 -5
  182. package/dist/react/features/lock/index.d.ts +5 -5
  183. package/dist/react/features/media/index.d.ts +5 -5
  184. package/dist/react/features/mention/index.d.ts +4 -4
  185. package/dist/react/features/table/index.d.ts +6 -6
  186. package/dist/react/features/toc/index.d.ts +2 -2
  187. package/dist/react/features/upload/index.d.ts +5 -5
  188. package/dist/react/index.d.ts +6 -6
  189. package/dist/react/virtualized.d.ts +3 -3
  190. package/dist/refusal-CwFxNUf7-BLhtd159.d.ts +1 -0
  191. package/dist/{registerEditorTools-Cl-o_Wnq.d.ts → registerEditorTools-D_3hPpTx.d.ts} +16 -8
  192. package/dist/shared-room-26tNRhZE-BLhtd159.d.ts +1 -0
  193. package/dist/skills/plate/SKILL.md +4 -3
  194. package/dist/skills/plate/references/ai-and-agents.md +2 -2
  195. package/dist/skills/plate/references/pricing.md +3 -3
  196. package/dist/skills/plate/references/setup.md +6 -0
  197. package/dist/skills/plate/references/ui-and-sync.md +4 -3
  198. package/dist/{source-DUP5aKcT.d.ts → source-BW7JD_oS.d.ts} +3 -3
  199. package/dist/static/index.d.ts +23 -9
  200. package/dist/static/internal/staticPendingMedia.internal.js +2 -1
  201. package/dist/static/internal/staticPresentation.js +1 -0
  202. package/dist/static/renderStaticHtml.js +85 -39
  203. package/dist/{storage-EzfLDqRy-Cu4DQ-Rf.d.ts → storage-C7xSH1I5-BJLoUfo9.d.ts} +2 -2
  204. package/dist/sync/cloudflare/index.d.ts +3 -3
  205. package/dist/sync/index.d.ts +4 -4
  206. package/dist/sync/postgres/index.d.ts +1 -1
  207. package/dist/sync/react/index.d.ts +6 -6
  208. package/dist/sync/server/index.d.ts +5 -5
  209. package/dist/tabbable/react/index.d.ts +4 -4
  210. package/dist/testing/index.d.ts +3 -3
  211. package/dist/{transport-DAforzBt-BFwAhC-N.d.ts → transport-B-ON68Y4-DCfT5-eN.d.ts} +1 -1
  212. package/dist/utils/plate-keys.js +1 -0
  213. package/dist/{widths-BjIZxtaJ.d.ts → widths-9NNziDRW.d.ts} +5 -5
  214. package/package.json +9 -2
  215. package/dist/clipboard-format-key-D9rnh20X-CR00YA0H.d.ts +0 -1
  216. package/dist/index-CKAkaSJK.d.ts +0 -3
  217. package/dist/index-CxyK4HrT.d.ts +0 -1
  218. package/dist/index-zcb_RtZC.d.ts +0 -1
  219. package/dist/refusal-DCzeB9nD-CR00YA0H.d.ts +0 -1
  220. package/dist/shared-room-Bg8qMvm1-CR00YA0H.d.ts +0 -1
  221. /package/dist/{tx-only-CWT-IURY-BqIFhy44.d.ts → tx-only-sIj7BcYh-BMFkGMuq.d.ts} +0 -0
@@ -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-CAshLTjV.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-CoNK9gTD.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-KG95XVaC.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-sIj7BcYh-BMFkGMuq.js";
2
+ import "../../htmlTypes-3laowz-3.js";
3
+ import { p as BasePlugin, vt as NodeInsertOptions } from "../../core-By92GWYW.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-sIj7BcYh-BMFkGMuq.js";
2
+ import "../../htmlTypes-3laowz-3.js";
3
+ import { Sa as HeadingLevel, ct as BlockInsertOptions, fo as PluginReference, lt as BlockUpsertOptions, p as BasePlugin, uo as PluginDependency } from "../../core-By92GWYW.js";
4
4
  declare const isSummaryHeadingLevel: (value: unknown) => value is HeadingLevel;
5
5
  type BaseDetailsViewState = {
6
6
  openKeys: Set<NodeKey>;
@@ -1,2 +1,2 @@
1
- import { C as fillsField, S as FIELD_TESTS, _ as FieldRead, a as fieldSubmission, b as FieldTest, c as startFieldValues, d as FieldConditionTest, f as FieldElement, g as FieldProblem, h as FieldPatch, i as applyFieldValues, l as BaseFieldPlugin, m as FieldOption, n as FieldApplyResult, o as readFieldAnswers, p as FieldKind, r as FieldRefusal, s as readFields, t as FieldAnswer, u as FieldCondition, v as FieldSettings, w as fitsField, x as FieldValue, y as FieldSubmission } from "../../index-DJhwDkfd.js";
1
+ import { C as fillsField, S as FIELD_TESTS, _ as FieldRead, a as fieldSubmission, b as FieldTest, c as startFieldValues, d as FieldConditionTest, f as FieldElement, g as FieldProblem, h as FieldPatch, i as applyFieldValues, l as BaseFieldPlugin, m as FieldOption, n as FieldApplyResult, o as readFieldAnswers, p as FieldKind, r as FieldRefusal, s as readFields, t as FieldAnswer, u as FieldCondition, v as FieldSettings, w as fitsField, x as FieldValue, y as FieldSubmission } from "../../index-CRQoHk18.js";
2
2
  export { BaseFieldPlugin, FIELD_TESTS, FieldAnswer, FieldApplyResult, FieldCondition, FieldConditionTest, FieldElement, FieldKind, FieldOption, FieldPatch, FieldProblem, FieldRead, FieldRefusal, FieldSettings, FieldSubmission, FieldTest, FieldValue, applyFieldValues, fieldSubmission, fillsField, fitsField, readFieldAnswers, readFields, startFieldValues };
@@ -1,10 +1,10 @@
1
- import { EditorRefusalError, claimsHistoryReplay, getActiveEditorUpdateId, getActiveEditorUpdateTags, getCompiledEditorSchema, getEditorAuthoredDocumentCapability, getInternalEditorRuntimeOwner, getMutationVersion, getSnapshotVersion, hasAuthoredRuntime, isAuthoredFormatOnlyPropertyWrite, isDocumentView, isPersistedEffect, notifyEditorAdmissionChange, readEditorCommitChangesHistoryTopStep, readElementPropertyWrites, readViewPage, registerEditorAdmissionCheck, registerEditorTransactionGuard } from "../../../facade.js";
1
+ import { EditorRefusalError, claimsHistoryReplay, getActiveEditorUpdateId, getActiveEditorUpdateTags, getCompiledEditorSchema, getEditorAuthoredDocumentCapability, getInternalEditorRuntimeOwner, getMutationVersion, getSnapshotVersion, hasAuthoredRuntime, isAuthoredFormatOnlyPropertyWrite, isDocumentView, isPersistedEffect, notifyEditorAdmissionChange, readEditorCommitChangesHistoryTopStep, readElementPropertyWrites, readShownDocument, readViewPage, registerEditorAdmissionCheck, registerEditorTransactionGuard } from "../../../facade.js";
2
2
  import { failInvariant } from "../../../internal/failInvariant.js";
3
3
  import { definePlugin } from "../../../lib/plugin/definePlugin.js";
4
4
  import { ElementApi, documentReplacement, locateAt, property, schema, target, txLocate } from "../../../core.js";
5
5
  import { BaseLockPlugin, lockWriteExemption } from "../../lock/lib/BaseLockPlugin.js";
6
- import { FIELD_KINDS, FIELD_TESTS, conditionGraph, conditionProblem, conditionRefs, conditionTargets, conditionTestKey, conditionTests, fieldProblems, fillsField, fitsField, indexFieldNames, isFieldCondition, isFieldKind, isFieldName, isFieldOptions, isFieldValue, isMaxCount, isMinCount, nameProblems, unfitSettings } from "./fieldRules.internal.js";
7
- import { carryFieldNames, dropFieldNames, holdsFieldNames, recordFieldAccess, sharedFieldLinks, sharedFieldNames, wantsFieldAccess } from "./fieldCache.internal.js";
6
+ import { FIELD_KINDS, FIELD_TESTS, conditionGraph, conditionProblem, conditionRefs, conditionTargets, conditionTestKey, conditionTests, fieldProblems, fillsField, fitsField, indexFieldNames, isFieldCondition, isFieldKind, isFieldName, isFieldOptions, isFieldValue, isMaxCount, isMinCount, nameProblems, sameFieldValue, unfitSettings } from "./fieldRules.internal.js";
7
+ import { carryFieldNames, dropFieldNames, holdsFieldNames, registerFieldAccessReader, sharedFieldLinks, sharedFieldNames } from "./fieldCache.internal.js";
8
8
  import { nanoid } from "nanoid";
9
9
  //#region src/features/field/lib/BaseFieldPlugin.ts
10
10
  const optionText = (options, entry) => {
@@ -302,6 +302,100 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
302
302
  if (afterValueWrite?.updateId === updateId) return afterValueWrite.count === count ? afterValueWrite.index : void 0;
303
303
  return countAtCommit === count ? sharedFieldNames(reader, nodes) : void 0;
304
304
  };
305
+ const readFieldRecord = (reader, state, fieldId) => {
306
+ readCountAtCommit();
307
+ const { held, heldWithKey, listed } = documentOf(state);
308
+ const entry = heldWithKey(fieldId);
309
+ if (!entry) return null;
310
+ const [node, key] = entry;
311
+ const names = (nodes) => namesOfUntouchedDraft(reader, nodes) ?? indexFieldNames(nodes());
312
+ const link = sharedFieldLinks(reader).link(node, held);
313
+ return {
314
+ key,
315
+ node,
316
+ read: {
317
+ applies: link.applies,
318
+ fieldId,
319
+ node,
320
+ problems: [...fieldProblems(node, link), ...node.name === void 0 ? [] : nameProblems(node, names(() => listed().nodes), held)]
321
+ }
322
+ };
323
+ };
324
+ const pendingDeleteCache = /* @__PURE__ */ new WeakMap();
325
+ const fieldsOfDocument = (doc) => {
326
+ const byId = /* @__PURE__ */ new Map();
327
+ const add = (nodes) => {
328
+ for (const node of fieldsIn(nodes)) if (!byId.has(node.fieldId)) byId.set(node.fieldId, node);
329
+ };
330
+ add(doc.children);
331
+ for (const rootNodes of Object.values(doc.roots ?? {})) add(rootNodes);
332
+ return byId;
333
+ };
334
+ const pendingDeletedFieldIds = (doc, authored, compiled) => {
335
+ const bySchema = pendingDeleteCache.get(doc);
336
+ const cached = bySchema?.get(compiled);
337
+ if (cached) return cached;
338
+ const stored = fieldsOfDocument(doc);
339
+ const deletedFieldIds = /* @__PURE__ */ new Set();
340
+ const projected = authored.project(doc, "proposed", compiled);
341
+ const surviving = projected.ok ? fieldsOfDocument(projected.document) : null;
342
+ for (const [fieldId, node] of stored) if (surviving ? !surviving.has(fieldId) : authored.reviewOf(doc, node, compiled).marks.some((mark) => mark.kind === "delete")) deletedFieldIds.add(fieldId);
343
+ const nextBySchema = bySchema ?? /* @__PURE__ */ new WeakMap();
344
+ nextBySchema.set(compiled, deletedFieldIds);
345
+ if (!bySchema) pendingDeleteCache.set(doc, nextBySchema);
346
+ return deletedFieldIds;
347
+ };
348
+ const assertNoPendingDeleteWrites = (before, after, refuse) => {
349
+ const authored = getEditorAuthoredDocumentCapability(editor);
350
+ if (!authored || authored.pending(after) === 0) return;
351
+ const intervals = [];
352
+ let cursor = before;
353
+ for (const span of authored.activeDecisionSpans?.(editor) ?? []) {
354
+ if (cursor !== span.before) intervals.push([cursor, span.before]);
355
+ cursor = span.after;
356
+ }
357
+ if (cursor !== after) intervals.push([cursor, after]);
358
+ if (intervals.length === 0) return;
359
+ const compiled = getCompiledEditorSchema(editor);
360
+ const deletedAfter = pendingDeletedFieldIds(after, authored, compiled);
361
+ if (deletedAfter.size === 0) return;
362
+ const afterFields = fieldsOfDocument(after);
363
+ const pendingDeleteMessage = "Cannot write a field answer while a pending deletion awaits review.";
364
+ let afterIndex;
365
+ for (const [segBefore, segAfter] of intervals) {
366
+ const prevFields = fieldsOfDocument(segBefore);
367
+ const nextFields = segAfter === after ? afterFields : fieldsOfDocument(segAfter);
368
+ for (const [fieldId, nextNode] of nextFields) {
369
+ const prevNode = prevFields.get(fieldId);
370
+ if (sameFieldValue(prevNode?.value, nextNode.value)) continue;
371
+ if (deletedAfter.has(fieldId)) throw refuse(pendingDeleteMessage);
372
+ const finalNode = afterFields.get(fieldId) ?? nextNode;
373
+ if (finalNode.name === void 0) continue;
374
+ afterIndex ??= indexFieldNames([...afterFields.values()]);
375
+ if (nameProblems(finalNode, afterIndex, (id) => afterFields.get(id)).includes("name-conflict")) continue;
376
+ for (const id of afterIndex.byRole.get(finalNode.role)?.get(finalNode.name) ?? []) if (deletedAfter.has(id) && (prevNode !== void 0 || !sameFieldValue(nextNode.value, afterFields.get(id)?.value))) throw refuse(pendingDeleteMessage);
377
+ }
378
+ }
379
+ };
380
+ const readAccess = (reader, state, node, key) => {
381
+ const fixed = isDocumentView(reader);
382
+ const locked = !fixed && reader.plugin(BaseLockPlugin).installed && reader.plugin(BaseLockPlugin).read.isLocked(key);
383
+ let waitsForReview = false;
384
+ if (!fixed && readShownDocument(reader) === null && hasAuthoredRuntime(reader)) {
385
+ const authored = getEditorAuthoredDocumentCapability(reader);
386
+ if (authored) {
387
+ const doc = state.value();
388
+ if (authored.pending(doc) > 0) {
389
+ const compiled = getCompiledEditorSchema(reader);
390
+ waitsForReview = pendingDeletedFieldIds(doc, authored, compiled).has(node.fieldId) || authored.reviewOf(doc, node, compiled).marks.some((mark) => mark.kind === "delete" || mark.kind === "format" && mark.key === "value");
391
+ }
392
+ }
393
+ }
394
+ return {
395
+ locked,
396
+ waitsForReview
397
+ };
398
+ };
305
399
  return {
306
400
  contributions: [lockWriteExemption.of(({ element, modifications }) => {
307
401
  if (!isField(element)) return false;
@@ -312,6 +406,14 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
312
406
  activate({ afterPublish, onCleanup }) {
313
407
  afterPublish(readCountAtCommit);
314
408
  onCleanup(owner.subscribeCommit(readCountAtCommit));
409
+ onCleanup(registerFieldAccessReader(editor, (reader, fieldId) => reader.read((state) => {
410
+ const found = readFieldRecord(reader, state, fieldId);
411
+ if (!found) return null;
412
+ return {
413
+ ...found.read,
414
+ ...readAccess(reader, state, found.node, found.key)
415
+ };
416
+ })));
315
417
  let lastFillRole = store.get("fillRole") ?? null;
316
418
  onCleanup(store.subscribe(() => {
317
419
  const nextFillRole = store.get("fillRole") ?? null;
@@ -324,7 +426,7 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
324
426
  mode: store.get("fillRole") ?? null,
325
427
  version: getSnapshotVersion(editor)
326
428
  };
327
- onCleanup(registerEditorAdmissionCheck(editor, ({ before, commit, effects }) => {
429
+ onCleanup(registerEditorAdmissionCheck(editor, ({ after, before, commit, effects }) => {
328
430
  const role = store.get("fillRole") ?? null;
329
431
  const write = openWriteOfThisUpdate();
330
432
  const refuse = (message) => new EditorRefusalError({
@@ -334,8 +436,10 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
334
436
  const { tags } = commit;
335
437
  const collaboration = tags.includes("collaboration");
336
438
  if (write !== null && (write.switched || write.mode !== role) && !collaboration) throw refuse(`The fill role changed from ${JSON.stringify(write.mode)} to ${JSON.stringify(role)} inside one update.`);
439
+ const replaces = commit.annotations[documentReplacement.key] === true;
440
+ if (!collaboration && !replaces && !tags.includes("historic") && hasAuthoredRuntime(editor)) assertNoPendingDeleteWrites(before, after, refuse);
337
441
  if (role === null || collaboration) return;
338
- if (commit.annotations[documentReplacement.key] === true) throw refuse(`A fill as ${JSON.stringify(role)} cannot replace the document.`);
442
+ if (replaces) throw refuse(`A fill as ${JSON.stringify(role)} cannot replace the document.`);
339
443
  if ((claimsHistoryReplay(commit) || effects.some(({ type: effect }) => isPersistedEffect(effect)) ? null : readElementPropertyWrites(editor, {
340
444
  before,
341
445
  commit
@@ -390,7 +494,7 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
390
494
  }],
391
495
  read: ({ editor: reader, state }) => {
392
496
  readCountAtCommit();
393
- const { held, heldWithKey, listed } = documentOf(state);
497
+ const { listed } = documentOf(state);
394
498
  const names = (nodes) => namesOfUntouchedDraft(reader, nodes) ?? indexFieldNames(nodes());
395
499
  return {
396
500
  /**
@@ -408,31 +512,7 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
408
512
  * no field holds it. Looks up the field, then one field for each
409
513
  * condition it follows along the chain.
410
514
  */
411
- field: (fieldId) => {
412
- const entry = heldWithKey(fieldId);
413
- if (!entry) return null;
414
- const [node, key] = entry;
415
- if (wantsFieldAccess()) {
416
- const fixed = isDocumentView(reader);
417
- const locked = !fixed && reader.plugin(BaseLockPlugin).installed && reader.plugin(BaseLockPlugin).read.isLocked(key);
418
- let waitsForReview = false;
419
- if (!fixed && hasAuthoredRuntime(reader)) {
420
- const authored = getEditorAuthoredDocumentCapability(reader);
421
- if (authored) waitsForReview = authored.reviewOf(state.value(), node, getCompiledEditorSchema(reader)).marks.some((mark) => mark.kind === "delete" || mark.kind === "format" && mark.key === "value");
422
- }
423
- recordFieldAccess({
424
- locked,
425
- waitsForReview
426
- });
427
- }
428
- const link = sharedFieldLinks(reader).link(node, held);
429
- return {
430
- applies: link.applies,
431
- fieldId,
432
- node,
433
- problems: [...fieldProblems(node, link), ...node.name === void 0 ? [] : nameProblems(node, names(() => listed().nodes), held)]
434
- };
435
- },
515
+ field: (fieldId) => readFieldRecord(reader, state, fieldId)?.read ?? null,
436
516
  /** Every field of the document, in reading order. */
437
517
  fields: () => {
438
518
  const { lookup, nodes } = listed();
@@ -543,28 +623,6 @@ const BaseFieldPlugin = fieldSchemaPlugin.extend(({ editor, schema: { properties
543
623
  } else if (!("condition" in patch) && reshaped && field.condition && isFieldCondition(field.condition)) checkCondition(field.condition, field, next);
544
624
  const valuesOnly = Object.keys(patch).every((setting) => setting === "value");
545
625
  const kept = field.name === void 0 || !valuesOnly ? void 0 : namesOfUntouchedDraft(writer, () => document.listed().nodes);
546
- if ("value" in patch && hasAuthoredRuntime(writer)) {
547
- const authored = getEditorAuthoredDocumentCapability(writer);
548
- if (authored) {
549
- const compiled = getCompiledEditorSchema(writer);
550
- const snapshot = tx.value();
551
- const hasPendingDelete = (targetNode) => authored.reviewOf(snapshot, targetNode, compiled).marks.some((mark) => mark.kind === "delete");
552
- const rejectPendingDelete = () => new EditorRefusalError({
553
- reason: "field-fill",
554
- role: role ?? null
555
- }, "Cannot write a field answer while a pending deletion awaits review.");
556
- if (hasPendingDelete(field)) throw rejectPendingDelete();
557
- if (next.name !== void 0) {
558
- const previewIndex = kept ?? indexFieldNames(document.listed().nodes.map((entry) => entry.fieldId === fieldId ? next : entry));
559
- const previewHeld = (id) => id === fieldId ? next : document.held(id);
560
- if (!nameProblems(next, previewIndex, previewHeld).includes("name-conflict")) for (const id of previewIndex.byRole.get(next.role)?.get(next.name) ?? []) {
561
- if (id === fieldId) continue;
562
- const [sibling] = held(id);
563
- if (sibling && hasPendingDelete(sibling)) throw rejectPendingDelete();
564
- }
565
- }
566
- }
567
- }
568
626
  const dropped = unfit.filter((setting) => next.kind !== field.kind ? true : setting === "value" && ("max" in patch || "options" in patch));
569
627
  tx.nodes.set({
570
628
  ...patch,
@@ -53,27 +53,15 @@ const dropFieldNames = (editor, from) => {
53
53
  const owner = getInternalEditorRuntimeOwner(editor);
54
54
  if (nameIndexes.get(owner)?.version === from) nameIndexes.delete(owner);
55
55
  };
56
- let activeAccessCollector = null;
57
- const wantsFieldAccess = () => activeAccessCollector !== null;
58
- const recordFieldAccess = (access) => {
59
- if (activeAccessCollector) activeAccessCollector.access = access;
56
+ const accessReaders = /* @__PURE__ */ new WeakMap();
57
+ const registerFieldAccessReader = (editor, read) => {
58
+ const owner = getInternalEditorRuntimeOwner(editor);
59
+ accessReaders.set(owner, read);
60
+ return () => {
61
+ if (accessReaders.get(owner) === read) accessReaders.delete(owner);
62
+ };
60
63
  };
61
64
  const isFieldLockInstalled = (editor) => editor.plugin(BaseLockPlugin).installed;
62
- const readWithFieldAccess = (readField) => {
63
- const previous = activeAccessCollector;
64
- const collector = { access: null };
65
- activeAccessCollector = collector;
66
- try {
67
- const field = readField();
68
- if (!field) return null;
69
- return {
70
- ...field,
71
- locked: collector.access?.locked ?? false,
72
- waitsForReview: collector.access?.waitsForReview ?? false
73
- };
74
- } finally {
75
- activeAccessCollector = previous;
76
- }
77
- };
65
+ const readFieldWithAccess = (editor, fieldId) => accessReaders.get(getInternalEditorRuntimeOwner(editor))?.(editor, fieldId) ?? null;
78
66
  //#endregion
79
- export { carryFieldNames, dropFieldNames, holdsFieldNames, isFieldLockInstalled, readWithFieldAccess, recordFieldAccess, sharedFieldLinks, sharedFieldNames, wantsFieldAccess };
67
+ export { carryFieldNames, dropFieldNames, holdsFieldNames, isFieldLockInstalled, readFieldWithAccess, registerFieldAccessReader, sharedFieldLinks, sharedFieldNames };
@@ -1,6 +1,6 @@
1
- import { $o as Range, Po as Point, Vl as TxDeclaredMethod, fs as RootKey } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { ao as NormalizePluginSelectors, p as BasePlugin, xo as PluginSelectorMethods } from "../../core-CTB0OBoh.js";
1
+ import { $o as Range, Po as Point, Vl as TxDeclaredMethod, fs as RootKey } from "../../tx-only-sIj7BcYh-BMFkGMuq.js";
2
+ import "../../htmlTypes-3laowz-3.js";
3
+ import { ao as NormalizePluginSelectors, p as BasePlugin, xo as PluginSelectorMethods } from "../../core-By92GWYW.js";
4
4
  /** Query matching options for literal, whole-word, or regular-expression search. */
5
5
  type FindOptions = Readonly<{
6
6
  /** Match exact letter casing. Defaults to false. */
@@ -1,6 +1,6 @@
1
- import { Es as SchemaContentRule, Mt as EditorJsonValue, N as Descendant, Vl as TxDeclaredMethod, Wa as Path, gi as Element$1, gs as SchemaContentDefault, ia as NodeEntry, qo as PropertyStringDescriptor, wi as ElementOf } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { fo as PluginReference, p as BasePlugin, uo as PluginDependency, vt as NodeInsertOptions } from "../../core-CTB0OBoh.js";
1
+ import { Es as SchemaContentRule, Mt as EditorJsonValue, N as Descendant, Vl as TxDeclaredMethod, Wa as Path, gi as Element$1, gs as SchemaContentDefault, ia as NodeEntry, qo as PropertyStringDescriptor, wi as ElementOf } from "../../tx-only-sIj7BcYh-BMFkGMuq.js";
2
+ import "../../htmlTypes-3laowz-3.js";
3
+ import { fo as PluginReference, p as BasePlugin, uo as PluginDependency, vt as NodeInsertOptions } from "../../core-By92GWYW.js";
4
4
  declare const isNonBlankRef: (value: unknown) => value is string;
5
5
  type FootnoteAnchor = {
6
6
  id: string;
@@ -1,2 +1,2 @@
1
- import { C as InkViewState, D as InkPassageSvgSuggestion, E as InkPassageSvgOptions, S as InkTool, T as InkPassageSvg, _ as InkRoundRecord, a as InkDigitizedMeta, b as InkSample, c as InkLine, d as InkMarkBlock, f as InkMarkInput, g as InkPassageWord, h as InkPassageMark, i as InkCopyPlace, l as InkMargin, m as InkPassageCluster, n as InkBrush, o as InkDigitizedMode, p as InkPassage, r as InkCopy, s as InkDirection, t as BaseInkPlugin, u as InkMark, v as InkRoundStatus, w as renderInkPassageSvg, x as InkSubmitRoundOptions, y as InkRun } from "../../index-D3bhjdRz.js";
1
+ import { C as InkViewState, D as InkPassageSvgSuggestion, E as InkPassageSvgOptions, S as InkTool, T as InkPassageSvg, _ as InkRoundRecord, a as InkDigitizedMeta, b as InkSample, c as InkLine, d as InkMarkBlock, f as InkMarkInput, g as InkPassageWord, h as InkPassageMark, i as InkCopyPlace, l as InkMargin, m as InkPassageCluster, n as InkBrush, o as InkDigitizedMode, p as InkPassage, r as InkCopy, s as InkDirection, t as BaseInkPlugin, u as InkMark, v as InkRoundStatus, w as renderInkPassageSvg, x as InkSubmitRoundOptions, y as InkRun } from "../../index-Djwcl0Ff.js";
2
2
  export { BaseInkPlugin, InkBrush, InkCopy, InkCopyPlace, InkDigitizedMeta, InkDigitizedMode, InkDirection, InkLine, InkMargin, InkMark, InkMarkBlock, InkMarkInput, InkPassage, InkPassageCluster, InkPassageMark, type InkPassageSvg, type InkPassageSvgOptions, type InkPassageSvgSuggestion, InkPassageWord, InkRoundRecord, InkRoundStatus, InkRun, InkSample, InkSubmitRoundOptions, InkTool, InkViewState, renderInkPassageSvg };
@@ -1,5 +1,5 @@
1
1
  import { definePlugin } from "../../../lib/plugin/definePlugin.js";
2
- import { decideUrl, encodeUrlInput, isStoredUrl } from "../../../internal/utils/urlPolicy.js";
2
+ import { decideUrl, encodeSafeUrlInput, isStoredUrl } from "../../../internal/utils/urlPolicy.js";
3
3
  import { rangeHasVetoedMark } from "../../../lib/plugins/input-rules/inputRuleVeto.internal.js";
4
4
  import { defineInputRule } from "../../../lib/plugins/input-rules/defineInputRule.js";
5
5
  import { isDefined } from "../../../lib/utils/isDefined.js";
@@ -130,7 +130,10 @@ const getLinkHref = (url, { allowedSchemes = DEFAULT_ALLOWED_SCHEMES } = {}) =>
130
130
  const decision = decideUrl("navigation", url, { allowedSchemes });
131
131
  return decision.ok ? decision.url : void 0;
132
132
  };
133
- const admitLinkInput = (allowedSchemes, input) => getLinkHref(encodeUrlInput(input), { allowedSchemes });
133
+ const admitLinkInput = (allowedSchemes, input) => {
134
+ const encoded = encodeSafeUrlInput(input);
135
+ return encoded === void 0 ? void 0 : getLinkHref(encoded, { allowedSchemes });
136
+ };
134
137
  const defaultParseUrl = (text) => {
135
138
  if (WWW_TOKEN.test(text)) {
136
139
  const candidate = `https://${text}`;
@@ -1,6 +1,6 @@
1
- import { $o as Range, Vl as TxDeclaredMethod, gi as Element$1 } from "../../tx-only-CWT-IURY-BqIFhy44.js";
2
- import "../../htmlTypes-CNhoCFjK.js";
3
- import { o as Editor, p as BasePlugin } from "../../core-CTB0OBoh.js";
1
+ import { $o as Range, Vl as TxDeclaredMethod, gi as Element$1 } from "../../tx-only-sIj7BcYh-BMFkGMuq.js";
2
+ import "../../htmlTypes-3laowz-3.js";
3
+ import { o as Editor, p as BasePlugin } from "../../core-By92GWYW.js";
4
4
  /** A replacement option on a finding, with an optional UI button label. */
5
5
  type LintFix = Readonly<{
6
6
  label?: string;
@@ -95,10 +95,15 @@ const handleListDeleteBackward = (editor, { direction, next, state }) => {
95
95
  const blockKey = state.key(nodeEntry[0]);
96
96
  if (!blockKey) return next();
97
97
  const blockStart = state.points.start(blockKey);
98
- if (!(state.points.isStart(selection.anchor, blockKey) || !!blockStart && state.text.string({
98
+ const beforeCaret = blockStart ? {
99
99
  anchor: blockStart,
100
100
  focus: selection.anchor
101
- }) === "")) return next();
101
+ } : void 0;
102
+ if (!(state.points.isStart(selection.anchor, blockKey) || !!beforeCaret && state.text.string(beforeCaret) === "" && state.nodes.entries({
103
+ at: beforeCaret,
104
+ match: (node) => ElementApi.isElement(node) && state.schema.isInline(node) && (state.schema.isVoid(node) || state.schema.isAtom(node) || state.schema.isObject(node)),
105
+ voids: true
106
+ }).next().done === true)) return next();
102
107
  if (hasNonWritableBlock(editor, nodeEntry[1], root)) return next();
103
108
  const [family] = getListFamilies(state, [nodeEntry], root);
104
109
  if (family?.some(({ path }) => hasNonWritableBlock(editor, path, root))) return false;
@@ -1,2 +1,2 @@
1
- import { a as LockWriteExemptionInput, i as LockWriteExemption, n as LockRefusal, o as isLockRefusal, r as LockTargetOptions, s as lockWriteExemption, t as BaseLockPlugin } from "../../index-Bqva6PJc.js";
1
+ import { a as LockWriteExemptionInput, i as LockWriteExemption, n as LockRefusal, o as isLockRefusal, r as LockTargetOptions, s as lockWriteExemption, t as BaseLockPlugin } from "../../index-BJPT0Tv_.js";
2
2
  export { BaseLockPlugin, LockRefusal, LockTargetOptions, LockWriteExemption, LockWriteExemptionInput, isLockRefusal, lockWriteExemption };
@@ -1,2 +1,2 @@
1
- import { S as VideoElement, _ as FileInsertInput, a as parseMediaEmbedUrl, b as MediaPluginState, c as BaseImagePlugin, d as AlignedMediaInsertInput, f as AudioElement, g as FileElement, h as BaseVideoPlugin, i as MediaEmbedRules, l as ImageElement, m as BaseFilePlugin, n as MediaEmbedElement, o as MediaEmbedProvider, p as BaseAudioPlugin, r as MediaEmbedPluginState, s as ParsedMediaEmbed, t as BaseMediaEmbedPlugin, u as ImageRules, v as ImageInsertInput, x as ProviderMediaInsertInput, y as MediaInsertInput } from "../../index-B4aToRMv.js";
1
+ import { S as VideoElement, _ as FileInsertInput, a as parseMediaEmbedUrl, b as MediaPluginState, c as BaseImagePlugin, d as AlignedMediaInsertInput, f as AudioElement, g as FileElement, h as BaseVideoPlugin, i as MediaEmbedRules, l as ImageElement, m as BaseFilePlugin, n as MediaEmbedElement, o as MediaEmbedProvider, p as BaseAudioPlugin, r as MediaEmbedPluginState, s as ParsedMediaEmbed, t as BaseMediaEmbedPlugin, u as ImageRules, v as ImageInsertInput, x as ProviderMediaInsertInput, y as MediaInsertInput } from "../../index-DXm_v0Qq.js";
2
2
  export { AlignedMediaInsertInput, AudioElement, BaseAudioPlugin, BaseFilePlugin, BaseImagePlugin, BaseMediaEmbedPlugin, BaseVideoPlugin, FileElement, FileInsertInput, ImageElement, ImageInsertInput, ImageRules, MediaEmbedElement, MediaEmbedPluginState, type MediaEmbedProvider, MediaEmbedRules, MediaInsertInput, MediaPluginState, type ParsedMediaEmbed, ProviderMediaInsertInput, VideoElement, parseMediaEmbedUrl };
@@ -1,2 +1,2 @@
1
- import { i as MentionInsertOptions, n as MentionDefinition, r as MentionElement, t as BaseMentionPlugin } from "../../index-BfJKfAwk.js";
1
+ import { i as MentionInsertOptions, n as MentionDefinition, r as MentionElement, t as BaseMentionPlugin } from "../../index-DTd1D-BF.js";
2
2
  export { BaseMentionPlugin, MentionDefinition, MentionElement, MentionInsertOptions };