magic-editor-x 2.3.0 → 2.4.0

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 (84) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +299 -142
  3. package/dist/admin/AuditPage-C2u6z4aN.js +381 -0
  4. package/dist/admin/AuditPage-guB0SiGS.mjs +381 -0
  5. package/dist/admin/{ConfigurationPage-C-UktL1x.js → ConfigurationPage-D6uya-J1.js} +228 -13
  6. package/dist/admin/{ConfigurationPage-BxLHIQdo.mjs → ConfigurationPage-DiEpF1Rr.mjs} +222 -7
  7. package/dist/admin/ConfirmAction-CUhpngYU.js +71 -0
  8. package/dist/admin/ConfirmAction-CZjpduc3.mjs +72 -0
  9. package/dist/admin/{CustomBlocksPage-D8aMbVXc.mjs → CustomBlocksPage-Byt10-6c.mjs} +6 -4
  10. package/dist/admin/{CustomBlocksPage-CxcTfdOT.js → CustomBlocksPage-DP3h_wNd.js} +21 -19
  11. package/dist/admin/MentionsWidget-C2OCAmqq.js +227 -0
  12. package/dist/admin/MentionsWidget-sMkM9mHX.mjs +225 -0
  13. package/dist/admin/{TemplatesPage-Hn6gyu2l.js → TemplatesPage-DrSJdteI.js} +313 -17
  14. package/dist/admin/{TemplatesPage-jhYi6Zdf.mjs → TemplatesPage-Yp4OqFE2.mjs} +305 -9
  15. package/dist/admin/{ConfirmAction-DuQwvRYi.mjs → api-2ZRpHM3d.mjs} +19 -70
  16. package/dist/admin/{ConfirmAction-zLuIFj8t.js → api-bix9RLLI.js} +19 -70
  17. package/dist/admin/auditText-DIIYVR6k.mjs +110 -0
  18. package/dist/admin/auditText-DUhWu2Nx.js +109 -0
  19. package/dist/admin/comments-C7P41lan.js +86 -0
  20. package/dist/admin/comments-hfIbLQNO.mjs +87 -0
  21. package/dist/admin/{de-BMY2LBaa.mjs → de-BNPIGqhs.mjs} +41 -2
  22. package/dist/admin/{de-2Ie5jy7j.js → de-BhhGss1l.js} +41 -2
  23. package/dist/admin/{de-DOiGaTNX.mjs → de-CKz6CG3V.mjs} +191 -5
  24. package/dist/admin/{de-C3AsGauQ.js → de-CbBDnXeT.js} +140 -1
  25. package/dist/admin/{de-BUS1hUw0.mjs → de-DiCZrmH8.mjs} +140 -1
  26. package/dist/admin/{de-B1X46JJZ.js → de-zcV8D7nt.js} +191 -5
  27. package/dist/admin/{en-Ah-Cw0Wd.js → en-B9ApE1y1.js} +41 -2
  28. package/dist/admin/{en-CDg_18Bt.js → en-BMWhILnj.js} +191 -5
  29. package/dist/admin/{en-BkEjpC3i.js → en-CpehF0Kv.js} +140 -1
  30. package/dist/admin/{en-GCzgS9Aw.mjs → en-DCPMqFIa.mjs} +140 -1
  31. package/dist/admin/{en-CU6UzV4g.mjs → en-cYzqbASF.mjs} +191 -5
  32. package/dist/admin/{en-CvFiqti2.mjs → en-gFLeK9Ng.mjs} +41 -2
  33. package/dist/admin/{es-DbKHZz5l.mjs → es-BmwBgEgz.mjs} +41 -2
  34. package/dist/admin/{es-Cr8JH85N.js → es-C0W31rl8.js} +41 -2
  35. package/dist/admin/{es-BCpJmUEM.js → es-CQPh8PXw.js} +191 -5
  36. package/dist/admin/{es-C4pEnDRv.js → es-CawpzwyC.js} +140 -1
  37. package/dist/admin/{es-DHBBZKl2.mjs → es-Chs37IBR.mjs} +140 -1
  38. package/dist/admin/{es-BmfffNM2.mjs → es-DCamt1ek.mjs} +191 -5
  39. package/dist/admin/{fr-DQJ_7aq5.mjs → fr-CMWBNE5D.mjs} +41 -2
  40. package/dist/admin/{fr-C2aLSwEu.js → fr-COOsqexl.js} +140 -1
  41. package/dist/admin/{fr-Dvq4xk2e.mjs → fr-Dp5-XP29.mjs} +140 -1
  42. package/dist/admin/{fr-ZcN0yM_2.js → fr-DpC44Ol8.js} +191 -5
  43. package/dist/admin/{fr-OJ4VW1kh.js → fr-iGeIfEcU.js} +41 -2
  44. package/dist/admin/{fr-DZd2XJP6.mjs → fr-oW0t8bT5.mjs} +191 -5
  45. package/dist/admin/{index-Cm-fFUhE.js → index-64wc26Bl.js} +13851 -6746
  46. package/dist/admin/{index-XgfwqLfV.mjs → index-BVjf1gVC.mjs} +13788 -6682
  47. package/dist/admin/{index-BHBRr562.js → index-D6Z7i8ba.js} +1003 -53
  48. package/dist/admin/{index-CQk1XeNb.mjs → index-D_Fv8Non.mjs} +1032 -82
  49. package/dist/admin/index.js +2 -1
  50. package/dist/admin/index.mjs +3 -2
  51. package/dist/admin/math-CIQ4Z_mY.mjs +47 -0
  52. package/dist/admin/math-vsK_06ZR.js +49 -0
  53. package/dist/admin/{pt-D0I0_JYs.js → pt-BHmXk2d9.js} +41 -2
  54. package/dist/admin/{pt-CImqDnLB.js → pt-Bo0Pm_Pt.js} +191 -5
  55. package/dist/admin/{pt-CilDggGF.mjs → pt-DALDvfBn.mjs} +140 -1
  56. package/dist/admin/{pt-BSLzA17U.mjs → pt-DFNgZ5_k.mjs} +41 -2
  57. package/dist/admin/{pt-DX0OAIoL.js → pt-DXy7G1x7.js} +140 -1
  58. package/dist/admin/{pt-C3UdeIpd.mjs → pt-uGpfRQLC.mjs} +191 -5
  59. package/dist/admin/{useT-D3sM9Zf7.js → useT-BXJLIPN4.js} +1 -1
  60. package/dist/admin/{useT-CmaeZbCr.mjs → useT-CLPhBmBC.mjs} +1 -1
  61. package/dist/blocks/index.d.mts +2 -0
  62. package/dist/blocks/index.d.ts +2 -0
  63. package/dist/blocks/index.js +13 -2
  64. package/dist/blocks/index.mjs +13 -2
  65. package/dist/math/index.d.mts +27 -0
  66. package/dist/math/index.d.ts +27 -0
  67. package/dist/math/index.js +164 -0
  68. package/dist/math/index.mjs +134 -0
  69. package/dist/react/index.js +673 -91
  70. package/dist/react/index.mjs +673 -91
  71. package/dist/render/index.d.mts +26 -0
  72. package/dist/render/index.d.ts +26 -0
  73. package/dist/render/index.js +779 -106
  74. package/dist/render/index.mjs +779 -106
  75. package/dist/server/index.js +10419 -4103
  76. package/dist/server/index.mjs +10419 -4103
  77. package/dist/vue/index.js +673 -91
  78. package/dist/vue/index.mjs +673 -91
  79. package/package.json +8 -2
  80. package/schema/magic-editor-x.schema.json +127 -2
  81. package/types/blocks.d.ts +2 -0
  82. package/types/index.d.ts +42 -0
  83. package/types/math.d.ts +27 -0
  84. package/types/render.d.ts +26 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jsxRuntime = require("react/jsx-runtime");
3
2
  const icons = require("@strapi/icons");
3
+ const jsxRuntime = require("react/jsx-runtime");
4
4
  const createDOMPurify = require("dompurify");
5
5
  const ReactNamespace = require("react");
6
6
  const client = require("react-dom/client");
@@ -13,7 +13,8 @@ const PERMISSIONS = {
13
13
  customBlocksManage: action("custom-blocks.manage"),
14
14
  settingsRead: action("settings.read"),
15
15
  settingsUpdate: action("settings.update"),
16
- templatesManage: action("templates.manage")
16
+ templatesManage: action("templates.manage"),
17
+ auditRead: action("audit.read")
17
18
  };
18
19
  const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
19
20
  const registry = /* @__PURE__ */ new Map();
@@ -44,7 +45,9 @@ const MARKED_BLOCKS = Object.freeze({
44
45
  keys: Object.freeze(["file", "title", "caption", "loop", "tracks"]),
45
46
  anchor: Object.freeze(["file", "object"])
46
47
  }),
47
- synced: Object.freeze({ keys: Object.freeze(["ref"]), anchor: Object.freeze(["ref", "string"]) })
48
+ synced: Object.freeze({ keys: Object.freeze(["ref"]), anchor: Object.freeze(["ref", "string"]) }),
49
+ // 2.4: math block. A Settings custom block named `math` could exist before 2.4.
50
+ math: Object.freeze({ keys: Object.freeze(["tex", "display"]), anchor: Object.freeze(["tex", "string"]) })
48
51
  });
49
52
  const isBuiltInMarker = (value) => Number.isInteger(value) && /** @type {number} */
50
53
  value >= 1;
@@ -62,6 +65,21 @@ const isMarkedBuiltIn = (type, data) => {
62
65
  if (isBuiltInMarker(data[BUILT_IN_MARKER])) return true;
63
66
  return hasBuiltInShape(MARKED_BLOCKS[type], data);
64
67
  };
68
+ const FIELD_KEY_PATTERN = /^[A-Za-z0-9_-]{16,32}$/;
69
+ const FIELD_KEY_LENGTH = 22;
70
+ const BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
71
+ const isValidFieldKey = (value) => typeof value === "string" && FIELD_KEY_PATTERN.test(value);
72
+ const createFieldKey = (fill) => {
73
+ const bytes = new Uint8Array(22);
74
+ const source = globalThis.crypto && typeof globalThis.crypto.getRandomValues === "function" ? (array) => globalThis.crypto.getRandomValues(array) : null;
75
+ if (!source) throw new Error("No cryptographic random source");
76
+ source(bytes);
77
+ let key = "";
78
+ for (let i = 0; i < FIELD_KEY_LENGTH; i += 1) key += BASE64URL[bytes[i] & 63];
79
+ return key;
80
+ };
81
+ const isPositionalFieldPath = (path) => typeof path === "string" && path.split(".").some((part) => /^\d+$/.test(part));
82
+ const basePathOf = (path) => String(path).split(".").filter((part) => !/^\d+$/.test(part)).join(".");
65
83
  const EDITOR_DATA_LIMITS = Object.freeze({
66
84
  maxBlocks: 5e3,
67
85
  maxBytes: 5 * 1024 * 1024,
@@ -123,7 +141,7 @@ const tryParseJson = (text) => {
123
141
  return { ok: false };
124
142
  }
125
143
  };
126
- const escapeHtml = (text) => String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
144
+ const escapeHtml$1 = (text) => String(text).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
127
145
  const hashString = (text) => {
128
146
  let hash = 2166136261;
129
147
  for (let i = 0; i < text.length; i += 1) {
@@ -140,7 +158,7 @@ const textToBlocks = (text) => {
140
158
  if (looksLikeHtml) {
141
159
  return [{ type: "paragraph", data: { text: trimmed } }];
142
160
  }
143
- return trimmed.split(/\r?\n\s*\r?\n/).map((part) => part.trim()).filter(Boolean).map((part) => ({ type: "paragraph", data: { text: escapeHtml(part).replace(/\r?\n/g, "<br>") } }));
161
+ return trimmed.split(/\r?\n\s*\r?\n/).map((part) => part.trim()).filter(Boolean).map((part) => ({ type: "paragraph", data: { text: escapeHtml$1(part).replace(/\r?\n/g, "<br>") } }));
144
162
  };
145
163
  const unwrapValue = (value) => {
146
164
  let current = value;
@@ -196,6 +214,7 @@ const normalizeEditorData = (value) => {
196
214
  const time = Number.isFinite(clean.time) && clean.time > 0 ? Math.floor(clean.time) : 0;
197
215
  const version = typeof clean.version === "string" && clean.version.length <= 32 ? clean.version : "2.31.7";
198
216
  const result = { time, blocks, version };
217
+ if (isValidFieldKey(clean.fieldKey)) result.fieldKey = clean.fieldKey;
199
218
  const size = byteLength(JSON.stringify(result));
200
219
  if (size > EDITOR_DATA_LIMITS.maxBytes) {
201
220
  throw new EditorDataError("Editor content exceeds the size limit", "TOO_LARGE");
@@ -251,6 +270,328 @@ const computeStats = (data) => {
251
270
  characters: normalized.length
252
271
  };
253
272
  };
273
+ const TABLE_LIMITS = Object.freeze({ rows: 500, cols: 100, merges: 1e3, caption: 4e3 });
274
+ const TABLE_ALIGNS = Object.freeze(["left", "center", "right"]);
275
+ const isObject$2 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
276
+ const tableWidth = (content) => Array.isArray(content) ? content.reduce((width, row) => Math.max(width, Array.isArray(row) ? row.length : 0), 0) : 0;
277
+ const cleanTableAlign = (value, cols) => {
278
+ if (!Array.isArray(value) || cols <= 0) return null;
279
+ const out = value.slice(0, Math.min(cols, TABLE_LIMITS.cols)).map((item) => typeof item === "string" && TABLE_ALIGNS.includes(item) ? item : null);
280
+ while (out.length && out[out.length - 1] === null) out.pop();
281
+ return out.length ? out : null;
282
+ };
283
+ const intersects = (a, b) => a.row < b.row + b.rowspan && b.row < a.row + a.rowspan && a.col < b.col + b.colspan && b.col < a.col + a.colspan;
284
+ const normalizeMerges = (merges, rows, cols, options = {}) => {
285
+ if (!Array.isArray(merges) || rows <= 0 || cols <= 0) return [];
286
+ const out = [];
287
+ for (const merge of merges.slice(0, TABLE_LIMITS.merges)) {
288
+ if (!isObject$2(merge)) continue;
289
+ const { row, col, rowspan, colspan } = merge;
290
+ if (![row, col, rowspan, colspan].every(Number.isInteger)) continue;
291
+ if (row < 0 || col < 0 || rowspan < 1 || colspan < 1 || rowspan * colspan < 2) continue;
292
+ if (row + rowspan > rows || col + colspan > cols) continue;
293
+ if (options.headerRow && row === 0 && rowspan > 1) continue;
294
+ const next = { row, col, rowspan, colspan };
295
+ if (out.some((other) => intersects(other, next))) continue;
296
+ out.push(next);
297
+ }
298
+ return out.sort((a, b) => a.row - b.row || a.col - b.col);
299
+ };
300
+ const mergeMap = (merges) => {
301
+ const anchors = /* @__PURE__ */ new Map();
302
+ const covered = /* @__PURE__ */ new Map();
303
+ for (const merge of merges || []) {
304
+ anchors.set(`${merge.row}:${merge.col}`, merge);
305
+ for (let r = merge.row; r < merge.row + merge.rowspan; r += 1)
306
+ for (let c = merge.col; c < merge.col + merge.colspan; c += 1)
307
+ if (r !== merge.row || c !== merge.col) covered.set(`${r}:${c}`, merge);
308
+ }
309
+ return { anchors, covered };
310
+ };
311
+ const headerKind = (data, row, col) => {
312
+ if (data.withHeadings === true && row === 0) return "col";
313
+ if (data.headerColumn === true && col === 0) return "row";
314
+ return null;
315
+ };
316
+ const tableLayout = (data) => {
317
+ const merges = Array.isArray(data.merges) ? data.merges : [];
318
+ const { anchors, covered } = mergeMap(merges);
319
+ const align = Array.isArray(data.align) ? data.align : [];
320
+ return (data.content || []).map(
321
+ (row, r) => row.map((html, c) => {
322
+ if (covered.has(`${r}:${c}`)) return null;
323
+ const merge = anchors.get(`${r}:${c}`);
324
+ return {
325
+ row: r,
326
+ col: c,
327
+ html,
328
+ rowspan: merge ? merge.rowspan : 1,
329
+ colspan: merge ? merge.colspan : 1,
330
+ header: headerKind(data, r, c),
331
+ align: typeof align[c] === "string" ? align[c] : null
332
+ };
333
+ }).filter(Boolean)
334
+ );
335
+ };
336
+ const isBlankInlineHtml = (html) => typeof html !== "string" || /^(?:\s|&nbsp;|&#160;|\u00a0|<br\s*\/?>)*$/i.test(html);
337
+ const cleanTableExtras = (out, d, inline) => {
338
+ if (d.headerColumn === true) out.headerColumn = true;
339
+ const rows = out.content.length;
340
+ const cols = tableWidth(out.content);
341
+ const align = cleanTableAlign(d.align, cols);
342
+ if (align) out.align = align;
343
+ const merges = normalizeMerges(d.merges, rows, cols, { headerRow: out.withHeadings === true });
344
+ if (merges.length) {
345
+ const { covered } = mergeMap(merges);
346
+ out.content = out.content.map(
347
+ (row, r) => Array.from(
348
+ { length: cols },
349
+ (_, c) => covered.has(`${r}:${c}`) ? "" : row[c] === void 0 ? "" : row[c]
350
+ )
351
+ );
352
+ out.merges = merges;
353
+ }
354
+ if (typeof d.caption === "string") {
355
+ const caption = inline(d.caption.slice(0, TABLE_LIMITS.caption));
356
+ if (!isBlankInlineHtml(caption)) out.caption = caption;
357
+ }
358
+ return out;
359
+ };
360
+ const toTableModel = (data, defaults = {}) => {
361
+ const d = isObject$2(data) ? data : {};
362
+ let content = Array.isArray(d.content) ? d.content.slice(0, TABLE_LIMITS.rows).map(
363
+ (row) => Array.isArray(row) ? row.slice(0, TABLE_LIMITS.cols).map((cell) => typeof cell === "string" ? cell : "") : []
364
+ ) : [];
365
+ let cols = tableWidth(content);
366
+ if (!content.length || !cols) {
367
+ const rows = Math.min(Math.max(Number(defaults.rows) || 2, 1), TABLE_LIMITS.rows);
368
+ cols = Math.min(Math.max(Number(defaults.cols) || 2, 1), TABLE_LIMITS.cols);
369
+ content = Array.from({ length: rows }, () => Array(cols).fill(""));
370
+ }
371
+ content = content.map((row) => row.length < cols ? [...row, ...Array(cols - row.length).fill("")] : row);
372
+ const withHeadings = typeof d.withHeadings === "boolean" ? d.withHeadings : Array.isArray(d.content) && d.content.length ? false : defaults.withHeadings === true;
373
+ const align = Array.from({ length: cols }, (_, c) => {
374
+ const value = Array.isArray(d.align) ? d.align[c] : null;
375
+ return TABLE_ALIGNS.includes(value) ? value : null;
376
+ });
377
+ return {
378
+ withHeadings,
379
+ stretched: d.stretched === true,
380
+ headerColumn: d.headerColumn === true,
381
+ content,
382
+ align,
383
+ merges: normalizeMerges(d.merges, content.length, cols, { headerRow: withHeadings }),
384
+ caption: typeof d.caption === "string" ? d.caption.slice(0, TABLE_LIMITS.caption) : ""
385
+ };
386
+ };
387
+ const fromTableModel = (model) => {
388
+ const { covered } = mergeMap(model.merges);
389
+ const out = {
390
+ withHeadings: model.withHeadings === true,
391
+ stretched: model.stretched === true,
392
+ content: model.content.map((row, r) => row.map((cell, c) => covered.has(`${r}:${c}`) ? "" : cell))
393
+ };
394
+ if (model.headerColumn) out.headerColumn = true;
395
+ const align = cleanTableAlign(model.align, tableWidth(model.content));
396
+ if (align) out.align = align;
397
+ if (model.merges.length) out.merges = model.merges.map((merge) => ({ ...merge }));
398
+ if (!isBlankInlineHtml(model.caption)) out.caption = model.caption;
399
+ return out;
400
+ };
401
+ const copy = (model) => ({
402
+ ...model,
403
+ content: model.content.map((row) => [...row]),
404
+ align: [...model.align],
405
+ merges: model.merges.map((merge) => ({ ...merge }))
406
+ });
407
+ const rowsOf = (model) => model.content.length;
408
+ const colsOf = (model) => model.content[0] ? model.content[0].length : 0;
409
+ const dropSingles = (merges) => merges.filter((merge) => merge.rowspan * merge.colspan >= 2);
410
+ const mergeAt = (model, row, col) => model.merges.find(
411
+ (merge) => row >= merge.row && row < merge.row + merge.rowspan && col >= merge.col && col < merge.col + merge.colspan
412
+ ) || null;
413
+ const spanAt = (model, row, col) => mergeAt(model, row, col) || { row, col, rowspan: 1, colspan: 1 };
414
+ const expandRect = (model, rect) => {
415
+ const out = {
416
+ top: Math.min(rect.top, rect.bottom),
417
+ bottom: Math.max(rect.top, rect.bottom),
418
+ left: Math.min(rect.left, rect.right),
419
+ right: Math.max(rect.left, rect.right)
420
+ };
421
+ let changed = true;
422
+ while (changed) {
423
+ changed = false;
424
+ for (const merge of model.merges) {
425
+ const box = {
426
+ row: out.top,
427
+ col: out.left,
428
+ rowspan: out.bottom - out.top + 1,
429
+ colspan: out.right - out.left + 1
430
+ };
431
+ if (!intersects(box, merge)) continue;
432
+ const bottom = merge.row + merge.rowspan - 1;
433
+ const right = merge.col + merge.colspan - 1;
434
+ if (merge.row < out.top || merge.col < out.left || bottom > out.bottom || right > out.right) {
435
+ out.top = Math.min(out.top, merge.row);
436
+ out.left = Math.min(out.left, merge.col);
437
+ out.bottom = Math.max(out.bottom, bottom);
438
+ out.right = Math.max(out.right, right);
439
+ changed = true;
440
+ }
441
+ }
442
+ }
443
+ return out;
444
+ };
445
+ const canMergeRect = (model, rect) => {
446
+ const box = expandRect(model, rect);
447
+ if (box.top < 0 || box.left < 0 || box.bottom >= rowsOf(model) || box.right >= colsOf(model)) return false;
448
+ if ((box.bottom - box.top + 1) * (box.right - box.left + 1) < 2) return false;
449
+ if (model.merges.some(
450
+ (m) => m.row === box.top && m.col === box.left && m.row + m.rowspan - 1 === box.bottom && m.col + m.colspan - 1 === box.right
451
+ ))
452
+ return false;
453
+ return !(model.withHeadings && box.top === 0 && box.bottom > 0);
454
+ };
455
+ const mergeRect = (model, rect) => {
456
+ if (!canMergeRect(model, rect)) return null;
457
+ const box = expandRect(model, rect);
458
+ const next = copy(model);
459
+ const { covered } = mergeMap(next.merges);
460
+ const parts = [];
461
+ for (let r = box.top; r <= box.bottom; r += 1)
462
+ for (let c = box.left; c <= box.right; c += 1) {
463
+ const html = covered.has(`${r}:${c}`) ? "" : next.content[r][c];
464
+ if (!isBlankInlineHtml(html)) parts.push(html);
465
+ next.content[r][c] = "";
466
+ }
467
+ next.content[box.top][box.left] = parts.join("<br>");
468
+ next.merges = next.merges.filter(
469
+ (m) => !(m.row >= box.top && m.col >= box.left && m.row + m.rowspan - 1 <= box.bottom && m.col + m.colspan - 1 <= box.right)
470
+ );
471
+ if (next.merges.length >= TABLE_LIMITS.merges) return null;
472
+ next.merges.push({
473
+ row: box.top,
474
+ col: box.left,
475
+ rowspan: box.bottom - box.top + 1,
476
+ colspan: box.right - box.left + 1
477
+ });
478
+ next.merges.sort((a, b) => a.row - b.row || a.col - b.col);
479
+ return next;
480
+ };
481
+ const neighbourRect = (model, row, col, direction) => {
482
+ const span = spanAt(model, row, col);
483
+ const rect = {
484
+ top: span.row,
485
+ left: span.col,
486
+ bottom: span.row + span.rowspan - 1,
487
+ right: span.col + span.colspan - 1
488
+ };
489
+ if (direction === "right") {
490
+ if (rect.right + 1 >= colsOf(model)) return null;
491
+ rect.right += 1;
492
+ } else {
493
+ if (rect.bottom + 1 >= rowsOf(model)) return null;
494
+ rect.bottom += 1;
495
+ }
496
+ return expandRect(model, rect);
497
+ };
498
+ const splitCell = (model, row, col) => {
499
+ const merge = mergeAt(model, row, col);
500
+ if (!merge) return null;
501
+ const next = copy(model);
502
+ next.merges = next.merges.filter((m) => !(m.row === merge.row && m.col === merge.col));
503
+ return next;
504
+ };
505
+ const insertRow = (model, at) => {
506
+ if (rowsOf(model) >= TABLE_LIMITS.rows || at < 0 || at > rowsOf(model)) return null;
507
+ const next = copy(model);
508
+ next.content.splice(at, 0, Array(colsOf(model)).fill(""));
509
+ next.merges = next.merges.map((m) => {
510
+ if (m.row >= at) return { ...m, row: m.row + 1 };
511
+ if (at < m.row + m.rowspan) return { ...m, rowspan: m.rowspan + 1 };
512
+ return m;
513
+ });
514
+ return next;
515
+ };
516
+ const deleteRow = (model, at) => {
517
+ if (rowsOf(model) <= 1 || at < 0 || at >= rowsOf(model)) return null;
518
+ const next = copy(model);
519
+ const merges = [];
520
+ for (const m of next.merges) {
521
+ if (m.row + m.rowspan - 1 < at) merges.push(m);
522
+ else if (m.row > at) merges.push({ ...m, row: m.row - 1 });
523
+ else if (m.rowspan > 1) {
524
+ if (m.row === at) next.content[at + 1][m.col] = next.content[at][m.col];
525
+ merges.push({ ...m, rowspan: m.rowspan - 1 });
526
+ }
527
+ }
528
+ next.content.splice(at, 1);
529
+ next.merges = normalizeMerges(dropSingles(merges), rowsOf(next), colsOf(next), {
530
+ headerRow: next.withHeadings
531
+ });
532
+ return next;
533
+ };
534
+ const insertColumn = (model, at) => {
535
+ if (colsOf(model) >= TABLE_LIMITS.cols || at < 0 || at > colsOf(model)) return null;
536
+ const next = copy(model);
537
+ next.content.forEach((row) => row.splice(at, 0, ""));
538
+ next.align.splice(at, 0, null);
539
+ next.merges = next.merges.map((m) => {
540
+ if (m.col >= at) return { ...m, col: m.col + 1 };
541
+ if (at < m.col + m.colspan) return { ...m, colspan: m.colspan + 1 };
542
+ return m;
543
+ });
544
+ return next;
545
+ };
546
+ const deleteColumn = (model, at) => {
547
+ if (colsOf(model) <= 1 || at < 0 || at >= colsOf(model)) return null;
548
+ const next = copy(model);
549
+ const merges = [];
550
+ for (const m of next.merges) {
551
+ if (m.col + m.colspan - 1 < at) merges.push(m);
552
+ else if (m.col > at) merges.push({ ...m, col: m.col - 1 });
553
+ else if (m.colspan > 1) {
554
+ if (m.col === at) next.content[m.row][at + 1] = next.content[m.row][at];
555
+ merges.push({ ...m, colspan: m.colspan - 1 });
556
+ }
557
+ }
558
+ next.content.forEach((row) => row.splice(at, 1));
559
+ next.align.splice(at, 1);
560
+ next.merges = dropSingles(merges);
561
+ return next;
562
+ };
563
+ const setHeaderRow = (model, on) => {
564
+ const next = copy(model);
565
+ next.withHeadings = Boolean(on);
566
+ next.merges = normalizeMerges(next.merges, rowsOf(next), colsOf(next), { headerRow: next.withHeadings });
567
+ return next;
568
+ };
569
+ const setColumnAlign = (model, col, value) => {
570
+ const next = copy(model);
571
+ if (col >= 0 && col < next.align.length) next.align[col] = TABLE_ALIGNS.includes(value) ? value : null;
572
+ return next;
573
+ };
574
+ const pasteGrid = (model, row, col, grid) => {
575
+ let next = copy(model);
576
+ const height = Math.min(grid.length, TABLE_LIMITS.rows - row);
577
+ const width = Math.min(tableWidth(grid), TABLE_LIMITS.cols - col);
578
+ while (rowsOf(next) < row + height) next = insertRow(next, rowsOf(next));
579
+ while (colsOf(next) < col + width) next = insertColumn(next, colsOf(next));
580
+ const { covered } = mergeMap(next.merges);
581
+ for (let r = 0; r < height; r += 1)
582
+ for (let c = 0; c < width; c += 1) {
583
+ if (covered.has(`${row + r}:${col + c}`)) continue;
584
+ const value = grid[r][c];
585
+ if (typeof value === "string") next.content[row + r][col + c] = value;
586
+ }
587
+ return next;
588
+ };
589
+ const parseTabularText = (text) => {
590
+ if (typeof text !== "string" || !text.includes(" ") || text.length > 1024 * 1024) return null;
591
+ const lines = text.replace(/\r\n?/g, "\n").replace(/\n$/, "").split("\n");
592
+ if (lines.length > TABLE_LIMITS.rows) lines.length = TABLE_LIMITS.rows;
593
+ return lines.map((line) => line.split(" ").slice(0, TABLE_LIMITS.cols));
594
+ };
254
595
  const INLINE_TAGS = Object.freeze([
255
596
  "b",
256
597
  "strong",
@@ -293,9 +634,16 @@ const cleanInternalLinkAttributes = (attribs) => {
293
634
  const isMentionLink = (attrs) => Boolean(
294
635
  attrs && attrs["data-mex-mention"] === "true" && attrs["data-mex-uid"] && attrs["data-mex-document-id"]
295
636
  );
637
+ const MATH_ATTRIBUTE = "data-mex-math";
638
+ const FOOTNOTE_ATTRIBUTES = Object.freeze(["data-mex-footnote", "data-mex-note"]);
639
+ const FOOTNOTE_ID = /^[A-Za-z0-9_-]{1,64}$/;
640
+ const MAX_MATH_TEX = 1e4;
641
+ const MAX_INLINE_TEX = 2e3;
642
+ const MAX_FOOTNOTE_NOTE = 4e3;
296
643
  const INLINE_ATTRIBUTES = Object.freeze({
297
644
  a: ["href", "target", "rel", "title", ...INTERNAL_LINK_ATTRIBUTES],
298
- span: ["class", "data-tooltip"],
645
+ span: ["class", "data-tooltip", MATH_ATTRIBUTE],
646
+ sup: [...FOOTNOTE_ATTRIBUTES],
299
647
  mark: ["class"],
300
648
  u: ["class"],
301
649
  s: ["class"],
@@ -431,6 +779,17 @@ const listItems = (items, inline, depth = 0) => {
431
779
  return out;
432
780
  });
433
781
  };
782
+ const MAX_CODE_FILENAME = 200;
783
+ const FILENAME_STRIP = (
784
+ // eslint-disable-next-line no-control-regex -- the point is to remove control characters
785
+ /[\u0000-\u001f\u007f-\u009f\u061c\u200b-\u200f\u2028-\u202e\u2060\u2066-\u2069\ufeff]/g
786
+ );
787
+ const cleanCodeFilename = (value) => {
788
+ if (typeof value !== "string") return "";
789
+ return Array.from(
790
+ value.slice(0, 4 * MAX_CODE_FILENAME).replace(/[\t\n\r\f\v]/g, " ").replace(FILENAME_STRIP, "").replace(/\s+/g, " ").trim()
791
+ ).slice(0, MAX_CODE_FILENAME).join("").trim();
792
+ };
434
793
  const BLOCK_POLICIES = {
435
794
  paragraph: (d, inline) => ({ text: inline(d.text) }),
436
795
  header: (d, inline) => ({ text: inline(d.text), level: int(d.level, 1, 6, 2) }),
@@ -485,6 +844,8 @@ const BLOCK_POLICIES = {
485
844
  language: typeof d.language === "string" && /^[a-z0-9+#-]{1,32}$/i.test(d.language) ? d.language : "plaintext"
486
845
  };
487
846
  if (typeof d.showlinenumbers === "boolean") out.showlinenumbers = d.showlinenumbers;
847
+ const filename = cleanCodeFilename(d.filename);
848
+ if (filename) out.filename = filename;
488
849
  return out;
489
850
  },
490
851
  raw: (d, _inline, ctx) => {
@@ -493,11 +854,18 @@ const BLOCK_POLICIES = {
493
854
  if (ctx.rawHtml === "disable") return { html: "" };
494
855
  return { html: ctx.rawSanitizer(html) };
495
856
  },
496
- table: (d, inline) => ({
497
- withHeadings: bool(d.withHeadings),
498
- stretched: bool(d.stretched),
499
- content: Array.isArray(d.content) ? d.content.slice(0, 500).map((row) => Array.isArray(row) ? row.slice(0, 100).map((cell) => inline(cell)) : []) : []
500
- }),
857
+ // 2.4: optional header column, column alignment, merged cells and caption (shared/table.mjs).
858
+ table: (d, inline) => cleanTableExtras(
859
+ {
860
+ withHeadings: bool(d.withHeadings),
861
+ stretched: bool(d.stretched),
862
+ content: Array.isArray(d.content) ? d.content.slice(0, TABLE_LIMITS.rows).map(
863
+ (row) => Array.isArray(row) ? row.slice(0, TABLE_LIMITS.cols).map((cell) => inline(cell)) : []
864
+ ) : []
865
+ },
866
+ d,
867
+ inline
868
+ ),
501
869
  image: (d, inline) => {
502
870
  const file = isPlainObject(d.file) ? d.file : {};
503
871
  const cleanFile = { url: sanitizeUrl(file.url, { schemes: ["http", "https"] }) };
@@ -621,6 +989,12 @@ const BLOCK_POLICIES = {
621
989
  ref: typeof d.ref === "string" && /^[a-z0-9]{1,64}$/.test(d.ref) ? d.ref : "",
622
990
  _mex: BUILT_IN_MARKER_VERSION
623
991
  }),
992
+ // Math block (2.4): only the TeX source is stored; `display: false` renders it in text style.
993
+ math: (d) => ({
994
+ tex: plain(d.tex, MAX_MATH_TEX),
995
+ display: d.display !== false,
996
+ _mex: BUILT_IN_MARKER_VERSION
997
+ }),
624
998
  toc: (d) => {
625
999
  const minLevel = int(d.minLevel, 1, 6, 2);
626
1000
  const maxLevel = int(d.maxLevel, 1, 6, 4);
@@ -669,12 +1043,14 @@ const sanitizeEditorData = (data, options) => {
669
1043
  const registered = policy ? null : registeredBlockOf(block, options.blocks);
670
1044
  const cleanData = policy ? policy(block.data || {}, inline, ctx) : registered ? registered.clean(block.data || {}, inline) : generic(block.data || {}, inline, 0);
671
1045
  for (const key of Object.keys(cleanData)) if (cleanData[key] === void 0) delete cleanData[key];
672
- const out = { id: block.id, type: block.type, data: cleanData };
1046
+ const out2 = { id: block.id, type: block.type, data: cleanData };
673
1047
  const tunes = sanitizeTunes(block.tunes);
674
- if (tunes) out.tunes = tunes;
675
- return out;
1048
+ if (tunes) out2.tunes = tunes;
1049
+ return out2;
676
1050
  });
677
- return { time: data.time, blocks, version: data.version };
1051
+ const out = { time: data.time, blocks, version: data.version };
1052
+ if (typeof data.fieldKey === "string") out.fieldKey = data.fieldKey;
1053
+ return out;
678
1054
  };
679
1055
  const sanitizeTarget = (value) => typeof value === "string" && TARGETS.has(value) ? value : null;
680
1056
  const BLOCK_FIELD_TYPES = Object.freeze([
@@ -1173,7 +1549,7 @@ const sanitizeRulesFor = (fields) => {
1173
1549
  s: { class: true },
1174
1550
  mark: { class: true },
1175
1551
  code: { class: true },
1176
- span: { class: true, "data-tooltip": true },
1552
+ span: { class: true, "data-tooltip": true, "data-mex-math": true },
1177
1553
  sub: true,
1178
1554
  sup: true,
1179
1555
  br: true,
@@ -1218,6 +1594,495 @@ const mergeCodeBlocks = (server, admin, locale) => {
1218
1594
  }
1219
1595
  return [...rows.values()].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1220
1596
  };
1597
+ const VOID_TAGS = /* @__PURE__ */ new Set([
1598
+ "area",
1599
+ "base",
1600
+ "br",
1601
+ "col",
1602
+ "embed",
1603
+ "hr",
1604
+ "img",
1605
+ "input",
1606
+ "link",
1607
+ "meta",
1608
+ "source",
1609
+ "track",
1610
+ "wbr"
1611
+ ]);
1612
+ const escapeHtml = (text) => String(text ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1613
+ const TAG_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
1614
+ const ATTRIBUTE_NAME = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
1615
+ const isSafeAttributeName = (name) => ATTRIBUTE_NAME.test(name) && !name.startsWith("on") && name !== "style" && name !== "srcdoc";
1616
+ const textNode = (value) => ({ type: "text", value: String(value ?? "") });
1617
+ const el$1 = (tag, attrs, children) => {
1618
+ const clean = {};
1619
+ for (const [name, value] of Object.entries(attrs || {})) {
1620
+ if (value === void 0 || value === null || value === false) continue;
1621
+ if (value === "" && name !== "alt") continue;
1622
+ clean[name] = value === true ? true : String(value);
1623
+ }
1624
+ return { type: "element", tag, attrs: clean, children: toNodes(children) };
1625
+ };
1626
+ const toNodes = (children) => {
1627
+ const out = [];
1628
+ const visit = (child) => {
1629
+ if (child === void 0 || child === null || child === false || child === "") return;
1630
+ if (Array.isArray(child)) {
1631
+ for (const item of child) visit(item);
1632
+ } else if (typeof child === "string" || typeof child === "number") {
1633
+ out.push(textNode(child));
1634
+ } else if (typeof child === "object") {
1635
+ out.push(
1636
+ /** @type {RenderNode} */
1637
+ child
1638
+ );
1639
+ }
1640
+ };
1641
+ visit(children);
1642
+ return out;
1643
+ };
1644
+ const STYLE_PROPERTIES = Object.freeze(["object-position"]);
1645
+ const STYLE_VALUE = /^[0-9]{1,3}(?:\.[0-9]{1,2})?% [0-9]{1,3}(?:\.[0-9]{1,2})?%$/;
1646
+ const safeStyle = (style) => style && typeof style === "object" ? Object.entries(style).filter(
1647
+ ([name, value]) => STYLE_PROPERTIES.includes(name) && typeof value === "string" && STYLE_VALUE.test(value)
1648
+ ) : [];
1649
+ const serializeNodes = (nodes) => {
1650
+ let out = "";
1651
+ for (const node of nodes) {
1652
+ if (!node || typeof node !== "object") continue;
1653
+ if (node.type === "text") out += escapeHtml(node.value);
1654
+ else if (node.type === "raw") out += node.html;
1655
+ else if (node.type === "block") out += serializeNodes(node.children);
1656
+ else if (node.type === "element") {
1657
+ let attributes = "";
1658
+ for (const [name, value] of Object.entries(node.attrs)) {
1659
+ attributes += value === true ? ` ${name}` : ` ${name}="${escapeHtml(value)}"`;
1660
+ }
1661
+ const style = safeStyle(node.style);
1662
+ if (style.length)
1663
+ attributes += ` style="${escapeHtml(style.map(([name, value]) => `${name}:${value}`).join(";"))}"`;
1664
+ out += VOID_TAGS.has(node.tag) ? `<${node.tag}${attributes}>` : `<${node.tag}${attributes}>${serializeNodes(node.children)}</${node.tag}>`;
1665
+ }
1666
+ }
1667
+ return out;
1668
+ };
1669
+ const nodesTextContent = (nodes) => {
1670
+ let out = "";
1671
+ for (const node of nodes) {
1672
+ if (node.type === "text") out += node.value;
1673
+ else if (node.type === "element" || node.type === "block") out += nodesTextContent(node.children);
1674
+ }
1675
+ return out;
1676
+ };
1677
+ const DROP_WITH_CONTENT = /* @__PURE__ */ new Set([
1678
+ "script",
1679
+ "style",
1680
+ "textarea",
1681
+ "title",
1682
+ "xmp",
1683
+ "noscript",
1684
+ "noembed",
1685
+ "noframes",
1686
+ "template",
1687
+ "iframe",
1688
+ "object",
1689
+ "embed",
1690
+ "svg",
1691
+ "math",
1692
+ "select",
1693
+ "option",
1694
+ "plaintext"
1695
+ ]);
1696
+ const ALLOWED = new Set(INLINE_TAGS);
1697
+ const VOID = /* @__PURE__ */ new Set(["br"]);
1698
+ const MAX_INPUT = 5e5;
1699
+ const MAX_NODES = 5e4;
1700
+ const MAX_DEPTH = 64;
1701
+ const NAMED_ENTITIES = Object.freeze({
1702
+ amp: "&",
1703
+ lt: "<",
1704
+ gt: ">",
1705
+ quot: '"',
1706
+ apos: "'",
1707
+ nbsp: " ",
1708
+ shy: "­",
1709
+ copy: "©",
1710
+ reg: "®",
1711
+ trade: "™",
1712
+ hellip: "…",
1713
+ mdash: "—",
1714
+ ndash: "–",
1715
+ lsquo: "‘",
1716
+ rsquo: "’",
1717
+ ldquo: "“",
1718
+ rdquo: "”",
1719
+ laquo: "«",
1720
+ raquo: "»",
1721
+ euro: "€",
1722
+ middot: "·",
1723
+ bull: "•",
1724
+ times: "×",
1725
+ deg: "°",
1726
+ tab: " ",
1727
+ newline: "\n",
1728
+ colon: ":",
1729
+ sol: "/",
1730
+ lpar: "(",
1731
+ rpar: ")"
1732
+ });
1733
+ const decodeEntities = (text) => String(text).replace(
1734
+ /&(#[xX][0-9a-fA-F]{1,8}|#[0-9]{1,10}|[A-Za-z][A-Za-z0-9]{1,31});?/g,
1735
+ (match, body) => {
1736
+ if (body[0] === "#") {
1737
+ const code = body[1] === "x" || body[1] === "X" ? parseInt(body.slice(2), 16) : parseInt(body.slice(1), 10);
1738
+ if (!Number.isFinite(code) || code <= 0 || code > 1114111 || code >= 55296 && code <= 57343)
1739
+ return "�";
1740
+ return String.fromCodePoint(code);
1741
+ }
1742
+ const named = NAMED_ENTITIES[body] ?? NAMED_ENTITIES[body.toLowerCase()];
1743
+ return named === void 0 ? match : named;
1744
+ }
1745
+ );
1746
+ const parseAttributes = (source) => {
1747
+ const out = {};
1748
+ const pattern = /([^\s"'<>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
1749
+ let match;
1750
+ while (match = pattern.exec(source)) {
1751
+ const name = match[1].toLowerCase();
1752
+ if (Object.prototype.hasOwnProperty.call(out, name)) continue;
1753
+ const raw = match[2] ?? match[3] ?? match[4] ?? "";
1754
+ out[name] = decodeEntities(raw);
1755
+ }
1756
+ return out;
1757
+ };
1758
+ const findTagEnd = (html, from) => {
1759
+ let quote = "";
1760
+ for (let i = from; i < html.length; i += 1) {
1761
+ const char = html[i];
1762
+ if (quote) {
1763
+ if (char === quote) quote = "";
1764
+ } else if (char === '"' || char === "'") quote = char;
1765
+ else if (char === ">") return i;
1766
+ }
1767
+ return -1;
1768
+ };
1769
+ const cleanAttributes = (tag, attribs, options = {}) => {
1770
+ const allowed = INLINE_ATTRIBUTES[tag] || [];
1771
+ const out = {};
1772
+ for (const name of allowed) {
1773
+ if (!Object.prototype.hasOwnProperty.call(attribs, name) || name.startsWith("data-mex-")) continue;
1774
+ const value = attribs[name];
1775
+ if (name === "href") {
1776
+ const url = sanitizeUrl(value);
1777
+ if (url) out.href = url;
1778
+ } else if (name === "target") {
1779
+ const target = sanitizeTarget(value);
1780
+ if (target) out.target = target;
1781
+ } else if (name === "rel") {
1782
+ const rel = String(value).split(/\s+/).filter((token) => /^[a-z-]{1,20}$/.test(token));
1783
+ if (rel.length) out.rel = rel.join(" ");
1784
+ } else if (name === "class") {
1785
+ const classes = String(value).split(/\s+/).filter((token) => (INLINE_CLASSES[tag] || []).includes(token));
1786
+ if (classes.length) out.class = classes.join(" ");
1787
+ } else {
1788
+ out[name] = String(value).slice(0, 2e3);
1789
+ }
1790
+ }
1791
+ if (tag === "a" && !options.inNote) Object.assign(out, cleanInternalLinkAttributes(attribs));
1792
+ return out;
1793
+ };
1794
+ const MAX_MARKER_TEXT = 16;
1795
+ const isMathNode = (node) => node.type === "element" && node.tag === "span" && node.attrs[MATH_ATTRIBUTE] === "true";
1796
+ const isFootnoteNode = (node) => node.type === "element" && node.tag === "sup" && typeof node.attrs["data-mex-footnote"] === "string";
1797
+ const finalizeSpecial = (nodes, depth = 0) => {
1798
+ for (const node of nodes) {
1799
+ if (node.type !== "element") continue;
1800
+ if (isMathNode(node)) {
1801
+ const tex = nodesToText(node.children, { raw: true }).replace(/\u200b/g, "").slice(0, MAX_INLINE_TEX);
1802
+ node.children = tex ? [{ type: "text", value: tex }] : [];
1803
+ } else if (isFootnoteNode(node)) {
1804
+ const text = nodesToText(node.children, { raw: true }).slice(0, MAX_MARKER_TEXT);
1805
+ node.children = text ? [{ type: "text", value: text }] : [];
1806
+ } else if (depth < MAX_DEPTH) finalizeSpecial(node.children, depth + 1);
1807
+ }
1808
+ return nodes;
1809
+ };
1810
+ const specialElement = (tag, attribs, options) => {
1811
+ if (tag === "span" && Object.prototype.hasOwnProperty.call(attribs, MATH_ATTRIBUTE)) {
1812
+ if (!/^(?:|true)$/.test(attribs[MATH_ATTRIBUTE])) return null;
1813
+ return { attrs: { [MATH_ATTRIBUTE]: "true" } };
1814
+ }
1815
+ if (tag === "sup" && !options.inNote) {
1816
+ const id = attribs["data-mex-footnote"];
1817
+ if (typeof id !== "string" || !FOOTNOTE_ID.test(id)) return null;
1818
+ const source = typeof attribs["data-mex-note"] === "string" ? attribs["data-mex-note"] : "";
1819
+ const note = parseInline(source.slice(0, MAX_FOOTNOTE_NOTE), { inNote: true });
1820
+ return { attrs: { "data-mex-footnote": id }, note };
1821
+ }
1822
+ return null;
1823
+ };
1824
+ const parseInline = (input2, options = {}) => {
1825
+ const html = typeof input2 === "string" ? input2.slice(0, MAX_INPUT) : "";
1826
+ const root = { type: "element", tag: "#root", attrs: {}, children: [] };
1827
+ const stack = [root];
1828
+ let nodes = 0;
1829
+ let text = "";
1830
+ const flush = () => {
1831
+ if (!text) return;
1832
+ const parent = stack[stack.length - 1];
1833
+ const last = parent.children[parent.children.length - 1];
1834
+ const value = decodeEntities(text);
1835
+ if (last && last.type === "text") last.value += value;
1836
+ else if (nodes < MAX_NODES) {
1837
+ parent.children.push({ type: "text", value });
1838
+ nodes += 1;
1839
+ }
1840
+ text = "";
1841
+ };
1842
+ let i = 0;
1843
+ while (i < html.length) {
1844
+ const lt = html.indexOf("<", i);
1845
+ if (lt === -1) {
1846
+ text += html.slice(i);
1847
+ break;
1848
+ }
1849
+ text += html.slice(i, lt);
1850
+ i = lt;
1851
+ if (html.startsWith("<!--", i)) {
1852
+ const end2 = html.indexOf("-->", i + 4);
1853
+ flush();
1854
+ i = end2 === -1 ? html.length : end2 + 3;
1855
+ continue;
1856
+ }
1857
+ if (html.startsWith("<![CDATA[", i)) {
1858
+ const end2 = html.indexOf("]]>", i + 9);
1859
+ flush();
1860
+ i = end2 === -1 ? html.length : end2 + 3;
1861
+ continue;
1862
+ }
1863
+ if (html[i + 1] === "!" || html[i + 1] === "?") {
1864
+ const end2 = html.indexOf(">", i + 2);
1865
+ flush();
1866
+ i = end2 === -1 ? html.length : end2 + 1;
1867
+ continue;
1868
+ }
1869
+ const closing = html[i + 1] === "/";
1870
+ const nameMatch = /^[A-Za-z][A-Za-z0-9-]{0,40}/.exec(html.slice(i + (closing ? 2 : 1), i + 45));
1871
+ if (!nameMatch) {
1872
+ text += "<";
1873
+ i += 1;
1874
+ continue;
1875
+ }
1876
+ const end = findTagEnd(html, i + 1);
1877
+ if (end === -1) {
1878
+ text += html.slice(i);
1879
+ break;
1880
+ }
1881
+ flush();
1882
+ const tag = nameMatch[0].toLowerCase();
1883
+ const body = html.slice(i + (closing ? 2 : 1) + nameMatch[0].length, end);
1884
+ i = end + 1;
1885
+ if (closing) {
1886
+ if (!ALLOWED.has(tag)) continue;
1887
+ for (let s = stack.length - 1; s > 0; s -= 1) {
1888
+ if (stack[s].tag === tag) {
1889
+ stack.length = s;
1890
+ break;
1891
+ }
1892
+ }
1893
+ continue;
1894
+ }
1895
+ if (DROP_WITH_CONTENT.has(tag)) {
1896
+ const selfClosing = /\/\s*$/.test(body);
1897
+ if (selfClosing) continue;
1898
+ const closeIndex = html.slice(i).search(new RegExp(`</${tag}[\\s/>]`, "i"));
1899
+ if (closeIndex === -1) break;
1900
+ const closeEnd = html.indexOf(">", i + closeIndex);
1901
+ i = closeEnd === -1 ? html.length : closeEnd + 1;
1902
+ continue;
1903
+ }
1904
+ if (!ALLOWED.has(tag) || nodes >= MAX_NODES) continue;
1905
+ const attribs = parseAttributes(body);
1906
+ const special = specialElement(tag, attribs, options);
1907
+ const element = {
1908
+ type: "element",
1909
+ tag,
1910
+ attrs: special ? special.attrs : cleanAttributes(tag, attribs, options),
1911
+ children: []
1912
+ };
1913
+ if (special && special.note) element.note = special.note;
1914
+ stack[stack.length - 1].children.push(element);
1915
+ nodes += 1;
1916
+ if (!VOID.has(tag) && stack.length < MAX_DEPTH) stack.push(element);
1917
+ }
1918
+ flush();
1919
+ return finalizeSpecial(root.children);
1920
+ };
1921
+ const resolveLinkAttributes = (attrs, resolver) => {
1922
+ if (typeof resolver !== "function" || !attrs["data-mex-uid"] || !attrs["data-mex-document-id"])
1923
+ return attrs;
1924
+ let result;
1925
+ try {
1926
+ result = resolver({
1927
+ uid: attrs["data-mex-uid"],
1928
+ documentId: attrs["data-mex-document-id"],
1929
+ locale: attrs["data-mex-locale"] || null,
1930
+ href: attrs.href || null,
1931
+ ...isMentionLink(attrs) ? { mention: true } : {}
1932
+ });
1933
+ } catch {
1934
+ result = void 0;
1935
+ }
1936
+ if (result === false) return null;
1937
+ if (typeof result === "string") {
1938
+ const url = sanitizeUrl(result);
1939
+ if (url) return { ...attrs, href: url };
1940
+ }
1941
+ return attrs;
1942
+ };
1943
+ const ATTRIBUTE_ORDER = [
1944
+ "href",
1945
+ "target",
1946
+ "rel",
1947
+ "title",
1948
+ "class",
1949
+ "data-tooltip",
1950
+ "data-mex-uid",
1951
+ "data-mex-document-id",
1952
+ "data-mex-locale",
1953
+ "data-mex-mention",
1954
+ MATH_ATTRIBUTE,
1955
+ "data-mex-footnote",
1956
+ "data-mex-note"
1957
+ ];
1958
+ const RENDER_STATE = Symbol.for("magic-editor-x.render-state");
1959
+ const storedNote = (note) => serializeNodes(inlineNodesToRender(note || [], { storage: true }));
1960
+ const MENTION_CLASS = "mex-mention";
1961
+ const inlineNodesToRender = (nodes, options = {}) => {
1962
+ const out = [];
1963
+ const state = options[RENDER_STATE];
1964
+ for (const node of nodes) {
1965
+ if (node.type === "text") {
1966
+ out.push({ type: "text", value: node.value });
1967
+ continue;
1968
+ }
1969
+ if (node.tag === "br") {
1970
+ out.push({ type: "element", tag: "br", attrs: {}, children: [] });
1971
+ continue;
1972
+ }
1973
+ if (isMathNode(node)) {
1974
+ const tex = nodesToText(node.children);
1975
+ if (state && !options.storage) {
1976
+ if (tex.trim()) out.push(state.math(tex, false));
1977
+ continue;
1978
+ }
1979
+ out.push({
1980
+ type: "element",
1981
+ tag: "span",
1982
+ attrs: { [MATH_ATTRIBUTE]: "true" },
1983
+ children: tex ? [{ type: "text", value: tex }] : []
1984
+ });
1985
+ continue;
1986
+ }
1987
+ if (isFootnoteNode(node)) {
1988
+ if (state && !options.storage) {
1989
+ out.push(state.footnote(node));
1990
+ continue;
1991
+ }
1992
+ const attrs2 = { "data-mex-footnote": node.attrs["data-mex-footnote"] };
1993
+ const note = storedNote(node.note);
1994
+ if (note) attrs2["data-mex-note"] = note;
1995
+ out.push({ type: "element", tag: "sup", attrs: attrs2, children: inlineNodesToRender(node.children, options) });
1996
+ continue;
1997
+ }
1998
+ let attrs = node.attrs;
1999
+ if (node.tag === "a") {
2000
+ attrs = resolveLinkAttributes(attrs, options.links);
2001
+ if (!attrs || !attrs.href) {
2002
+ out.push(...inlineNodesToRender(node.children, options));
2003
+ continue;
2004
+ }
2005
+ if (attrs.target === "_blank") {
2006
+ const rel = new Set(
2007
+ String(attrs.rel || "").split(/\s+/).filter(Boolean)
2008
+ );
2009
+ rel.add("noopener");
2010
+ rel.add("noreferrer");
2011
+ attrs = { ...attrs, rel: Array.from(rel).sort().join(" ") };
2012
+ }
2013
+ if (!options.storage && isMentionLink(attrs)) attrs = { ...attrs, class: MENTION_CLASS };
2014
+ }
2015
+ const ordered = {};
2016
+ for (const name of ATTRIBUTE_ORDER) {
2017
+ if (attrs[name] !== void 0 && attrs[name] !== "") ordered[name] = String(attrs[name]);
2018
+ }
2019
+ out.push({
2020
+ type: "element",
2021
+ tag: node.tag,
2022
+ attrs: ordered,
2023
+ children: inlineNodesToRender(node.children, options)
2024
+ });
2025
+ }
2026
+ return out;
2027
+ };
2028
+ const inlineToNodes = (html, options) => inlineNodesToRender(parseInline(html), options);
2029
+ const nodesToHtml = (nodes, options = {}) => serializeNodes(inlineNodesToRender(nodes, options));
2030
+ const nodesToText = (nodes, options = {}) => nodes.map((node) => {
2031
+ if (node.type === "text") return node.value;
2032
+ if (node.tag === "br") return "\n";
2033
+ if (!options.raw && isFootnoteNode(node))
2034
+ return typeof options.footnote === "function" ? options.footnote(node) : "";
2035
+ return nodesToText(node.children, options);
2036
+ }).join("");
2037
+ const inlineToHtml = (html, options) => nodesToHtml(parseInline(html), options);
2038
+ const inlineToText = (html, options) => nodesToText(parseInline(html), options).replace(/\u00a0/g, " ");
2039
+ const mapFootnoteNotes = (html, fn) => {
2040
+ if (typeof html !== "string" || !html.includes("data-mex-footnote")) return html;
2041
+ let changed = false;
2042
+ const visit = (nodes2, depth = 0) => {
2043
+ if (depth > MAX_DEPTH) return;
2044
+ for (const node of nodes2) {
2045
+ if (node.type !== "element") continue;
2046
+ if (isFootnoteNode(node)) {
2047
+ const before = storedNote(node.note);
2048
+ const after = fn(before);
2049
+ if (after !== before) {
2050
+ node.note = parseInline(String(after || ""), { inNote: true });
2051
+ changed = true;
2052
+ }
2053
+ } else visit(node.children, depth + 1);
2054
+ }
2055
+ };
2056
+ const nodes = parseInline(html);
2057
+ visit(nodes);
2058
+ return changed ? nodesToHtml(nodes, { storage: true }) : html;
2059
+ };
2060
+ const canonicalInlineExtras = (html, options = {}) => {
2061
+ if (typeof html !== "string") return "";
2062
+ const math = html.includes(MATH_ATTRIBUTE);
2063
+ const notes = html.includes("data-mex-footnote");
2064
+ if (!math && !notes) return html;
2065
+ const nodes = parseInline(html);
2066
+ if (options.footnotes === false && notes) {
2067
+ const strip = (list, depth = 0) => list.filter((node) => {
2068
+ if (node.type !== "element") return true;
2069
+ if (isFootnoteNode(node)) return false;
2070
+ if (depth < MAX_DEPTH) node.children = strip(node.children, depth + 1);
2071
+ return true;
2072
+ });
2073
+ return nodesToHtml(strip(nodes), { storage: true });
2074
+ }
2075
+ return nodesToHtml(nodes, { storage: true });
2076
+ };
2077
+ const walkInlineElements = (nodes, fn, inNote = false, depth = 0) => {
2078
+ if (depth > MAX_DEPTH) return;
2079
+ for (const node of nodes) {
2080
+ if (node.type !== "element") continue;
2081
+ fn(node, inNote);
2082
+ walkInlineElements(node.children, fn, inNote, depth + 1);
2083
+ if (node.note) walkInlineElements(node.note, fn, true, depth + 1);
2084
+ }
2085
+ };
1221
2086
  let purify = null;
1222
2087
  const instance = () => {
1223
2088
  if (purify) return purify;
@@ -1254,16 +2119,20 @@ const instance = () => {
1254
2119
  return purify;
1255
2120
  };
1256
2121
  const ALLOWED_ATTR = Array.from(new Set(Object.values(INLINE_ATTRIBUTES).flat()));
1257
- const sanitizeInline = (html) => instance().sanitize(String(html || ""), {
1258
- ALLOWED_TAGS: [...INLINE_TAGS],
1259
- ALLOWED_ATTR,
1260
- ALLOW_DATA_ATTR: false,
1261
- // DOMPurify checks attribute values like URIs; `api::article.article` looks
1262
- // like an unknown scheme and was dropped, which removed the entry reference
1263
- // of internal links whenever content was shown again. The values are
1264
- // validated by cleanInternalLinkAttributes in the hook above.
1265
- ADD_URI_SAFE_ATTR: [...INTERNAL_LINK_ATTRIBUTES]
1266
- });
2122
+ const sanitizeInline = (html) => canonicalInlineExtras(
2123
+ instance().sanitize(String(html || ""), {
2124
+ ALLOWED_TAGS: [...INLINE_TAGS],
2125
+ ALLOWED_ATTR,
2126
+ ALLOW_DATA_ATTR: false,
2127
+ // DOMPurify checks attribute values like URIs; `api::article.article` looks
2128
+ // like an unknown scheme and was dropped, which removed the entry reference
2129
+ // of internal links whenever content was shown again. The values are
2130
+ // validated by cleanInternalLinkAttributes in the hook above, and math and
2131
+ // footnote attributes (2.4: a note is inline HTML, "See: …" looks like a
2132
+ // scheme too) by `canonicalInlineExtras` below.
2133
+ ADD_URI_SAFE_ATTR: [...INTERNAL_LINK_ATTRIBUTES, MATH_ATTRIBUTE, ...FOOTNOTE_ATTRIBUTES]
2134
+ })
2135
+ );
1267
2136
  const sanitizeTemplate = (html) => instance().sanitize(String(html || ""), {
1268
2137
  ALLOWED_TAGS: [
1269
2138
  "div",
@@ -1453,7 +2322,10 @@ const ICONS = {
1453
2322
  stretch: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 12h18m-15-3-3 3 3 3m12-6 3 3-3 3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
1454
2323
  mention: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',
1455
2324
  toc: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6h2M4 12h2M4 18h2M9 6h11M12 12h8M12 18h8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',
1456
- lineNumbers: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6h2M4 12h2M4 18h2M10 6h10M10 12h10M10 18h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>'
2325
+ lineNumbers: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 6h2M4 12h2M4 18h2M10 6h10M10 12h10M10 18h10" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',
2326
+ math: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M18 5H6l6 7-6 7h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
2327
+ inlineMath: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 18c3 0 3-12 6-12M5 11h5m4 1 6 6m0-6-6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
2328
+ footnote: '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4 18h10M4 13h10M17 4l2-1v6m-2 0h4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
1457
2329
  };
1458
2330
  const tools = /* @__PURE__ */ new Map();
1459
2331
  const registerBlock = (options) => {
@@ -1586,33 +2458,33 @@ const createReactTool = (Component, options = {}) => {
1586
2458
  const LOADERS = {
1587
2459
  en: () => [
1588
2460
  Promise.resolve().then(() => require("./en-CIZ5Ggod.js")),
1589
- Promise.resolve().then(() => require("./en-CDg_18Bt.js")),
1590
- Promise.resolve().then(() => require("./en-Ah-Cw0Wd.js")),
1591
- Promise.resolve().then(() => require("./en-BkEjpC3i.js"))
2461
+ Promise.resolve().then(() => require("./en-BMWhILnj.js")),
2462
+ Promise.resolve().then(() => require("./en-B9ApE1y1.js")),
2463
+ Promise.resolve().then(() => require("./en-CpehF0Kv.js"))
1592
2464
  ],
1593
2465
  de: () => [
1594
2466
  Promise.resolve().then(() => require("./de-Dn8athM8.js")),
1595
- Promise.resolve().then(() => require("./de-B1X46JJZ.js")),
1596
- Promise.resolve().then(() => require("./de-2Ie5jy7j.js")),
1597
- Promise.resolve().then(() => require("./de-C3AsGauQ.js"))
2467
+ Promise.resolve().then(() => require("./de-zcV8D7nt.js")),
2468
+ Promise.resolve().then(() => require("./de-BhhGss1l.js")),
2469
+ Promise.resolve().then(() => require("./de-CbBDnXeT.js"))
1598
2470
  ],
1599
2471
  fr: () => [
1600
2472
  Promise.resolve().then(() => require("./fr-Zkb8vfjN.js")),
1601
- Promise.resolve().then(() => require("./fr-ZcN0yM_2.js")),
1602
- Promise.resolve().then(() => require("./fr-OJ4VW1kh.js")),
1603
- Promise.resolve().then(() => require("./fr-C2aLSwEu.js"))
2473
+ Promise.resolve().then(() => require("./fr-DpC44Ol8.js")),
2474
+ Promise.resolve().then(() => require("./fr-iGeIfEcU.js")),
2475
+ Promise.resolve().then(() => require("./fr-COOsqexl.js"))
1604
2476
  ],
1605
2477
  es: () => [
1606
2478
  Promise.resolve().then(() => require("./es-C4IRHV5d.js")),
1607
- Promise.resolve().then(() => require("./es-BCpJmUEM.js")),
1608
- Promise.resolve().then(() => require("./es-Cr8JH85N.js")),
1609
- Promise.resolve().then(() => require("./es-C4pEnDRv.js"))
2479
+ Promise.resolve().then(() => require("./es-CQPh8PXw.js")),
2480
+ Promise.resolve().then(() => require("./es-C0W31rl8.js")),
2481
+ Promise.resolve().then(() => require("./es-CawpzwyC.js"))
1610
2482
  ],
1611
2483
  pt: () => [
1612
2484
  Promise.resolve().then(() => require("./pt-1IUyx6ae.js")),
1613
- Promise.resolve().then(() => require("./pt-CImqDnLB.js")),
1614
- Promise.resolve().then(() => require("./pt-D0I0_JYs.js")),
1615
- Promise.resolve().then(() => require("./pt-DX0OAIoL.js"))
2485
+ Promise.resolve().then(() => require("./pt-Bo0Pm_Pt.js")),
2486
+ Promise.resolve().then(() => require("./pt-BHmXk2d9.js")),
2487
+ Promise.resolve().then(() => require("./pt-DXy7G1x7.js"))
1616
2488
  ]
1617
2489
  };
1618
2490
  const PRESET_OPTIONS = [
@@ -1643,6 +2515,22 @@ const index = {
1643
2515
  */
1644
2516
  register(app) {
1645
2517
  app.registerPlugin({ id: PLUGIN_ID, name: PLUGIN_ID, apis: { registerBlock, createReactTool } });
2518
+ if (app.widgets && typeof app.widgets.register === "function") {
2519
+ app.widgets.register({
2520
+ id: "mentions",
2521
+ pluginId: PLUGIN_ID,
2522
+ icon: icons.Bell,
2523
+ title: { id: getTranslation("widget.mentions.title"), defaultMessage: "Mentions and replies" },
2524
+ component: async () => {
2525
+ const { MentionsWidget } = await Promise.resolve().then(() => require("./MentionsWidget-C2OCAmqq.js"));
2526
+ return MentionsWidget;
2527
+ },
2528
+ permissions: [
2529
+ { action: "plugin::magic-editor-x.access" },
2530
+ { action: "plugin::magic-editor-x.comments.read" }
2531
+ ]
2532
+ });
2533
+ }
1646
2534
  app.customFields.register({
1647
2535
  name: "richtext",
1648
2536
  pluginId: PLUGIN_ID,
@@ -1654,7 +2542,7 @@ const index = {
1654
2542
  },
1655
2543
  icon: PluginIcon,
1656
2544
  components: {
1657
- Input: () => Promise.resolve().then(() => require("./index-Cm-fFUhE.js")).then((n) => n.index)
2545
+ Input: () => Promise.resolve().then(() => require("./index-64wc26Bl.js")).then((n) => n.index)
1658
2546
  },
1659
2547
  options: {
1660
2548
  base: [
@@ -1852,21 +2740,28 @@ const index = {
1852
2740
  intlLabel: { id: getTranslation("settings.link.configuration"), defaultMessage: "Configuration" },
1853
2741
  to: `${PLUGIN_ID}/configuration`,
1854
2742
  permissions: PERMISSIONS.settingsRead,
1855
- Component: () => Promise.resolve().then(() => require("./ConfigurationPage-C-UktL1x.js"))
2743
+ Component: () => Promise.resolve().then(() => require("./ConfigurationPage-D6uya-J1.js"))
1856
2744
  },
1857
2745
  {
1858
2746
  id: `${PLUGIN_ID}-custom-blocks`,
1859
2747
  intlLabel: { id: getTranslation("settings.link.customBlocks"), defaultMessage: "Custom blocks" },
1860
2748
  to: `${PLUGIN_ID}/custom-blocks`,
1861
2749
  permissions: PERMISSIONS.customBlocksManage,
1862
- Component: () => Promise.resolve().then(() => require("./CustomBlocksPage-CxcTfdOT.js"))
2750
+ Component: () => Promise.resolve().then(() => require("./CustomBlocksPage-DP3h_wNd.js"))
1863
2751
  },
1864
2752
  {
1865
2753
  id: `${PLUGIN_ID}-templates`,
1866
2754
  intlLabel: { id: getTranslation("settings.link.templates"), defaultMessage: "Templates" },
1867
2755
  to: `${PLUGIN_ID}/templates`,
1868
2756
  permissions: PERMISSIONS.templatesManage,
1869
- Component: () => Promise.resolve().then(() => require("./TemplatesPage-Hn6gyu2l.js"))
2757
+ Component: () => Promise.resolve().then(() => require("./TemplatesPage-DrSJdteI.js"))
2758
+ },
2759
+ {
2760
+ id: `${PLUGIN_ID}-audit`,
2761
+ intlLabel: { id: getTranslation("settings.link.audit"), defaultMessage: "Audit trail" },
2762
+ to: `${PLUGIN_ID}/audit`,
2763
+ permissions: PERMISSIONS.auditRead,
2764
+ Component: () => Promise.resolve().then(() => require("./AuditPage-C2u6z4aN.js"))
1870
2765
  }
1871
2766
  ]
1872
2767
  );
@@ -1893,48 +2788,103 @@ exports.BLOCK_POLICIES = BLOCK_POLICIES;
1893
2788
  exports.BUILT_IN_MARKER = BUILT_IN_MARKER;
1894
2789
  exports.BUILT_IN_MARKER_VERSION = BUILT_IN_MARKER_VERSION;
1895
2790
  exports.EDITOR_DATA_LIMITS = EDITOR_DATA_LIMITS;
2791
+ exports.FOOTNOTE_ATTRIBUTES = FOOTNOTE_ATTRIBUTES;
2792
+ exports.FOOTNOTE_ID = FOOTNOTE_ID;
1896
2793
  exports.ICONS = ICONS;
1897
- exports.INLINE_ATTRIBUTES = INLINE_ATTRIBUTES;
1898
- exports.INLINE_CLASSES = INLINE_CLASSES;
1899
- exports.INLINE_TAGS = INLINE_TAGS;
1900
2794
  exports.INTERNAL_LINK_ATTRIBUTES = INTERNAL_LINK_ATTRIBUTES;
1901
2795
  exports.LINK_SCHEMES = LINK_SCHEMES;
1902
2796
  exports.MARKED_BLOCKS = MARKED_BLOCKS;
2797
+ exports.MATH_ATTRIBUTE = MATH_ATTRIBUTE;
2798
+ exports.MAX_CODE_FILENAME = MAX_CODE_FILENAME;
2799
+ exports.MAX_FOOTNOTE_NOTE = MAX_FOOTNOTE_NOTE;
1903
2800
  exports.MAX_GALLERY_IMAGES = MAX_GALLERY_IMAGES;
2801
+ exports.MAX_INLINE_TEX = MAX_INLINE_TEX;
2802
+ exports.MAX_MATH_TEX = MAX_MATH_TEX;
1904
2803
  exports.MAX_MEDIA_TRACKS = MAX_MEDIA_TRACKS;
1905
2804
  exports.PERMISSIONS = PERMISSIONS;
2805
+ exports.RENDER_STATE = RENDER_STATE;
2806
+ exports.TABLE_ALIGNS = TABLE_ALIGNS;
2807
+ exports.TABLE_LIMITS = TABLE_LIMITS;
2808
+ exports.TAG_NAME = TAG_NAME;
1906
2809
  exports.TRACK_KINDS = TRACK_KINDS;
2810
+ exports.VOID_TAGS = VOID_TAGS;
1907
2811
  exports.activeBlocks = activeBlocks;
2812
+ exports.basePathOf = basePathOf;
1908
2813
  exports.buildCodeBlockTools = buildCodeBlockTools;
1909
2814
  exports.button = button;
1910
2815
  exports.byteLength = byteLength;
2816
+ exports.canMergeRect = canMergeRect;
2817
+ exports.canonicalInlineExtras = canonicalInlineExtras;
2818
+ exports.cleanCodeFilename = cleanCodeFilename;
1911
2819
  exports.cleanFocalPoint = cleanFocalPoint;
1912
- exports.cleanInternalLinkAttributes = cleanInternalLinkAttributes;
1913
2820
  exports.cleanMediaFile = cleanMediaFile;
2821
+ exports.cleanTableAlign = cleanTableAlign;
1914
2822
  exports.cloneJsonSafe = cloneJsonSafe;
1915
2823
  exports.codeBlocks = codeBlocks;
1916
2824
  exports.compileBlockList = compileBlockList;
1917
2825
  exports.computeStats = computeStats;
2826
+ exports.createFieldKey = createFieldKey;
2827
+ exports.decodeEntities = decodeEntities;
2828
+ exports.deleteColumn = deleteColumn;
2829
+ exports.deleteRow = deleteRow;
1918
2830
  exports.editable = editable;
1919
2831
  exports.el = el;
1920
- exports.escapeHtml = escapeHtml;
2832
+ exports.el$1 = el$1;
2833
+ exports.escapeHtml = escapeHtml$1;
2834
+ exports.escapeHtml$1 = escapeHtml;
2835
+ exports.expandRect = expandRect;
1921
2836
  exports.field = field;
2837
+ exports.fromTableModel = fromTableModel;
1922
2838
  exports.getTranslation = getTranslation;
1923
2839
  exports.hashString = hashString;
2840
+ exports.headerKind = headerKind;
1924
2841
  exports.index = index;
2842
+ exports.inlineNodesToRender = inlineNodesToRender;
2843
+ exports.inlineToHtml = inlineToHtml;
2844
+ exports.inlineToNodes = inlineToNodes;
2845
+ exports.inlineToText = inlineToText;
1925
2846
  exports.input = input;
2847
+ exports.insertColumn = insertColumn;
2848
+ exports.insertRow = insertRow;
2849
+ exports.isBlankInlineHtml = isBlankInlineHtml;
1926
2850
  exports.isBuiltInBlock = isBuiltInBlock;
1927
- exports.isMentionLink = isMentionLink;
2851
+ exports.isFootnoteNode = isFootnoteNode;
2852
+ exports.isMathNode = isMathNode;
1928
2853
  exports.isPlainObject = isPlainObject;
2854
+ exports.isPositionalFieldPath = isPositionalFieldPath;
2855
+ exports.isSafeAttributeName = isSafeAttributeName;
2856
+ exports.isValidFieldKey = isValidFieldKey;
2857
+ exports.mapFootnoteNotes = mapFootnoteNotes;
1929
2858
  exports.mergeCodeBlocks = mergeCodeBlocks;
2859
+ exports.mergeMap = mergeMap;
2860
+ exports.mergeRect = mergeRect;
2861
+ exports.neighbourRect = neighbourRect;
2862
+ exports.nodesTextContent = nodesTextContent;
2863
+ exports.nodesToHtml = nodesToHtml;
2864
+ exports.nodesToText = nodesToText;
1930
2865
  exports.normalizeEditorDataSafe = normalizeEditorDataSafe;
2866
+ exports.normalizeMerges = normalizeMerges;
2867
+ exports.parseInline = parseInline;
2868
+ exports.parseTabularText = parseTabularText;
2869
+ exports.pasteGrid = pasteGrid;
1931
2870
  exports.prepareEditorValue = prepareEditorValue;
1932
2871
  exports.prepareRemoteData = prepareRemoteData;
1933
2872
  exports.registeredBlockOf = registeredBlockOf;
2873
+ exports.resolveLinkAttributes = resolveLinkAttributes;
2874
+ exports.safeStyle = safeStyle;
1934
2875
  exports.sanitizeInline = sanitizeInline;
1935
2876
  exports.sanitizeSvg = sanitizeSvg;
1936
- exports.sanitizeTarget = sanitizeTarget;
1937
2877
  exports.sanitizeTemplate = sanitizeTemplate;
1938
2878
  exports.sanitizeTunes = sanitizeTunes;
1939
2879
  exports.sanitizeUrl = sanitizeUrl;
1940
2880
  exports.select = select;
2881
+ exports.serializeNodes = serializeNodes;
2882
+ exports.setColumnAlign = setColumnAlign;
2883
+ exports.setHeaderRow = setHeaderRow;
2884
+ exports.spanAt = spanAt;
2885
+ exports.splitCell = splitCell;
2886
+ exports.tableLayout = tableLayout;
2887
+ exports.textNode = textNode;
2888
+ exports.toNodes = toNodes;
2889
+ exports.toTableModel = toTableModel;
2890
+ exports.walkInlineElements = walkInlineElements;