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

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.
@@ -23410,7 +23410,7 @@ const _SuperConverter = class _SuperConverter2 {
23410
23410
  return;
23411
23411
  }
23412
23412
  }
23413
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.2") {
23413
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.3") {
23414
23414
  const customLocation = "docProps/custom.xml";
23415
23415
  if (!docx[customLocation]) {
23416
23416
  docx[customLocation] = generateCustomXml();
@@ -23877,7 +23877,7 @@ function storeSuperdocVersion(docx) {
23877
23877
  function generateCustomXml() {
23878
23878
  return DEFAULT_CUSTOM_XML;
23879
23879
  }
23880
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.2") {
23880
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.3") {
23881
23881
  return {
23882
23882
  type: "element",
23883
23883
  name: "property",
@@ -30569,7 +30569,7 @@ function isActive(state2, name, attrs = {}) {
30569
30569
  }
30570
30570
  return false;
30571
30571
  }
30572
- function findChildren$3(node2, predicate) {
30572
+ function findChildren$4(node2, predicate) {
30573
30573
  const nodesWithPos = [];
30574
30574
  node2.descendants((child, pos) => {
30575
30575
  if (predicate(child)) {
@@ -30626,7 +30626,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
30626
30626
  cleanSchemaItem,
30627
30627
  createDocument,
30628
30628
  defaultBlockAt,
30629
- findChildren: findChildren$3,
30629
+ findChildren: findChildren$4,
30630
30630
  findMark,
30631
30631
  findParentNode,
30632
30632
  findParentNodeClosestToPos,
@@ -38753,7 +38753,7 @@ const flatten$3 = (node2, descend = true) => {
38753
38753
  });
38754
38754
  return result;
38755
38755
  };
38756
- const findChildren$2 = (node2, predicate, descend) => {
38756
+ const findChildren$3 = (node2, predicate, descend) => {
38757
38757
  if (!node2) {
38758
38758
  throw new Error('Invalid "node" parameter');
38759
38759
  } else if (!predicate) {
@@ -38762,11 +38762,11 @@ const findChildren$2 = (node2, predicate, descend) => {
38762
38762
  return flatten$3(node2, descend).filter((child) => predicate(child.node));
38763
38763
  };
38764
38764
  const findInlineNodes = (node2, descend) => {
38765
- return findChildren$2(node2, (child) => child.isInline, descend);
38765
+ return findChildren$3(node2, (child) => child.isInline, descend);
38766
38766
  };
38767
38767
  const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
38768
38768
  __proto__: null,
38769
- findChildren: findChildren$2,
38769
+ findChildren: findChildren$3,
38770
38770
  findInlineNodes,
38771
38771
  findMarkPosition,
38772
38772
  flatten: flatten$3
@@ -41254,7 +41254,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41254
41254
  * @returns {Object | void} Migration results
41255
41255
  */
41256
41256
  processCollaborationMigrations() {
41257
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.2");
41257
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
41258
41258
  if (!this.options.ydoc) return;
41259
41259
  const metaMap = this.options.ydoc.getMap("meta");
41260
41260
  let docVersion = metaMap.get("version");
@@ -43477,7 +43477,7 @@ function getListMarkerDecorations(state2, marks = []) {
43477
43477
  let { doc: doc2, storedMarks } = state2;
43478
43478
  let decorations = [];
43479
43479
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
43480
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
43480
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43481
43481
  if (!listItems.length) {
43482
43482
  return decorations;
43483
43483
  }
@@ -43522,7 +43522,7 @@ function getListMarkerDecorations(state2, marks = []) {
43522
43522
  function getListItemStylingFromParagraphProps(state2) {
43523
43523
  let { doc: doc2 } = state2;
43524
43524
  let decorations = [];
43525
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
43525
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43526
43526
  if (!listItems.length) {
43527
43527
  return decorations;
43528
43528
  }
@@ -47441,9 +47441,9 @@ function trackFieldAnnotationsDeletion(editor, tr) {
47441
47441
  }, 0);
47442
47442
  }
47443
47443
  }
47444
- const { findChildren: findChildren$1 } = helpers;
47444
+ const { findChildren: findChildren$2 } = helpers;
47445
47445
  function getAllFieldAnnotations(state2) {
47446
- let fieldAnnotations = findChildren$1(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
47446
+ let fieldAnnotations = findChildren$2(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
47447
47447
  return fieldAnnotations;
47448
47448
  }
47449
47449
  const FieldAnnotationPlugin = (options2 = {}) => {
@@ -47585,9 +47585,9 @@ function findFieldAnnotations(predicate, state2) {
47585
47585
  });
47586
47586
  return fieldAnnotations;
47587
47587
  }
47588
- const { findChildren } = helpers;
47588
+ const { findChildren: findChildren$1 } = helpers;
47589
47589
  function findFieldAnnotationsByFieldId(fieldIdOrArray, state2) {
47590
- let fieldAnnotations = findChildren(state2.doc, (node2) => {
47590
+ let fieldAnnotations = findChildren$1(state2.doc, (node2) => {
47591
47591
  let isFieldAnnotation = node2.type.name === "fieldAnnotation";
47592
47592
  if (Array.isArray(fieldIdOrArray)) {
47593
47593
  return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
@@ -47635,12 +47635,31 @@ const getHeaderFooterAnnotations = (editor) => {
47635
47635
  });
47636
47636
  return allAnnotations;
47637
47637
  };
47638
+ const { findChildren } = helpers;
47639
+ function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
47640
+ const sectionEditors = getAllHeaderFooterEditors(editor);
47641
+ const annotations = [];
47642
+ sectionEditors.forEach(({ editor: sectionEditor }) => {
47643
+ const state2 = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
47644
+ const fieldAnnotations = findChildren(state2.doc, (node2) => {
47645
+ let isFieldAnnotation = node2.type.name === "fieldAnnotation";
47646
+ if (Array.isArray(fieldIdOrArray)) {
47647
+ return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
47648
+ } else {
47649
+ return isFieldAnnotation && node2.attrs.fieldId === fieldIdOrArray;
47650
+ }
47651
+ });
47652
+ annotations.push(...fieldAnnotations);
47653
+ });
47654
+ return annotations;
47655
+ }
47638
47656
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47639
47657
  __proto__: null,
47640
47658
  findFieldAnnotations,
47641
47659
  findFieldAnnotationsBetween,
47642
47660
  findFieldAnnotationsByFieldId,
47643
47661
  findFirstFieldAnnotationByFieldId,
47662
+ findHeaderFooterAnnotationsByFieldId,
47644
47663
  findRemovedFieldAnnotations,
47645
47664
  getAllFieldAnnotations,
47646
47665
  getAllFieldAnnotationsWithRect,
@@ -23393,7 +23393,7 @@ const _SuperConverter = class _SuperConverter2 {
23393
23393
  return;
23394
23394
  }
23395
23395
  }
23396
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.2") {
23396
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.3") {
23397
23397
  const customLocation = "docProps/custom.xml";
23398
23398
  if (!docx[customLocation]) {
23399
23399
  docx[customLocation] = generateCustomXml();
@@ -23860,7 +23860,7 @@ function storeSuperdocVersion(docx) {
23860
23860
  function generateCustomXml() {
23861
23861
  return DEFAULT_CUSTOM_XML;
23862
23862
  }
23863
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.2") {
23863
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.3") {
23864
23864
  return {
23865
23865
  type: "element",
23866
23866
  name: "property",
@@ -30552,7 +30552,7 @@ function isActive(state2, name, attrs = {}) {
30552
30552
  }
30553
30553
  return false;
30554
30554
  }
30555
- function findChildren$3(node2, predicate) {
30555
+ function findChildren$4(node2, predicate) {
30556
30556
  const nodesWithPos = [];
30557
30557
  node2.descendants((child, pos) => {
30558
30558
  if (predicate(child)) {
@@ -30609,7 +30609,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
30609
30609
  cleanSchemaItem,
30610
30610
  createDocument,
30611
30611
  defaultBlockAt,
30612
- findChildren: findChildren$3,
30612
+ findChildren: findChildren$4,
30613
30613
  findMark,
30614
30614
  findParentNode,
30615
30615
  findParentNodeClosestToPos,
@@ -38736,7 +38736,7 @@ const flatten$3 = (node2, descend = true) => {
38736
38736
  });
38737
38737
  return result;
38738
38738
  };
38739
- const findChildren$2 = (node2, predicate, descend) => {
38739
+ const findChildren$3 = (node2, predicate, descend) => {
38740
38740
  if (!node2) {
38741
38741
  throw new Error('Invalid "node" parameter');
38742
38742
  } else if (!predicate) {
@@ -38745,11 +38745,11 @@ const findChildren$2 = (node2, predicate, descend) => {
38745
38745
  return flatten$3(node2, descend).filter((child) => predicate(child.node));
38746
38746
  };
38747
38747
  const findInlineNodes = (node2, descend) => {
38748
- return findChildren$2(node2, (child) => child.isInline, descend);
38748
+ return findChildren$3(node2, (child) => child.isInline, descend);
38749
38749
  };
38750
38750
  const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
38751
38751
  __proto__: null,
38752
- findChildren: findChildren$2,
38752
+ findChildren: findChildren$3,
38753
38753
  findInlineNodes,
38754
38754
  findMarkPosition,
38755
38755
  flatten: flatten$3
@@ -41237,7 +41237,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
41237
41237
  * @returns {Object | void} Migration results
41238
41238
  */
41239
41239
  processCollaborationMigrations() {
41240
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.2");
41240
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
41241
41241
  if (!this.options.ydoc) return;
41242
41242
  const metaMap = this.options.ydoc.getMap("meta");
41243
41243
  let docVersion = metaMap.get("version");
@@ -43460,7 +43460,7 @@ function getListMarkerDecorations(state2, marks = []) {
43460
43460
  let { doc: doc2, storedMarks } = state2;
43461
43461
  let decorations = [];
43462
43462
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
43463
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
43463
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43464
43464
  if (!listItems.length) {
43465
43465
  return decorations;
43466
43466
  }
@@ -43505,7 +43505,7 @@ function getListMarkerDecorations(state2, marks = []) {
43505
43505
  function getListItemStylingFromParagraphProps(state2) {
43506
43506
  let { doc: doc2 } = state2;
43507
43507
  let decorations = [];
43508
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
43508
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
43509
43509
  if (!listItems.length) {
43510
43510
  return decorations;
43511
43511
  }
@@ -47424,9 +47424,9 @@ function trackFieldAnnotationsDeletion(editor, tr) {
47424
47424
  }, 0);
47425
47425
  }
47426
47426
  }
47427
- const { findChildren: findChildren$1 } = helpers;
47427
+ const { findChildren: findChildren$2 } = helpers;
47428
47428
  function getAllFieldAnnotations(state2) {
47429
- let fieldAnnotations = findChildren$1(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
47429
+ let fieldAnnotations = findChildren$2(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
47430
47430
  return fieldAnnotations;
47431
47431
  }
47432
47432
  const FieldAnnotationPlugin = (options2 = {}) => {
@@ -47568,9 +47568,9 @@ function findFieldAnnotations(predicate, state2) {
47568
47568
  });
47569
47569
  return fieldAnnotations;
47570
47570
  }
47571
- const { findChildren } = helpers;
47571
+ const { findChildren: findChildren$1 } = helpers;
47572
47572
  function findFieldAnnotationsByFieldId(fieldIdOrArray, state2) {
47573
- let fieldAnnotations = findChildren(state2.doc, (node2) => {
47573
+ let fieldAnnotations = findChildren$1(state2.doc, (node2) => {
47574
47574
  let isFieldAnnotation = node2.type.name === "fieldAnnotation";
47575
47575
  if (Array.isArray(fieldIdOrArray)) {
47576
47576
  return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
@@ -47618,12 +47618,31 @@ const getHeaderFooterAnnotations = (editor) => {
47618
47618
  });
47619
47619
  return allAnnotations;
47620
47620
  };
47621
+ const { findChildren } = helpers;
47622
+ function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
47623
+ const sectionEditors = getAllHeaderFooterEditors(editor);
47624
+ const annotations = [];
47625
+ sectionEditors.forEach(({ editor: sectionEditor }) => {
47626
+ const state2 = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
47627
+ const fieldAnnotations = findChildren(state2.doc, (node2) => {
47628
+ let isFieldAnnotation = node2.type.name === "fieldAnnotation";
47629
+ if (Array.isArray(fieldIdOrArray)) {
47630
+ return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
47631
+ } else {
47632
+ return isFieldAnnotation && node2.attrs.fieldId === fieldIdOrArray;
47633
+ }
47634
+ });
47635
+ annotations.push(...fieldAnnotations);
47636
+ });
47637
+ return annotations;
47638
+ }
47621
47639
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
47622
47640
  __proto__: null,
47623
47641
  findFieldAnnotations,
47624
47642
  findFieldAnnotationsBetween,
47625
47643
  findFieldAnnotationsByFieldId,
47626
47644
  findFirstFieldAnnotationByFieldId,
47645
+ findHeaderFooterAnnotationsByFieldId,
47627
47646
  findRemovedFieldAnnotations,
47628
47647
  getAllFieldAnnotations,
47629
47648
  getAllFieldAnnotationsWithRect,
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DW8-tb6t.js";
3
- import { _ as _export_sfc } from "./chunks/editor-C_lmahhU.js";
2
+ import { T as TextSelection } from "./chunks/converter-DifQiKXL.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-Cu6WivrX.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -23412,7 +23412,7 @@ const _SuperConverter = class _SuperConverter {
23412
23412
  return;
23413
23413
  }
23414
23414
  }
23415
- static updateDocumentVersion(docx = this.convertedXml, version = "0.13.0-next.2") {
23415
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.13.0-next.3") {
23416
23416
  const customLocation = "docProps/custom.xml";
23417
23417
  if (!docx[customLocation]) {
23418
23418
  docx[customLocation] = generateCustomXml();
@@ -23882,7 +23882,7 @@ function storeSuperdocVersion(docx) {
23882
23882
  function generateCustomXml() {
23883
23883
  return DEFAULT_CUSTOM_XML;
23884
23884
  }
23885
- function generateSuperdocVersion(pid = 2, version = "0.13.0-next.2") {
23885
+ function generateSuperdocVersion(pid = 2, version = "0.13.0-next.3") {
23886
23886
  return {
23887
23887
  type: "element",
23888
23888
  name: "property",
@@ -1,4 +1,4 @@
1
- import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-DW8-tb6t.js";
1
+ import { x as process$1, a1 as commonjsGlobal, B as Buffer, a2 as getDefaultExportFromCjs, a3 as getContentTypesFromXml, a4 as xmljs } from "./converter-DifQiKXL.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -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-DifQiKXL.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-0V4s80fa.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
@@ -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.3");
14899
14899
  if (!this.options.ydoc) return;
14900
14900
  const metaMap = this.options.ydoc.getMap("meta");
14901
14901
  let docVersion = metaMap.get("version");
@@ -17252,7 +17252,7 @@ function getListMarkerDecorations(state, marks = []) {
17252
17252
  let { doc: doc2, storedMarks } = state;
17253
17253
  let decorations = [];
17254
17254
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
17255
- let listItems = findChildren$3(doc2, (node) => node.type.name === "listItem");
17255
+ let listItems = findChildren$4(doc2, (node) => node.type.name === "listItem");
17256
17256
  if (!listItems.length) {
17257
17257
  return decorations;
17258
17258
  }
@@ -17297,7 +17297,7 @@ function getListMarkerDecorations(state, marks = []) {
17297
17297
  function getListItemStylingFromParagraphProps(state) {
17298
17298
  let { doc: doc2 } = state;
17299
17299
  let decorations = [];
17300
- let listItems = findChildren$3(doc2, (node) => node.type.name === "listItem");
17300
+ let listItems = findChildren$4(doc2, (node) => node.type.name === "listItem");
17301
17301
  if (!listItems.length) {
17302
17302
  return decorations;
17303
17303
  }
@@ -21216,9 +21216,9 @@ function trackFieldAnnotationsDeletion(editor, tr) {
21216
21216
  }, 0);
21217
21217
  }
21218
21218
  }
21219
- const { findChildren: findChildren$1 } = helpers;
21219
+ const { findChildren: findChildren$2 } = helpers;
21220
21220
  function getAllFieldAnnotations(state) {
21221
- let fieldAnnotations = findChildren$1(state.doc, (node) => node.type.name === "fieldAnnotation");
21221
+ let fieldAnnotations = findChildren$2(state.doc, (node) => node.type.name === "fieldAnnotation");
21222
21222
  return fieldAnnotations;
21223
21223
  }
21224
21224
  const FieldAnnotationPlugin = (options = {}) => {
@@ -21360,9 +21360,9 @@ function findFieldAnnotations(predicate, state) {
21360
21360
  });
21361
21361
  return fieldAnnotations;
21362
21362
  }
21363
- const { findChildren } = helpers;
21363
+ const { findChildren: findChildren$1 } = helpers;
21364
21364
  function findFieldAnnotationsByFieldId(fieldIdOrArray, state) {
21365
- let fieldAnnotations = findChildren(state.doc, (node) => {
21365
+ let fieldAnnotations = findChildren$1(state.doc, (node) => {
21366
21366
  let isFieldAnnotation = node.type.name === "fieldAnnotation";
21367
21367
  if (Array.isArray(fieldIdOrArray)) {
21368
21368
  return isFieldAnnotation && fieldIdOrArray.includes(node.attrs.fieldId);
@@ -21410,12 +21410,31 @@ const getHeaderFooterAnnotations = (editor) => {
21410
21410
  });
21411
21411
  return allAnnotations;
21412
21412
  };
21413
+ const { findChildren } = helpers;
21414
+ function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
21415
+ const sectionEditors = getAllHeaderFooterEditors(editor);
21416
+ const annotations = [];
21417
+ sectionEditors.forEach(({ editor: sectionEditor }) => {
21418
+ const state = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
21419
+ const fieldAnnotations = findChildren(state.doc, (node) => {
21420
+ let isFieldAnnotation = node.type.name === "fieldAnnotation";
21421
+ if (Array.isArray(fieldIdOrArray)) {
21422
+ return isFieldAnnotation && fieldIdOrArray.includes(node.attrs.fieldId);
21423
+ } else {
21424
+ return isFieldAnnotation && node.attrs.fieldId === fieldIdOrArray;
21425
+ }
21426
+ });
21427
+ annotations.push(...fieldAnnotations);
21428
+ });
21429
+ return annotations;
21430
+ }
21413
21431
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21414
21432
  __proto__: null,
21415
21433
  findFieldAnnotations,
21416
21434
  findFieldAnnotationsBetween,
21417
21435
  findFieldAnnotationsByFieldId,
21418
21436
  findFirstFieldAnnotationByFieldId,
21437
+ findHeaderFooterAnnotationsByFieldId,
21419
21438
  findRemovedFieldAnnotations,
21420
21439
  getAllFieldAnnotations,
21421
21440
  getAllFieldAnnotationsWithRect,
@@ -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-DifQiKXL.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Cu6WivrX.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-DifQiKXL.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-DifQiKXL.js";
2
+ import { D } from "./chunks/docx-zipper-0V4s80fa.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-Cu6WivrX.js";
2
+ import "./chunks/converter-DifQiKXL.js";
3
+ import "./chunks/docx-zipper-0V4s80fa.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,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-D4HYgwV0.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-0V4s80fa.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-DifQiKXL.js";
13
+ import { O } from "./chunks/converter-DifQiKXL.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-Cu6WivrX.js";
15
+ import { o, C, T, m, q, p, l, n } from "./chunks/editor-Cu6WivrX.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-VX_23hqe.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-0V4s80fa.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-VX_23hqe.js";
3
+ import "./chunks/editor-Cu6WivrX.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-C1r2fKvd.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-CaiAvJmI.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-C1r2fKvd.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");
@@ -47790,7 +47790,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
47790
47790
  this.config.colors = shuffleArray(this.config.colors);
47791
47791
  this.userColorMap = /* @__PURE__ */ new Map();
47792
47792
  this.colorIndex = 0;
47793
- this.version = "0.13.0-next.2";
47793
+ this.version = "0.13.0-next.3";
47794
47794
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47795
47795
  this.superdocId = config.superdocId || uuid.v4();
47796
47796
  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-CaiAvJmI.es.js";
2
+ import { a, S, i, n } from "./chunks/super-editor.es-CaiAvJmI.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";
@@ -47773,7 +47773,7 @@ class SuperDoc extends EventEmitter {
47773
47773
  this.config.colors = shuffleArray(this.config.colors);
47774
47774
  this.userColorMap = /* @__PURE__ */ new Map();
47775
47775
  this.colorIndex = 0;
47776
- this.version = "0.13.0-next.2";
47776
+ this.version = "0.13.0-next.3";
47777
47777
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
47778
47778
  this.superdocId = config.superdocId || v4();
47779
47779
  this.colors = this.config.colors;