@harbour-enterprises/superdoc 0.13.2-rev7 → 0.13.2-rev9

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 (41) hide show
  1. package/dist/chunks/{eventemitter3-DfVviFzP.cjs → eventemitter3-CHxWXmuK.cjs} +1 -1
  2. package/dist/chunks/{eventemitter3-BrspJk8q.es.js → eventemitter3-KKY27oz-.es.js} +1 -1
  3. package/dist/chunks/{index-Hr3Um-Bg.es.js → index-BqLFjUHn.es.js} +2 -2
  4. package/dist/chunks/{index-B4J7wgs6.cjs → index-CweAXNfB.cjs} +2 -2
  5. package/dist/chunks/{index-Diu6UKHt.es.js → index-DS3W0eVB.es.js} +4 -4
  6. package/dist/chunks/{index-Cdsq63Xq.cjs → index-kOMfCfBT.cjs} +4 -4
  7. package/dist/chunks/{jszip-BTAcmbVg.cjs → jszip-9bCX1h2W.cjs} +1 -1
  8. package/dist/chunks/{jszip-DckFs3A7.es.js → jszip-Cl3s9njw.es.js} +1 -1
  9. package/dist/chunks/{super-editor.es-C25JkSnI.es.js → super-editor.es-BE0HKCoV.es.js} +187 -50
  10. package/dist/chunks/{super-editor.es-Djlcx6Si.cjs → super-editor.es-TaswSSDL.cjs} +187 -50
  11. package/dist/chunks/{url-BIzg4y2i.cjs → url-B8LY3nwf.cjs} +2 -2
  12. package/dist/chunks/{url-CHayXMZH.es.js → url-Bq00tGvm.es.js} +2 -2
  13. package/dist/chunks/{vue-Bi1uWinj.es.js → vue-BBJVqxjL.es.js} +10 -3
  14. package/dist/chunks/{vue-HIY1g7dm.cjs → vue-BBjMeYfo.cjs} +10 -3
  15. package/dist/chunks/{xml-js-CfClL-1b.es.js → xml-js-1F0lia4t.es.js} +81 -102
  16. package/dist/chunks/{xml-js-BjqmFOSP.cjs → xml-js-BuAdLsHD.cjs} +81 -102
  17. package/dist/super-editor/ai-writer.es.js +2 -2
  18. package/dist/super-editor/chunks/{converter-Fwt4-8Pg.js → converter-BvRopd2F.js} +2 -2
  19. package/dist/super-editor/chunks/{docx-zipper-BOV7cSCY.js → docx-zipper-CZ8M74hv.js} +1 -1
  20. package/dist/super-editor/chunks/{editor-CR0_l9jt.js → editor-D1rD0fdS.js} +174 -36
  21. package/dist/super-editor/chunks/{toolbar-D38Br8cP.js → toolbar-CvP4K1yD.js} +2 -3
  22. package/dist/super-editor/converter.es.js +1 -1
  23. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  24. package/dist/super-editor/core/helpers/annotator.d.ts +4 -0
  25. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  26. package/dist/super-editor/docx-zipper.es.js +2 -2
  27. package/dist/super-editor/editor.es.js +3 -3
  28. package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  29. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findRemovedFieldAnnotations.d.ts.map +1 -1
  30. package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts.map +1 -1
  31. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  32. package/dist/super-editor/file-zipper.es.js +1 -1
  33. package/dist/super-editor/super-editor.es.js +6 -6
  34. package/dist/super-editor/toolbar.es.js +2 -2
  35. package/dist/super-editor.cjs +2 -2
  36. package/dist/super-editor.es.js +2 -2
  37. package/dist/superdoc.cjs +8 -9
  38. package/dist/superdoc.es.js +9 -10
  39. package/dist/superdoc.umd.js +197 -54
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BTAcmbVg.cjs");
2
+ const jszip = require("./jszip-9bCX1h2W.cjs");
3
3
  var eventemitter3 = { exports: {} };
4
4
  (function(module2) {
5
5
  var has = Object.prototype.hasOwnProperty, prefix = "~";
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-DckFs3A7.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-Cl3s9njw.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  (function(module) {
4
4
  var has = Object.prototype.hasOwnProperty, prefix = "~";
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-DckFs3A7.es.js";
2
- import { s as streamHttp, r as require$$1 } from "./index-Diu6UKHt.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-Cl3s9njw.es.js";
2
+ import { s as streamHttp, r as require$$1 } from "./index-DS3W0eVB.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BTAcmbVg.cjs");
3
- const index$2 = require("./index-Cdsq63Xq.cjs");
2
+ const jszip = require("./jszip-9bCX1h2W.cjs");
3
+ const index$2 = require("./index-kOMfCfBT.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,7 +1,7 @@
1
- import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-DckFs3A7.es.js";
2
- import { p as process$1 } from "./vue-Bi1uWinj.es.js";
3
- import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-CfClL-1b.es.js";
4
- import { u as url } from "./url-CHayXMZH.es.js";
1
+ import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-Cl3s9njw.es.js";
2
+ import { p as process$1 } from "./vue-BBJVqxjL.es.js";
3
+ import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-1F0lia4t.es.js";
4
+ import { u as url } from "./url-Bq00tGvm.es.js";
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
7
7
  const e = m[i];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-BTAcmbVg.cjs");
3
- const vue = require("./vue-HIY1g7dm.cjs");
4
- const xmlJs = require("./xml-js-BjqmFOSP.cjs");
5
- const url = require("./url-BIzg4y2i.cjs");
2
+ const jszip = require("./jszip-9bCX1h2W.cjs");
3
+ const vue = require("./vue-BBjMeYfo.cjs");
4
+ const xmlJs = require("./xml-js-BuAdLsHD.cjs");
5
+ const url = require("./url-B8LY3nwf.cjs");
6
6
  function _mergeNamespaces(n, m) {
7
7
  for (var i = 0; i < m.length; i++) {
8
8
  const e = m[i];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- require("./vue-HIY1g7dm.cjs");
2
+ require("./vue-BBjMeYfo.cjs");
3
3
  var buffer = {};
4
4
  var base64Js = {};
5
5
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import "./vue-Bi1uWinj.es.js";
1
+ import "./vue-BBJVqxjL.es.js";
2
2
  var buffer = {};
3
3
  var base64Js = {};
4
4
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-Bi1uWinj.es.js";
1
+ import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted } from "./vue-BBJVqxjL.es.js";
2
2
  import * as Y from "yjs";
3
3
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
4
4
  var __defProp$2 = Object.defineProperty;
@@ -13726,7 +13726,7 @@ class ReplaceStep extends Step {
13726
13726
  }
13727
13727
  }
13728
13728
  Step.jsonID("replace", ReplaceStep);
13729
- class ReplaceAroundStep extends Step {
13729
+ let ReplaceAroundStep$1 = class ReplaceAroundStep2 extends Step {
13730
13730
  /**
13731
13731
  Create a replace-around step with the given range and gap.
13732
13732
  `insert` should be the point in the slice into which the content
@@ -13766,7 +13766,7 @@ class ReplaceAroundStep extends Step {
13766
13766
  }
13767
13767
  invert(doc2) {
13768
13768
  let gap = this.gapTo - this.gapFrom;
13769
- return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc2.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
13769
+ return new ReplaceAroundStep2(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc2.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
13770
13770
  }
13771
13771
  map(mapping) {
13772
13772
  let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
@@ -13774,7 +13774,7 @@ class ReplaceAroundStep extends Step {
13774
13774
  let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
13775
13775
  if (from2.deletedAcross && to.deletedAcross || gapFrom < from2.pos || gapTo > to.pos)
13776
13776
  return null;
13777
- return new ReplaceAroundStep(from2.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
13777
+ return new ReplaceAroundStep2(from2.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
13778
13778
  }
13779
13779
  toJSON() {
13780
13780
  let json = {
@@ -13797,10 +13797,10 @@ class ReplaceAroundStep extends Step {
13797
13797
  static fromJSON(schema, json) {
13798
13798
  if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number")
13799
13799
  throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
13800
- return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
13800
+ return new ReplaceAroundStep2(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
13801
13801
  }
13802
- }
13803
- Step.jsonID("replaceAround", ReplaceAroundStep);
13802
+ };
13803
+ Step.jsonID("replaceAround", ReplaceAroundStep$1);
13804
13804
  function contentBetween(doc2, from2, to) {
13805
13805
  let $from = doc2.resolve(from2), dist2 = to - from2, depth = $from.depth;
13806
13806
  while (dist2 > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
@@ -13953,7 +13953,7 @@ function lift(tr, range2, target) {
13953
13953
  } else {
13954
13954
  end2++;
13955
13955
  }
13956
- tr.step(new ReplaceAroundStep(start2, end2, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
13956
+ tr.step(new ReplaceAroundStep$1(start2, end2, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
13957
13957
  }
13958
13958
  function findWrapping(range2, nodeType, attrs = null, innerRange = range2) {
13959
13959
  let around = findWrappingOutside(range2, nodeType);
@@ -13998,7 +13998,7 @@ function wrap(tr, range2, wrappers) {
13998
13998
  content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
13999
13999
  }
14000
14000
  let start2 = range2.start, end2 = range2.end;
14001
- tr.step(new ReplaceAroundStep(start2, end2, start2, end2, new Slice(content, 0, 0), wrappers.length, true));
14001
+ tr.step(new ReplaceAroundStep$1(start2, end2, start2, end2, new Slice(content, 0, 0), wrappers.length, true));
14002
14002
  }
14003
14003
  function setBlockType$1(tr, from2, to, type2, attrs) {
14004
14004
  if (!type2.isTextblock)
@@ -14020,7 +14020,7 @@ function setBlockType$1(tr, from2, to, type2, attrs) {
14020
14020
  clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type2, void 0, convertNewlines === null);
14021
14021
  let mapping = tr.mapping.slice(mapFrom);
14022
14022
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node2.nodeSize, 1);
14023
- tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type2.create(attrsHere, null, node2.marks)), 0, 0), 1, true));
14023
+ tr.step(new ReplaceAroundStep$1(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type2.create(attrsHere, null, node2.marks)), 0, 0), 1, true));
14024
14024
  if (convertNewlines === true)
14025
14025
  replaceNewlines(tr, node2, pos, mapFrom);
14026
14026
  return false;
@@ -14061,7 +14061,7 @@ function setNodeMarkup(tr, pos, type2, attrs, marks) {
14061
14061
  return tr.replaceWith(pos, pos + node2.nodeSize, newNode);
14062
14062
  if (!type2.validContent(node2.content))
14063
14063
  throw new RangeError("Invalid content for node type " + type2.name);
14064
- tr.step(new ReplaceAroundStep(pos, pos + node2.nodeSize, pos + 1, pos + node2.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
14064
+ tr.step(new ReplaceAroundStep$1(pos, pos + node2.nodeSize, pos + 1, pos + node2.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));
14065
14065
  }
14066
14066
  function canSplit(doc2, pos, depth = 1, typesAfter) {
14067
14067
  let $pos = doc2.resolve(pos), base2 = $pos.depth - depth;
@@ -14262,7 +14262,7 @@ class Fitter {
14262
14262
  }
14263
14263
  let slice2 = new Slice(content, openStart, openEnd);
14264
14264
  if (moveInline > -1)
14265
- return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
14265
+ return new ReplaceAroundStep$1($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
14266
14266
  if (slice2.size || $from.pos != this.$to.pos)
14267
14267
  return new ReplaceStep($from.pos, $to.pos, slice2);
14268
14268
  return null;
@@ -15345,7 +15345,7 @@ function selectionToInsertionEnd$1(tr, startLen, bias) {
15345
15345
  if (last < startLen)
15346
15346
  return;
15347
15347
  let step = tr.steps[last];
15348
- if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
15348
+ if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1))
15349
15349
  return;
15350
15350
  let map3 = tr.mapping.maps[last], end2;
15351
15351
  map3.forEach((_from, _to, _newFrom, newTo) => {
@@ -23972,7 +23972,7 @@ const _SuperConverter = class _SuperConverter2 {
23972
23972
  return;
23973
23973
  }
23974
23974
  }
23975
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-rev7") {
23975
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.2-rev9") {
23976
23976
  const customLocation = "docProps/custom.xml";
23977
23977
  if (!docx[customLocation]) {
23978
23978
  docx[customLocation] = generateCustomXml();
@@ -24439,7 +24439,7 @@ function storeSuperdocVersion(docx) {
24439
24439
  function generateCustomXml() {
24440
24440
  return DEFAULT_CUSTOM_XML;
24441
24441
  }
24442
- function generateSuperdocVersion(pid = 2, version2 = "0.13.2-rev7") {
24442
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.2-rev9") {
24443
24443
  return {
24444
24444
  type: "element",
24445
24445
  name: "property",
@@ -28522,7 +28522,7 @@ function deleteBarrier(state2, $cut, dispatch, dir) {
28522
28522
  for (let i = conn.length - 1; i >= 0; i--)
28523
28523
  wrap2 = Fragment.from(conn[i].create(null, wrap2));
28524
28524
  wrap2 = Fragment.from(before.copy(wrap2));
28525
- let tr = state2.tr.step(new ReplaceAroundStep($cut.pos - 1, end2, $cut.pos, end2, new Slice(wrap2, 1, 0), conn.length, true));
28525
+ let tr = state2.tr.step(new ReplaceAroundStep$1($cut.pos - 1, end2, $cut.pos, end2, new Slice(wrap2, 1, 0), conn.length, true));
28526
28526
  let $joinAt = tr.doc.resolve(end2 + 2 * conn.length);
28527
28527
  if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos))
28528
28528
  tr.join($joinAt.pos);
@@ -28553,7 +28553,7 @@ function deleteBarrier(state2, $cut, dispatch, dir) {
28553
28553
  let end2 = Fragment.empty;
28554
28554
  for (let i = wrap2.length - 1; i >= 0; i--)
28555
28555
  end2 = Fragment.from(wrap2[i].copy(end2));
28556
- let tr = state2.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end2, wrap2.length, 0), 0, true));
28556
+ let tr = state2.tr.step(new ReplaceAroundStep$1($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end2, wrap2.length, 0), 0, true));
28557
28557
  dispatch(tr.scrollIntoView());
28558
28558
  }
28559
28559
  return true;
@@ -29126,7 +29126,7 @@ function selectionToInsertionEnd(tr, startLen, bias) {
29126
29126
  return;
29127
29127
  }
29128
29128
  const step = tr.steps[last];
29129
- if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {
29129
+ if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
29130
29130
  return;
29131
29131
  }
29132
29132
  const map22 = tr.mapping.maps[last];
@@ -29272,7 +29272,7 @@ function doWrapInList(tr, range2, wrappers, joinBefore, listType) {
29272
29272
  let content = Fragment.empty;
29273
29273
  for (let i = wrappers.length - 1; i >= 0; i--)
29274
29274
  content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
29275
- tr.step(new ReplaceAroundStep(range2.start - (joinBefore ? 2 : 0), range2.end, range2.start, range2.end, new Slice(content, 0, 0), wrappers.length, true));
29275
+ tr.step(new ReplaceAroundStep$1(range2.start - (joinBefore ? 2 : 0), range2.end, range2.start, range2.end, new Slice(content, 0, 0), wrappers.length, true));
29276
29276
  let found2 = 0;
29277
29277
  for (let i = 0; i < wrappers.length; i++)
29278
29278
  if (wrappers[i].type == listType)
@@ -29305,7 +29305,7 @@ function liftListItem$1(itemType) {
29305
29305
  function liftToOuterList(state2, dispatch, itemType, range2) {
29306
29306
  let tr = state2.tr, end2 = range2.end, endOfList = range2.$to.end(range2.depth);
29307
29307
  if (end2 < endOfList) {
29308
- tr.step(new ReplaceAroundStep(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range2.parent.copy())), 1, 0), 1, true));
29308
+ tr.step(new ReplaceAroundStep$1(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range2.parent.copy())), 1, 0), 1, true));
29309
29309
  range2 = new NodeRange(tr.doc.resolve(range2.$from.pos), tr.doc.resolve(endOfList), range2.depth);
29310
29310
  }
29311
29311
  const target = liftTarget(range2);
@@ -29332,7 +29332,7 @@ function liftOutOfList(state2, dispatch, range2) {
29332
29332
  if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
29333
29333
  return false;
29334
29334
  let start2 = $start.pos, end2 = start2 + item.nodeSize;
29335
- tr.step(new ReplaceAroundStep(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
29335
+ tr.step(new ReplaceAroundStep$1(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
29336
29336
  dispatch(tr.scrollIntoView());
29337
29337
  return true;
29338
29338
  }
@@ -29353,7 +29353,7 @@ function sinkListItem$1(itemType) {
29353
29353
  let inner = Fragment.from(nestedBefore ? itemType.create() : null);
29354
29354
  let slice2 = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
29355
29355
  let before = range2.start, after = range2.end;
29356
- dispatch(state2.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
29356
+ dispatch(state2.tr.step(new ReplaceAroundStep$1(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
29357
29357
  }
29358
29358
  return true;
29359
29359
  };
@@ -36946,7 +36946,8 @@ const restoreRelativeSelection = (tr, relSel, binding) => {
36946
36946
  binding.mapping
36947
36947
  );
36948
36948
  if (anchor !== null && head !== null) {
36949
- tr.setSelection(TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head)));
36949
+ const sel = TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head));
36950
+ tr.setSelection(sel);
36950
36951
  }
36951
36952
  }
36952
36953
  }
@@ -37727,7 +37728,7 @@ const setMeta = (view, key, value) => {
37727
37728
  };
37728
37729
  const absolutePositionToRelativePosition = (pos, type2, mapping) => {
37729
37730
  if (pos === 0) {
37730
- return Y.createRelativePositionFromTypeIndex(type2, 0, -1);
37731
+ return Y.createRelativePositionFromTypeIndex(type2, 0, type2.length === 0 ? -1 : 0);
37731
37732
  }
37732
37733
  let n = type2._first === null ? null : (
37733
37734
  /** @type {Y.ContentType} */
@@ -37736,7 +37737,7 @@ const absolutePositionToRelativePosition = (pos, type2, mapping) => {
37736
37737
  while (n !== null && type2 !== n) {
37737
37738
  if (n instanceof Y.XmlText) {
37738
37739
  if (n._length >= pos) {
37739
- return Y.createRelativePositionFromTypeIndex(n, pos, -1);
37740
+ return Y.createRelativePositionFromTypeIndex(n, pos, type2.length === 0 ? -1 : 0);
37740
37741
  } else {
37741
37742
  pos -= n._length;
37742
37743
  }
@@ -37800,7 +37801,7 @@ const absolutePositionToRelativePosition = (pos, type2, mapping) => {
37800
37801
  return createRelativePosition(n._item.parent, n._item);
37801
37802
  }
37802
37803
  }
37803
- return Y.createRelativePositionFromTypeIndex(type2, type2._length, -1);
37804
+ return Y.createRelativePositionFromTypeIndex(type2, type2._length, type2.length === 0 ? -1 : 0);
37804
37805
  };
37805
37806
  const createRelativePosition = (type2, item) => {
37806
37807
  let typeid = null;
@@ -40360,6 +40361,19 @@ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
40360
40361
  );
40361
40362
  });
40362
40363
  };
40364
+ const resetHeaderFooterFieldAnnotations = ({ editor }) => {
40365
+ if (!editor) return;
40366
+ const sectionEditors = getAllHeaderFooterEditors(editor);
40367
+ sectionEditors.forEach(({ editor: sectionEditor, sectionId, type: type2 }) => {
40368
+ sectionEditor.commands.resetFieldAnnotations();
40369
+ onHeaderFooterDataUpdate(
40370
+ { editor: sectionEditor },
40371
+ editor,
40372
+ sectionId,
40373
+ type2
40374
+ );
40375
+ });
40376
+ };
40363
40377
  const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
40364
40378
  if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
40365
40379
  const { doc: doc2 } = editor.state;
@@ -40430,6 +40444,7 @@ const AnnotatorHelpers = {
40430
40444
  getAllHeaderFooterEditors,
40431
40445
  updateHeaderFooterFieldAnnotations,
40432
40446
  deleteHeaderFooterFieldAnnotations,
40447
+ resetHeaderFooterFieldAnnotations,
40433
40448
  cleanUpListsWithAnnotations
40434
40449
  };
40435
40450
  const CollaborationPluginKey = new PluginKey("collaboration");
@@ -41291,15 +41306,18 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41291
41306
  this.removeAllListeners();
41292
41307
  }
41293
41308
  destroyHeaderFooterEditors() {
41294
- const editors = [
41295
- ...this.converter.headerEditors,
41296
- ...this.converter.footerEditors
41297
- ];
41298
- for (let editorData of editors) {
41299
- editorData.editor.destroy();
41309
+ try {
41310
+ const editors = [
41311
+ ...this.converter.headerEditors,
41312
+ ...this.converter.footerEditors
41313
+ ];
41314
+ for (let editorData of editors) {
41315
+ editorData.editor.destroy();
41316
+ }
41317
+ this.converter.headerEditors.length = 0;
41318
+ this.converter.footerEditors.length = 0;
41319
+ } catch (error) {
41300
41320
  }
41301
- this.converter.headerEditors.length = 0;
41302
- this.converter.footerEditors.length = 0;
41303
41321
  }
41304
41322
  /**
41305
41323
  * Check if migrations are needed for the data
@@ -41318,7 +41336,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41318
41336
  * @returns {Object | void} Migration results
41319
41337
  */
41320
41338
  processCollaborationMigrations() {
41321
- console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev7");
41339
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.2-rev9");
41322
41340
  if (!this.options.ydoc) return;
41323
41341
  const metaMap = this.options.ydoc.getMap("meta");
41324
41342
  let docVersion = metaMap.get("version");
@@ -44159,7 +44177,7 @@ const Paragraph = Node$1.create({
44159
44177
  },
44160
44178
  addPmPlugins() {
44161
44179
  const { view } = this.editor;
44162
- const dropcapPlugin = new Plugin({
44180
+ new Plugin({
44163
44181
  name: "dropcapPlugin",
44164
44182
  key: new PluginKey("dropcapPlugin"),
44165
44183
  state: {
@@ -44179,7 +44197,7 @@ const Paragraph = Node$1.create({
44179
44197
  }
44180
44198
  }
44181
44199
  });
44182
- return [dropcapPlugin];
44200
+ return [];
44183
44201
  }
44184
44202
  });
44185
44203
  const getDropcapDecorations = (state2, view) => {
@@ -47538,6 +47556,8 @@ function findRemovedFieldAnnotations(tr) {
47538
47556
  if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => ["inputType", "uiEvent", "paste"].includes(meta)) || ["historyUndo", "historyRedo"].includes(tr.getMeta("inputType")) || ["drop"].includes(tr.getMeta("uiEvent")) || tr.getMeta("fieldAnnotationUpdate") === true) {
47539
47557
  return removedNodes;
47540
47558
  }
47559
+ const hasDeletion = transactionDeletedAnything(tr);
47560
+ if (!hasDeletion) return removedNodes;
47541
47561
  tr.steps.forEach((step, stepIndex) => {
47542
47562
  if (step instanceof ReplaceStep && step.from !== step.to) {
47543
47563
  let mapping = tr.mapping.maps[stepIndex];
@@ -47554,6 +47574,14 @@ function findRemovedFieldAnnotations(tr) {
47554
47574
  });
47555
47575
  return removedNodes;
47556
47576
  }
47577
+ function transactionDeletedAnything(tr) {
47578
+ return tr.steps.some((step) => {
47579
+ if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep) {
47580
+ return step.from !== step.to;
47581
+ }
47582
+ return false;
47583
+ });
47584
+ }
47557
47585
  function trackFieldAnnotationsDeletion(editor, tr) {
47558
47586
  let removedAnnotations = [];
47559
47587
  try {
@@ -47949,8 +47977,18 @@ const FieldAnnotation = Node$1.create({
47949
47977
  };
47950
47978
  }
47951
47979
  },
47980
+ defaultDisplayLabel: {
47981
+ default: "",
47982
+ parseDOM: (elem) => elem.getAttribute("data-default-display-label"),
47983
+ renderDOM: (attrs) => {
47984
+ if (!attrs.defaultDisplayLabel) return {};
47985
+ return {
47986
+ "data-default-display-label": attrs.defaultDisplayLabel
47987
+ };
47988
+ }
47989
+ },
47952
47990
  displayLabel: {
47953
- default: "Text field",
47991
+ default: "",
47954
47992
  parseDOM: (elem) => elem.getAttribute("data-display-label"),
47955
47993
  renderDOM: (attrs) => {
47956
47994
  if (!attrs.displayLabel) return {};
@@ -48266,6 +48304,7 @@ const FieldAnnotation = Node$1.create({
48266
48304
  return renderer();
48267
48305
  },
48268
48306
  addCommands() {
48307
+ const annotationTypes = this.options.types;
48269
48308
  return {
48270
48309
  /**
48271
48310
  * Add field annotation.
@@ -48287,7 +48326,12 @@ const FieldAnnotation = Node$1.create({
48287
48326
  let currentMarks = $pos.marks();
48288
48327
  currentMarks = currentMarks.length ? [...currentMarks] : null;
48289
48328
  let formatAttrs = getFormatAttrsFromMarks(currentMarks);
48290
- let node2 = schema.nodes[this.name].create({ ...attrs, ...formatAttrs }, null, null);
48329
+ let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
48330
+ let node2 = schema.nodes[this.name].create({
48331
+ ...attrs,
48332
+ ...formatAttrs,
48333
+ defaultDisplayLabel
48334
+ }, null, null);
48291
48335
  state2.tr.insert(newPos, node2).setSelection(Selection.near(tr.doc.resolve(newPos + node2.nodeSize)));
48292
48336
  if (editorFocus) {
48293
48337
  this.editor.view.focus();
@@ -48295,9 +48339,9 @@ const FieldAnnotation = Node$1.create({
48295
48339
  }
48296
48340
  return true;
48297
48341
  },
48298
- addFieldAnnotationAtSelection: (attrs = {}, editorFocus = false) => ({ editor, dispatch, state: state2, tr, commands: commands2 }) => {
48342
+ addFieldAnnotationAtSelection: (attrs = {}, editorFocus = false) => ({ state: state2, commands: commands2 }) => {
48299
48343
  const { from: from2 } = state2.selection;
48300
- commands2.addFieldAnnotation(from2, attrs, editorFocus);
48344
+ return commands2.addFieldAnnotation(from2, attrs, editorFocus);
48301
48345
  },
48302
48346
  /**
48303
48347
  * Replace field annotation.
@@ -48307,24 +48351,113 @@ const FieldAnnotation = Node$1.create({
48307
48351
  * from: 20,
48308
48352
  * to: 45,
48309
48353
  * attrs: {
48310
- * fieldType: 'TEXTINPUT'
48311
- * fieldColor: '#980043'
48354
+ * fieldType: 'TEXTINPUT'
48355
+ * fieldColor: '#980043'
48312
48356
  * }
48313
48357
  * ])
48314
48358
  */
48315
- replaceWithFieldAnnotation: (fieldsArray) => ({ editor, dispatch, state: state2, tr }) => {
48359
+ replaceWithFieldAnnotation: (fieldsArray) => ({ editor, dispatch, tr }) => {
48316
48360
  if (!dispatch) return true;
48317
- tr.setMeta("fieldAnnotationReplace", true);
48318
48361
  fieldsArray.forEach((annotation) => {
48319
48362
  let { from: from2, to, attrs } = annotation;
48320
48363
  let { schema } = editor;
48321
48364
  let newPosFrom = tr.mapping.map(from2);
48322
48365
  let newPosTo = tr.mapping.map(to);
48323
- let node2 = schema.nodes[this.name].create({ ...attrs }, null, null);
48366
+ let defaultDisplayLabel = attrs.defaultDisplayLabel ? attrs.defaultDisplayLabel : attrs.displayLabel || "";
48367
+ let node2 = schema.nodes[this.name].create({
48368
+ ...attrs,
48369
+ defaultDisplayLabel
48370
+ }, null, null);
48324
48371
  tr.replaceWith(newPosFrom, newPosTo, node2);
48325
48372
  });
48326
48373
  return true;
48327
48374
  },
48375
+ /**
48376
+ * Replace annotations with a label (as text node) in selection.
48377
+ * @param options Additional options.
48378
+ * @example
48379
+ * editor.commands.replaceFieldAnnotationsWithLabelInSelection()
48380
+ */
48381
+ replaceFieldAnnotationsWithLabelInSelection: (options2 = {}) => ({ commands: commands2 }) => {
48382
+ return commands2.replaceFieldAnnotationsWithLabel(null, {
48383
+ ...options2,
48384
+ isInSelection: true
48385
+ });
48386
+ },
48387
+ /**
48388
+ * Replace annotations with a label (as text node).
48389
+ * @param fieldIdOrArray The field ID or array of field IDs.
48390
+ * @param options.isInSelection Find in selection instead of field IDs.
48391
+ * @param options.addToHistory Add to history or not.
48392
+ * @param options.types Annotation types to replace.
48393
+ * @example
48394
+ * editor.commands.replaceFieldAnnotationsWithLabel(['1', '2'])
48395
+ */
48396
+ replaceFieldAnnotationsWithLabel: (fieldIdOrArray, {
48397
+ isInSelection = false,
48398
+ addToHistory = false,
48399
+ types: types2 = annotationTypes
48400
+ } = {}) => ({ dispatch, state: state2, tr }) => {
48401
+ let { from: from2, to } = state2.selection;
48402
+ let annotations = isInSelection ? findFieldAnnotationsBetween(from2, to, state2.doc) : findFieldAnnotationsByFieldId(fieldIdOrArray, state2);
48403
+ annotations = types2.length ? annotations.filter(({ node: node2 }) => types2.includes(node2.attrs.type)) : annotations;
48404
+ if (!annotations.length) {
48405
+ return true;
48406
+ }
48407
+ if (!addToHistory) {
48408
+ tr.setMeta("addToHistory", false);
48409
+ }
48410
+ if (dispatch) {
48411
+ annotations.forEach((annotation) => {
48412
+ let { pos, node: node2 } = annotation;
48413
+ let newPosFrom = tr.mapping.map(pos);
48414
+ let newPosTo = tr.mapping.map(pos + node2.nodeSize);
48415
+ let currentNode = tr.doc.nodeAt(newPosFrom);
48416
+ let nodeEqual = node2.attrs.fieldId === currentNode?.attrs?.fieldId;
48417
+ let $newPosFrom = tr.doc.resolve(newPosFrom);
48418
+ let currentMarks = $newPosFrom.marks();
48419
+ currentMarks = currentMarks.length ? [...currentMarks] : null;
48420
+ if (nodeEqual) {
48421
+ let label = node2.attrs.displayLabel || " ";
48422
+ let textNode = state2.schema.text(label, currentMarks);
48423
+ tr.replaceWith(newPosFrom, newPosTo, textNode);
48424
+ }
48425
+ });
48426
+ }
48427
+ return true;
48428
+ },
48429
+ /**
48430
+ * Resets all annotations to default values.
48431
+ * @example
48432
+ * editor.commands.resetFieldAnnotations()
48433
+ */
48434
+ resetFieldAnnotations: () => ({ dispatch, state: state2, tr }) => {
48435
+ let annotations = getAllFieldAnnotations(state2);
48436
+ if (!annotations.length) {
48437
+ return true;
48438
+ }
48439
+ tr.setMeta("fieldAnnotationUpdate", true);
48440
+ if (dispatch) {
48441
+ annotations.forEach(({ pos, node: node2 }) => {
48442
+ let newPos = tr.mapping.map(pos);
48443
+ let currentNode = tr.doc.nodeAt(newPos);
48444
+ let nodeEqual = node2.attrs.fieldId === currentNode?.attrs?.fieldId;
48445
+ if (nodeEqual) {
48446
+ let displayLabel = node2.attrs.defaultDisplayLabel || node2.attrs.displayLabel || "";
48447
+ tr.setNodeMarkup(newPos, void 0, {
48448
+ ...node2.attrs,
48449
+ // reset displayLabel to default.
48450
+ displayLabel,
48451
+ // reset attrs ​​for specific types.
48452
+ imageSrc: null,
48453
+ rawHtml: null,
48454
+ linkUrl: null
48455
+ });
48456
+ }
48457
+ });
48458
+ }
48459
+ return true;
48460
+ },
48328
48461
  /**
48329
48462
  * Update annotations associated with a field.
48330
48463
  * @param fieldIdOrArray The field ID or array of field IDs.
@@ -55334,7 +55467,7 @@ const Search = Extension.create({
55334
55467
  }
55335
55468
  });
55336
55469
  const NodeResizerKey = new PluginKey("node-resizer");
55337
- const nodeResizer = (nodeNames = ["image"]) => {
55470
+ const nodeResizer = (nodeNames = ["image"], editor) => {
55338
55471
  let resizeState = {
55339
55472
  dragging: false,
55340
55473
  startX: 0,
@@ -55359,8 +55492,13 @@ const nodeResizer = (nodeNames = ["image"]) => {
55359
55492
  if (tr.getMeta(NodeResizerKey)) {
55360
55493
  return oldState;
55361
55494
  }
55362
- const decorations = [];
55495
+ if (typeof document === "undefined" || editor.options.isHeadless) return oldState;
55363
55496
  const { selection } = newState;
55497
+ const node2 = selection.node;
55498
+ if (!node2 || !nodeNames.includes(node2.type.name)) {
55499
+ return DecorationSet.empty;
55500
+ }
55501
+ const decorations = [];
55364
55502
  if (nodeNames.includes(selection.node?.type.name)) {
55365
55503
  decorations.push(
55366
55504
  Decoration.node(selection.from, selection.to, {
@@ -55563,7 +55701,7 @@ const nodeResizer = (nodeNames = ["image"]) => {
55563
55701
  const NodeResizer = Extension.create({
55564
55702
  name: "nodeResizer",
55565
55703
  addPmPlugins() {
55566
- return [nodeResizer(["image"])];
55704
+ return [nodeResizer(["image"], this.editor)];
55567
55705
  }
55568
55706
  });
55569
55707
  const getRichTextExtensions = () => {
@@ -64239,7 +64377,6 @@ const style$2 = cB("icon", `
64239
64377
  display: inline-block;
64240
64378
  position: relative;
64241
64379
  fill: currentColor;
64242
- transform: translateZ(0);
64243
64380
  `, [cM("color-transition", {
64244
64381
  transition: "color .3s var(--n-bezier)"
64245
64382
  }), cM("depth", {