@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.
@@ -30770,7 +30770,7 @@
30770
30770
  return;
30771
30771
  }
30772
30772
  }
30773
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.2") {
30773
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.3") {
30774
30774
  const customLocation = "docProps/custom.xml";
30775
30775
  if (!docx[customLocation]) {
30776
30776
  docx[customLocation] = generateCustomXml();
@@ -31237,7 +31237,7 @@
31237
31237
  function generateCustomXml() {
31238
31238
  return DEFAULT_CUSTOM_XML;
31239
31239
  }
31240
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.2") {
31240
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.3") {
31241
31241
  return {
31242
31242
  type: "element",
31243
31243
  name: "property",
@@ -37929,7 +37929,7 @@
37929
37929
  }
37930
37930
  return false;
37931
37931
  }
37932
- function findChildren$3(node2, predicate) {
37932
+ function findChildren$4(node2, predicate) {
37933
37933
  const nodesWithPos = [];
37934
37934
  node2.descendants((child, pos) => {
37935
37935
  if (predicate(child)) {
@@ -37986,7 +37986,7 @@
37986
37986
  cleanSchemaItem,
37987
37987
  createDocument,
37988
37988
  defaultBlockAt,
37989
- findChildren: findChildren$3,
37989
+ findChildren: findChildren$4,
37990
37990
  findMark,
37991
37991
  findParentNode,
37992
37992
  findParentNodeClosestToPos,
@@ -46113,7 +46113,7 @@
46113
46113
  });
46114
46114
  return result;
46115
46115
  };
46116
- const findChildren$2 = (node2, predicate, descend) => {
46116
+ const findChildren$3 = (node2, predicate, descend) => {
46117
46117
  if (!node2) {
46118
46118
  throw new Error('Invalid "node" parameter');
46119
46119
  } else if (!predicate) {
@@ -46122,11 +46122,11 @@
46122
46122
  return flatten$4(node2, descend).filter((child) => predicate(child.node));
46123
46123
  };
46124
46124
  const findInlineNodes = (node2, descend) => {
46125
- return findChildren$2(node2, (child) => child.isInline, descend);
46125
+ return findChildren$3(node2, (child) => child.isInline, descend);
46126
46126
  };
46127
46127
  const documentHelpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
46128
46128
  __proto__: null,
46129
- findChildren: findChildren$2,
46129
+ findChildren: findChildren$3,
46130
46130
  findInlineNodes,
46131
46131
  findMarkPosition,
46132
46132
  flatten: flatten$4
@@ -48614,7 +48614,7 @@
48614
48614
  * @returns {Object | void} Migration results
48615
48615
  */
48616
48616
  processCollaborationMigrations() {
48617
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.2");
48617
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.3");
48618
48618
  if (!this.options.ydoc) return;
48619
48619
  const metaMap = this.options.ydoc.getMap("meta");
48620
48620
  let docVersion = metaMap.get("version");
@@ -50837,7 +50837,7 @@
50837
50837
  let { doc: doc2, storedMarks } = state2;
50838
50838
  let decorations = [];
50839
50839
  if (Array.isArray(storedMarks)) marks.push(...storedMarks);
50840
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
50840
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
50841
50841
  if (!listItems.length) {
50842
50842
  return decorations;
50843
50843
  }
@@ -50882,7 +50882,7 @@
50882
50882
  function getListItemStylingFromParagraphProps(state2) {
50883
50883
  let { doc: doc2 } = state2;
50884
50884
  let decorations = [];
50885
- let listItems = findChildren$3(doc2, (node2) => node2.type.name === "listItem");
50885
+ let listItems = findChildren$4(doc2, (node2) => node2.type.name === "listItem");
50886
50886
  if (!listItems.length) {
50887
50887
  return decorations;
50888
50888
  }
@@ -54801,9 +54801,9 @@
54801
54801
  }, 0);
54802
54802
  }
54803
54803
  }
54804
- const { findChildren: findChildren$1 } = helpers;
54804
+ const { findChildren: findChildren$2 } = helpers;
54805
54805
  function getAllFieldAnnotations(state2) {
54806
- let fieldAnnotations = findChildren$1(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
54806
+ let fieldAnnotations = findChildren$2(state2.doc, (node2) => node2.type.name === "fieldAnnotation");
54807
54807
  return fieldAnnotations;
54808
54808
  }
54809
54809
  const FieldAnnotationPlugin = (options2 = {}) => {
@@ -54945,9 +54945,9 @@
54945
54945
  });
54946
54946
  return fieldAnnotations;
54947
54947
  }
54948
- const { findChildren } = helpers;
54948
+ const { findChildren: findChildren$1 } = helpers;
54949
54949
  function findFieldAnnotationsByFieldId(fieldIdOrArray, state2) {
54950
- let fieldAnnotations = findChildren(state2.doc, (node2) => {
54950
+ let fieldAnnotations = findChildren$1(state2.doc, (node2) => {
54951
54951
  let isFieldAnnotation = node2.type.name === "fieldAnnotation";
54952
54952
  if (Array.isArray(fieldIdOrArray)) {
54953
54953
  return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
@@ -54995,12 +54995,31 @@
54995
54995
  });
54996
54996
  return allAnnotations;
54997
54997
  };
54998
+ const { findChildren } = helpers;
54999
+ function findHeaderFooterAnnotationsByFieldId(fieldIdOrArray, editor, activeSectionEditor) {
55000
+ const sectionEditors = getAllHeaderFooterEditors(editor);
55001
+ const annotations = [];
55002
+ sectionEditors.forEach(({ editor: sectionEditor }) => {
55003
+ const state2 = activeSectionEditor.options.documentId === sectionEditor.options.documentId ? activeSectionEditor.state : sectionEditor.state;
55004
+ const fieldAnnotations = findChildren(state2.doc, (node2) => {
55005
+ let isFieldAnnotation = node2.type.name === "fieldAnnotation";
55006
+ if (Array.isArray(fieldIdOrArray)) {
55007
+ return isFieldAnnotation && fieldIdOrArray.includes(node2.attrs.fieldId);
55008
+ } else {
55009
+ return isFieldAnnotation && node2.attrs.fieldId === fieldIdOrArray;
55010
+ }
55011
+ });
55012
+ annotations.push(...fieldAnnotations);
55013
+ });
55014
+ return annotations;
55015
+ }
54998
55016
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54999
55017
  __proto__: null,
55000
55018
  findFieldAnnotations,
55001
55019
  findFieldAnnotationsBetween,
55002
55020
  findFieldAnnotationsByFieldId,
55003
55021
  findFirstFieldAnnotationByFieldId,
55022
+ findHeaderFooterAnnotationsByFieldId,
55004
55023
  findRemovedFieldAnnotations,
55005
55024
  getAllFieldAnnotations,
55006
55025
  getAllFieldAnnotationsWithRect,
@@ -93219,7 +93238,7 @@ ${style2}
93219
93238
  this.config.colors = shuffleArray(this.config.colors);
93220
93239
  this.userColorMap = /* @__PURE__ */ new Map();
93221
93240
  this.colorIndex = 0;
93222
- this.version = "0.13.0-next.2";
93241
+ this.version = "0.13.0-next.3";
93223
93242
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
93224
93243
  this.superdocId = config.superdocId || v4();
93225
93244
  this.colors = this.config.colors;