@harbour-enterprises/superdoc 0.13.0-next.2 → 0.13.0-next.4

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 (28) hide show
  1. package/dist/chunks/{super-editor.es-DL2IwegA.es.js → super-editor.es-BLihY9I3.es.js} +62 -20
  2. package/dist/chunks/{super-editor.es-BB_X_LWr.cjs → super-editor.es-C8bnXrNN.cjs} +62 -20
  3. package/dist/stores/comments-store.d.ts.map +1 -1
  4. package/dist/super-editor/ai-writer.es.js +2 -2
  5. package/dist/super-editor/chunks/{converter-DW8-tb6t.js → converter-IP9PazoB.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-D4HYgwV0.js → docx-zipper-CesiGAcg.js} +1 -1
  7. package/dist/super-editor/chunks/{editor-C_lmahhU.js → editor-2jdmUJVn.js} +62 -20
  8. package/dist/super-editor/chunks/{toolbar-DeqcMi3l.js → toolbar-BwVRLL78.js} +2 -2
  9. package/dist/super-editor/converter.es.js +1 -1
  10. package/dist/super-editor/docx-zipper.es.js +2 -2
  11. package/dist/super-editor/editor.es.js +3 -3
  12. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findHeaderFooterAnnotationsByFieldId.d.ts +8 -0
  13. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/findHeaderFooterAnnotationsByFieldId.d.ts.map +1 -0
  14. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/index.d.ts +1 -0
  15. package/dist/super-editor/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
  16. package/dist/super-editor/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -1
  17. package/dist/super-editor/extensions/paragraph/paragraph.d.ts.map +1 -1
  18. package/dist/super-editor/extensions/tab/tab.d.ts.map +1 -1
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +23 -7
  25. package/dist/superdoc.es.js +24 -8
  26. package/dist/superdoc.umd.js +84 -26
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-DW8-tb6t.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, T as TextSelection, b as canSplit, l as liftTarget, A as AllSelection, d as canJoin, j as joinPoint, N as NodeSelection, r as replaceStep$1, e as Selection, F as Fragment, R as ReplaceAroundStep, f as Slice, o as objectIncludes, g as deleteProps, D as DOMParser$1, h as ReplaceStep, k as NodeRange, m as findWrapping, n as isMacOS, p as isIOS, q as generateDocxRandomId, s as minMax, t as generateRandom32BitHex, u as DOMSerializer, v as Mark$1, w as dropPoint, x as process$1, B as Buffer2, y as isRegExp, z as TrackDeleteMarkName, C as TrackInsertMarkName, E as v4, G as TrackFormatMarkName, H as comments_module_events, I as AddMarkStep, J as RemoveMarkStep, K as twipsToLines, L as pixelsToTwips, O as SuperConverter, Q as EditorState, U as hasSomeParentWithClass, V as parseSizeUnit, W as getLineHeightValueString, X as toKebabCase, Y as kebabCase, Z as getColStyleDeclaration, _ as SelectionRange, $ as Transform, a0 as createColGroup } from "./converter-IP9PazoB.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-D4HYgwV0.js";
17
+ import { D as DocxZipper } from "./docx-zipper-CesiGAcg.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -4173,7 +4173,7 @@ function isActive(state, name, attrs = {}) {
4173
4173
  }
4174
4174
  return false;
4175
4175
  }
4176
- function findChildren$3(node, predicate) {
4176
+ function findChildren$4(node, predicate) {
4177
4177
  const nodesWithPos = [];
4178
4178
  node.descendants((child, pos) => {
4179
4179
  if (predicate(child)) {
@@ -4230,7 +4230,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
4230
4230
  cleanSchemaItem,
4231
4231
  createDocument,
4232
4232
  defaultBlockAt,
4233
- findChildren: findChildren$3,
4233
+ findChildren: findChildren$4,
4234
4234
  findMark,
4235
4235
  findParentNode,
4236
4236
  findParentNodeClosestToPos,
@@ -12366,7 +12366,7 @@ const flatten = (node, descend = true) => {
12366
12366
  });
12367
12367
  return result;
12368
12368
  };
12369
- const findChildren$2 = (node, predicate, descend) => {
12369
+ const findChildren$3 = (node, predicate, descend) => {
12370
12370
  if (!node) {
12371
12371
  throw new Error('Invalid "node" parameter');
12372
12372
  } else if (!predicate) {
@@ -12375,11 +12375,11 @@ const findChildren$2 = (node, predicate, descend) => {
12375
12375
  return flatten(node, descend).filter((child) => predicate(child.node));
12376
12376
  };
12377
12377
  const findInlineNodes = (node, descend) => {
12378
- return findChildren$2(node, (child) => child.isInline, descend);
12378
+ return findChildren$3(node, (child) => child.isInline, descend);
12379
12379
  };
12380
12380
  const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12381
12381
  __proto__: null,
12382
- findChildren: findChildren$2,
12382
+ findChildren: findChildren$3,
12383
12383
  findInlineNodes,
12384
12384
  findMarkPosition,
12385
12385
  flatten
@@ -13012,7 +13012,7 @@ const CommentsPlugin = Extension.create({
13012
13012
  if (isPaginationInit) shouldUpdate = true;
13013
13013
  const meta = tr.getMeta(CommentsPluginKey);
13014
13014
  const { type } = meta || {};
13015
- if (type === "force") shouldUpdate = true;
13015
+ if (type === "force" || type === "forceTrackChanges") shouldUpdate = true;
13016
13016
  if (!isPaginationInit && !shouldUpdate && meta && meta.decorations) {
13017
13017
  return {
13018
13018
  ...pluginState,
@@ -14895,7 +14895,7 @@ const _Editor = class _Editor extends EventEmitter {
14895
14895
  * @returns {Object | void} Migration results
14896
14896
  */
14897
14897
  processCollaborationMigrations() {
14898
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.2");
14898
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
14899
14899
  if (!this.options.ydoc) return;
14900
14900
  const metaMap = this.options.ydoc.getMap("meta");
14901
14901
  let docVersion = metaMap.get("version");
@@ -16728,6 +16728,9 @@ function orderedListSync(options = {}) {
16728
16728
  let { doc: doc2, tr } = newState;
16729
16729
  let listsBySyncId = {};
16730
16730
  doc2.descendants((node, pos) => {
16731
+ if (node.type.name === "paragraph") {
16732
+ return false;
16733
+ }
16731
16734
  if (node.type.name === "orderedList" && !!node.attrs.syncId) {
16732
16735
  let syncId = node.attrs.syncId;
16733
16736
  if (!listsBySyncId[syncId]) listsBySyncId[syncId] = [];
@@ -16857,6 +16860,9 @@ function getOrderedListItemsByList(state) {
16857
16860
  let { doc: doc2 } = state;
16858
16861
  let map2 = /* @__PURE__ */ new Map();
16859
16862
  doc2.descendants((node, pos) => {
16863
+ if (node.type.name === "paragraph") {
16864
+ return false;
16865
+ }
16860
16866
  let { attrs } = node;
16861
16867
  let isListItem = node.type.name === "listItem";
16862
16868
  let hasListLevel = !!attrs.listLevel?.length;
@@ -16877,6 +16883,9 @@ function getAllChildListItemsOfList({ state, list }) {
16877
16883
  let { doc: doc2 } = state;
16878
16884
  let allItems = [];
16879
16885
  doc2.descendants((node, pos) => {
16886
+ if (node.type.name === "paragraph") {
16887
+ return false;
16888
+ }
16880
16889
  let isListItem = node.type.name === "listItem";
16881
16890
  let $pos = doc2.resolve(pos);
16882
16891
  if (isListItem && $pos.parent === list) {
@@ -17252,7 +17261,15 @@ function getListMarkerDecorations(state, marks = []) {
17252
17261
  let { doc: doc2, storedMarks } = state;
17253
17262
  let decorations = [];
17254
17263
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
17255
- let listItems = findChildren$3(doc2, (node) => node.type.name === "listItem");
17264
+ let listItems = [];
17265
+ doc2.descendants((node, pos) => {
17266
+ if (node.type.name === "paragraph") {
17267
+ return false;
17268
+ }
17269
+ if (node.type.name === "listItem") {
17270
+ listItems.push({ node, pos });
17271
+ }
17272
+ });
17256
17273
  if (!listItems.length) {
17257
17274
  return decorations;
17258
17275
  }
@@ -17297,7 +17314,7 @@ function getListMarkerDecorations(state, marks = []) {
17297
17314
  function getListItemStylingFromParagraphProps(state) {
17298
17315
  let { doc: doc2 } = state;
17299
17316
  let decorations = [];
17300
- let listItems = findChildren$3(doc2, (node) => node.type.name === "listItem");
17317
+ let listItems = findChildren$4(doc2, (node) => node.type.name === "listItem");
17301
17318
  if (!listItems.length) {
17302
17319
  return decorations;
17303
17320
  }
@@ -17829,6 +17846,7 @@ const Paragraph = Node$1.create({
17829
17846
  return DecorationSet.create(state.doc, decorations);
17830
17847
  },
17831
17848
  apply(tr, oldDecorationSet, oldState, newState) {
17849
+ if (!tr.docChanged) return oldDecorationSet;
17832
17850
  const decorations = getDropcapDecorations(newState, view);
17833
17851
  return DecorationSet.create(newState.doc, decorations);
17834
17852
  }
@@ -17845,11 +17863,14 @@ const Paragraph = Node$1.create({
17845
17863
  const getDropcapDecorations = (state, view) => {
17846
17864
  let decorations = [];
17847
17865
  state.doc.descendants((node, pos) => {
17848
- if (node.attrs.dropcap?.type === "margin") {
17849
- const width = getDropcapWidth(view, pos);
17850
- decorations.push(
17851
- Decoration.inline(pos, pos + node.nodeSize, { style: `margin-left: -${width}px;` })
17852
- );
17866
+ if (node.type.name === "paragraph") {
17867
+ if (node.attrs.dropcap?.type === "margin") {
17868
+ const width = getDropcapWidth(view, pos);
17869
+ decorations.push(
17870
+ Decoration.inline(pos, pos + node.nodeSize, { style: `margin-left: -${width}px;` })
17871
+ );
17872
+ }
17873
+ return false;
17853
17874
  }
17854
17875
  });
17855
17876
  return decorations;
@@ -18085,6 +18106,7 @@ const TabNode = Node$1.create({
18085
18106
  return DecorationSet.create(state.doc, decorations);
18086
18107
  },
18087
18108
  apply(tr, oldDecorationSet, oldState, newState) {
18109
+ if (!tr.docChanged) return oldDecorationSet;
18088
18110
  const decorations = getTabDecorations(newState, view);
18089
18111
  return DecorationSet.create(newState.doc, decorations);
18090
18112
  }
@@ -21216,9 +21238,9 @@ function trackFieldAnnotationsDeletion(editor, tr) {
21216
21238
  }, 0);
21217
21239
  }
21218
21240
  }
21219
- const { findChildren: findChildren$1 } = helpers;
21241
+ const { findChildren: findChildren$2 } = helpers;
21220
21242
  function getAllFieldAnnotations(state) {
21221
- let fieldAnnotations = findChildren$1(state.doc, (node) => node.type.name === "fieldAnnotation");
21243
+ let fieldAnnotations = findChildren$2(state.doc, (node) => node.type.name === "fieldAnnotation");
21222
21244
  return fieldAnnotations;
21223
21245
  }
21224
21246
  const FieldAnnotationPlugin = (options = {}) => {
@@ -21360,9 +21382,9 @@ function findFieldAnnotations(predicate, state) {
21360
21382
  });
21361
21383
  return fieldAnnotations;
21362
21384
  }
21363
- const { findChildren } = helpers;
21385
+ const { findChildren: findChildren$1 } = helpers;
21364
21386
  function findFieldAnnotationsByFieldId(fieldIdOrArray, state) {
21365
- let fieldAnnotations = findChildren(state.doc, (node) => {
21387
+ let fieldAnnotations = findChildren$1(state.doc, (node) => {
21366
21388
  let isFieldAnnotation = node.type.name === "fieldAnnotation";
21367
21389
  if (Array.isArray(fieldIdOrArray)) {
21368
21390
  return isFieldAnnotation && fieldIdOrArray.includes(node.attrs.fieldId);
@@ -21410,12 +21432,31 @@ const getHeaderFooterAnnotations = (editor) => {
21410
21432
  });
21411
21433
  return allAnnotations;
21412
21434
  };
21435
+ const { findChildren } = helpers;
21436
+ function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
21437
+ const sectionEditors = getAllHeaderFooterEditors(editor);
21438
+ const annotations = [];
21439
+ sectionEditors.forEach(({ editor: sectionEditor }) => {
21440
+ const state = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
21441
+ const fieldAnnotations = findChildren(state.doc, (node) => {
21442
+ let isFieldAnnotation = node.type.name === "fieldAnnotation";
21443
+ if (Array.isArray(fieldIdOrArray)) {
21444
+ return isFieldAnnotation && fieldIdOrArray.includes(node.attrs.fieldId);
21445
+ } else {
21446
+ return isFieldAnnotation && node.attrs.fieldId === fieldIdOrArray;
21447
+ }
21448
+ });
21449
+ annotations.push(...fieldAnnotations);
21450
+ });
21451
+ return annotations;
21452
+ }
21413
21453
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21414
21454
  __proto__: null,
21415
21455
  findFieldAnnotations,
21416
21456
  findFieldAnnotationsBetween,
21417
21457
  findFieldAnnotationsByFieldId,
21418
21458
  findFirstFieldAnnotationByFieldId,
21459
+ findHeaderFooterAnnotationsByFieldId,
21419
21460
  findRemovedFieldAnnotations,
21420
21461
  getAllFieldAnnotations,
21421
21462
  getAllFieldAnnotationsWithRect,
@@ -22401,6 +22442,7 @@ const ImagePositionPlugin = ({ editor }) => {
22401
22442
  return DecorationSet.empty;
22402
22443
  },
22403
22444
  apply(tr, oldDecorationSet, oldState, newState) {
22445
+ if (!tr.docChanged) return oldDecorationSet;
22404
22446
  const decorations = getImagePositionDecorations(newState, view);
22405
22447
  return DecorationSet.create(newState.doc, decorations);
22406
22448
  }
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, nextTick, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { x as process$1 } from "./converter-DW8-tb6t.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-C_lmahhU.js";
2
+ import { x as process$1 } from "./converter-IP9PazoB.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-2jdmUJVn.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { O } from "./chunks/converter-DW8-tb6t.js";
1
+ import { O } from "./chunks/converter-IP9PazoB.js";
2
2
  export {
3
3
  O as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DW8-tb6t.js";
2
- import { D } from "./chunks/docx-zipper-D4HYgwV0.js";
1
+ import "./chunks/converter-IP9PazoB.js";
2
+ import { D } from "./chunks/docx-zipper-CesiGAcg.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-C_lmahhU.js";
2
- import "./chunks/converter-DW8-tb6t.js";
3
- import "./chunks/docx-zipper-D4HYgwV0.js";
1
+ import { E } from "./chunks/editor-2jdmUJVn.js";
2
+ import "./chunks/converter-IP9PazoB.js";
3
+ import "./chunks/docx-zipper-CesiGAcg.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Find field annotations in headers and footers by field ID or array of field IDs.
3
+ * @param fieldIdOrArray The field ID or array of field IDs.
4
+ * @param editor The editor state.
5
+ * @returns The field annotations array.
6
+ */
7
+ export function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray: any, editor: any, activeSectionEditor: any): any[];
8
+ //# sourceMappingURL=findHeaderFooterAnnotationsByFieldId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findHeaderFooterAnnotationsByFieldId.d.ts","sourceRoot":"","sources":["../../../../src/extensions/field-annotation/fieldAnnotationHelpers/findHeaderFooterAnnotationsByFieldId.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wHAiBC"}
@@ -7,4 +7,5 @@ export * from "./findFieldAnnotationsBetween.js";
7
7
  export * from "./findRemovedFieldAnnotations.js";
8
8
  export * from "./trackFieldAnnotationsDeletion.js";
9
9
  export * from "./getHeaderFooterAnnotations.js";
10
+ export * from "./findHeaderFooterAnnotationsByFieldId.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;0BAyCN;8BA7CyC,kBAAkB;uBAD1B,mBAAmB"}
1
+ {"version":3,"file":"imagePositionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/image/imageHelpers/imagePositionPlugin.js"],"names":[],"mappings":"AAKO;;0BA0CN;8BA9CyC,kBAAkB;uBAD1B,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,2DAoEC;AAED,mCAEC;uBA7EiC,mBAAmB"}
1
+ {"version":3,"file":"orderedListSyncPlugin.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ordered-list/helpers/orderedListSyncPlugin.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,2DAyEC;AAED,mCAEC;uBAlFiC,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,4BAmJG"}
1
+ {"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../../../src/extensions/paragraph/paragraph.js"],"names":[],"mappings":"AAMA,4BAoJG"}
@@ -1 +1 @@
1
- {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,0BAiEG"}
1
+ {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/extensions/tab/tab.js"],"names":[],"mappings":"AAIA,0BAkEG"}
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-D4HYgwV0.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-CesiGAcg.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-DW8-tb6t.js";
13
- import { O } from "./chunks/converter-DW8-tb6t.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-C_lmahhU.js";
15
- import { o, C, T, m, q, p, l, n } from "./chunks/editor-C_lmahhU.js";
12
+ import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-IP9PazoB.js";
13
+ import { O } from "./chunks/converter-IP9PazoB.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, f as findParentNode, c as getFileOpener, s as startImageUpload, d as getActiveFormatting, i as isInTable, e as undoDepth, r as redoDepth, E as Editor, h as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-2jdmUJVn.js";
15
+ import { o, C, T, m, q, p, l, n } from "./chunks/editor-2jdmUJVn.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, getCurrentInstance, computed, watch, createCommentVNode, withDirectives, withKeys, vModelText, createTextVNode, toDisplayString, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-DeqcMi3l.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-BwVRLL78.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-D4HYgwV0.js";
19
+ import { D } from "./chunks/docx-zipper-CesiGAcg.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  (function(module) {
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DeqcMi3l.js";
3
- import "./chunks/editor-C_lmahhU.js";
2
+ import { T } from "./chunks/toolbar-BwVRLL78.js";
3
+ import "./chunks/editor-2jdmUJVn.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-BB_X_LWr.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C8bnXrNN.cjs");
4
4
  require("./chunks/vue-HIY1g7dm.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-DL2IwegA.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, T, f, g, i, h, j, k, l, m, n, o } from "./chunks/super-editor.es-BLihY9I3.es.js";
2
2
  import "./chunks/vue-Bi1uWinj.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-BB_X_LWr.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C8bnXrNN.cjs");
4
4
  const vue = require("./chunks/vue-HIY1g7dm.cjs");
5
5
  const jszip = require("./chunks/jszip-BTAcmbVg.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -4351,14 +4351,29 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4351
4351
  });
4352
4352
  addComment({ superdoc: superdoc2, comment: newComment });
4353
4353
  });
4354
- const trackedChanges = superEditor_es.index.getTrackChanges(editor.state);
4355
- trackedChanges.forEach(({ mark }) => {
4354
+ setTimeout(() => {
4355
+ createCommentForTrackChanges(editor);
4356
+ }, 0);
4357
+ };
4358
+ const createCommentForTrackChanges = (editor) => {
4359
+ let trackedChanges = superEditor_es.index.getTrackChanges(editor.state);
4360
+ let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
4361
+ if (isLargeDoc && trackedChanges.length) {
4362
+ trackedChanges = trackedChanges.slice(0, 100);
4363
+ }
4364
+ trackedChanges.forEach(({ mark }, index2) => {
4365
+ console.debug(`Create comment for track change: ${index2}`);
4366
+ const { dispatch } = editor.view;
4367
+ const { tr } = editor.view.state;
4356
4368
  const foundComment = commentsList.value.find((i) => i.commentId === mark.attrs.id);
4369
+ const isLastIteration = trackedChanges.length === index2 + 1;
4357
4370
  if (foundComment) {
4371
+ if (isLastIteration) {
4372
+ tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4373
+ dispatch(tr);
4374
+ }
4358
4375
  return;
4359
4376
  }
4360
- const { dispatch } = editor.view;
4361
- const { tr } = editor.view.state;
4362
4377
  const markMetaKeys = {
4363
4378
  trackInsert: "insertedMark",
4364
4379
  trackDelete: "deletionMark",
@@ -4366,7 +4381,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4366
4381
  };
4367
4382
  const markKeyName = markMetaKeys[mark.type.name];
4368
4383
  if (markKeyName) {
4369
- tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4384
+ if (isLastIteration) tr.setMeta(superEditor_es.CommentsPluginKey, { type: "force" });
4385
+ tr.setMeta(superEditor_es.CommentsPluginKey, { type: "forceTrackChanges" });
4370
4386
  tr.setMeta(superEditor_es.TrackChangesBasePluginKey, { [markKeyName]: mark });
4371
4387
  dispatch(tr);
4372
4388
  }
@@ -47790,7 +47806,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
47790
47806
  this.config.colors = shuffleArray(this.config.colors);
47791
47807
  this.userColorMap = /* @__PURE__ */ new Map();
47792
47808
  this.colorIndex = 0;
47793
- this.version = "0.13.0-next.2";
47809
+ this.version = "0.13.0-next.4";
47794
47810
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47795
47811
  this.superdocId = config.superdocId || uuid.v4();
47796
47812
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-DL2IwegA.es.js";
2
- import { a, S, i, n } from "./chunks/super-editor.es-DL2IwegA.es.js";
1
+ import { o as index$1, C as CommentsPluginKey, f as TrackChangesBasePluginKey, E as Editor, l as getRichTextExtensions, d as SuperInput, A as AIWriter, c as SuperEditor, e as SuperToolbar, g as createZip } from "./chunks/super-editor.es-BLihY9I3.es.js";
2
+ import { a, S, i, n } from "./chunks/super-editor.es-BLihY9I3.es.js";
3
3
  import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, D as toRef, i as inject, q as getCurrentInstance, l as watch, y as unref, a1 as hasInjectionContext, N as reactive, u as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, K as shallowRef, O as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, U as onActivated, s as onDeactivated, A as createTextVNode, F as Fragment, R as Comment, m as defineComponent, E as provide, I as withDirectives, C as h, V as Teleport, S as renderSlot, W as isVNode, J as watchEffect, P as Transition, G as mergeProps, Q as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, x as createVNode, z as withCtx, f as createBaseVNode, B as normalizeStyle, e as createCommentVNode, v as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, X as onUnmounted, a6 as resolveDynamicComponent } from "./chunks/vue-Bi1uWinj.es.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-DckFs3A7.es.js";
5
5
  import { B as BlankDOCX } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -4334,14 +4334,29 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4334
4334
  });
4335
4335
  addComment({ superdoc: superdoc2, comment: newComment });
4336
4336
  });
4337
- const trackedChanges = index$1.getTrackChanges(editor.state);
4338
- trackedChanges.forEach(({ mark }) => {
4337
+ setTimeout(() => {
4338
+ createCommentForTrackChanges(editor);
4339
+ }, 0);
4340
+ };
4341
+ const createCommentForTrackChanges = (editor) => {
4342
+ let trackedChanges = index$1.getTrackChanges(editor.state);
4343
+ let isLargeDoc = editor.state.doc.nodeSize >= 1e5;
4344
+ if (isLargeDoc && trackedChanges.length) {
4345
+ trackedChanges = trackedChanges.slice(0, 100);
4346
+ }
4347
+ trackedChanges.forEach(({ mark }, index2) => {
4348
+ console.debug(`Create comment for track change: ${index2}`);
4349
+ const { dispatch } = editor.view;
4350
+ const { tr } = editor.view.state;
4339
4351
  const foundComment = commentsList.value.find((i2) => i2.commentId === mark.attrs.id);
4352
+ const isLastIteration = trackedChanges.length === index2 + 1;
4340
4353
  if (foundComment) {
4354
+ if (isLastIteration) {
4355
+ tr.setMeta(CommentsPluginKey, { type: "force" });
4356
+ dispatch(tr);
4357
+ }
4341
4358
  return;
4342
4359
  }
4343
- const { dispatch } = editor.view;
4344
- const { tr } = editor.view.state;
4345
4360
  const markMetaKeys = {
4346
4361
  trackInsert: "insertedMark",
4347
4362
  trackDelete: "deletionMark",
@@ -4349,7 +4364,8 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4349
4364
  };
4350
4365
  const markKeyName = markMetaKeys[mark.type.name];
4351
4366
  if (markKeyName) {
4352
- tr.setMeta(CommentsPluginKey, { type: "force" });
4367
+ if (isLastIteration) tr.setMeta(CommentsPluginKey, { type: "force" });
4368
+ tr.setMeta(CommentsPluginKey, { type: "forceTrackChanges" });
4353
4369
  tr.setMeta(TrackChangesBasePluginKey, { [markKeyName]: mark });
4354
4370
  dispatch(tr);
4355
4371
  }
@@ -47773,7 +47789,7 @@ class SuperDoc extends EventEmitter {
47773
47789
  this.config.colors = shuffleArray(this.config.colors);
47774
47790
  this.userColorMap = /* @__PURE__ */ new Map();
47775
47791
  this.colorIndex = 0;
47776
- this.version = "0.13.0-next.2";
47792
+ this.version = "0.13.0-next.4";
47777
47793
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47778
47794
  this.superdocId = config.superdocId || v4();
47779
47795
  this.colors = this.config.colors;