@harbour-enterprises/superdoc 0.12.31-next.1 → 0.12.31-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.
Files changed (30) hide show
  1. package/dist/chunks/{super-editor.es-CzfjXQ8V.cjs → super-editor.es-DyMHUKH-.cjs} +80 -25
  2. package/dist/chunks/{super-editor.es-Bt5pMkY-.es.js → super-editor.es-FB6IxNPq.es.js} +93 -38
  3. package/dist/index.d.ts +2 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/super-editor/ai-writer.es.js +2 -2
  6. package/dist/super-editor/chunks/{converter-LyqpytFD.js → converter-uEzXlNMY.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-CSx2w--M.js → docx-zipper-K49xEYFp.js} +1 -1
  8. package/dist/super-editor/chunks/{editor-czvDp00c.js → editor-D9iCd6-F.js} +81 -26
  9. package/dist/super-editor/chunks/{toolbar-BnvzLMKn.js → toolbar-D-IyvvJz.js} +2 -2
  10. package/dist/super-editor/converter.es.js +1 -1
  11. package/dist/super-editor/core/Editor.d.ts +1 -1
  12. package/dist/super-editor/core/Editor.d.ts.map +1 -1
  13. package/dist/super-editor/core/helpers/annotator.d.ts +17 -3
  14. package/dist/super-editor/core/helpers/annotator.d.ts.map +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/getHeaderFooterAnnotations.d.ts +2 -0
  18. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/getHeaderFooterAnnotations.d.ts.map +1 -0
  19. package/dist/super-editor/extensions/field-annotation/fieldAnnotationHelpers/index.d.ts +1 -0
  20. package/dist/super-editor/file-zipper.es.js +1 -1
  21. package/dist/super-editor/index.d.ts +1 -1
  22. package/dist/super-editor/super-editor.es.js +8 -7
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.cjs +2 -1
  25. package/dist/super-editor.es.js +15 -14
  26. package/dist/superdoc.cjs +3 -2
  27. package/dist/superdoc.es.js +201 -200
  28. package/dist/superdoc.umd.js +81 -26
  29. package/dist/superdoc.umd.js.map +1 -1
  30. 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;
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-LyqpytFD.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-uEzXlNMY.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-CSx2w--M.js";
17
+ import { D as DocxZipper } from "./docx-zipper-K49xEYFp.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -13791,11 +13791,12 @@ const generateTableIfNecessary = ({ tableNode, annotationValues, tr, state }) =>
13791
13791
  const getAnnotationValue = (id, annotationValues) => {
13792
13792
  return annotationValues.find((value) => value.input_id === id)?.input_value || null;
13793
13793
  };
13794
- const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [] }) => {
13794
+ const getAllHeaderFooterEditors = (editor) => {
13795
13795
  const sections = {
13796
13796
  header: editor.converter.headers || {},
13797
13797
  footer: editor.converter.footers || {}
13798
13798
  };
13799
+ const allEditors = [];
13799
13800
  Object.entries(sections).forEach(([type, items]) => {
13800
13801
  const editorsKey = `${type}Editors`;
13801
13802
  Object.entries(items).forEach(([sectionId, data]) => {
@@ -13813,25 +13814,38 @@ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldI
13813
13814
  })
13814
13815
  };
13815
13816
  editor.converter[editorsKey].push(sectionEditor);
13817
+ allEditors.push({
13818
+ ...sectionEditor,
13819
+ key: editorsKey,
13820
+ type,
13821
+ sectionId
13822
+ });
13816
13823
  }
13817
- sectionEditor.editor.annotate(annotationValues, hiddenFieldIds);
13818
- onHeaderFooterDataUpdate(
13819
- { editor: sectionEditor.editor },
13820
- editor,
13821
- sectionId,
13822
- type
13823
- );
13824
13824
  });
13825
13825
  });
13826
+ return allEditors;
13827
+ };
13828
+ const annotateHeadersAndFooters = ({ editor, annotationValues = [], hiddenFieldIds = [], removeEmptyFields = false }) => {
13829
+ const allEditors = getAllHeaderFooterEditors(editor);
13830
+ allEditors.forEach(({ sectionId, editor: sectionEditor, type }) => {
13831
+ sectionEditor.annotate(annotationValues, hiddenFieldIds, removeEmptyFields);
13832
+ onHeaderFooterDataUpdate(
13833
+ { editor: sectionEditor },
13834
+ editor,
13835
+ sectionId,
13836
+ type
13837
+ );
13838
+ });
13826
13839
  };
13827
13840
  const annotateDocument = ({
13828
13841
  annotationValues = [],
13829
13842
  hiddenFieldIds = [],
13843
+ removeEmptyFields = false,
13830
13844
  schema,
13831
13845
  tr,
13832
13846
  editor
13833
13847
  }) => {
13834
- annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds });
13848
+ annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields });
13835
13849
  const annotations = [];
13836
13850
  const FieldType = schema.nodes.fieldAnnotation;
13837
13851
  tr.doc.descendants((node, pos) => {
@@ -13884,11 +13898,13 @@ const annotateDocument = ({
13884
13898
  });
13885
13899
  }
13886
13900
  }
13887
- Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
13888
- const ann = annotations.find((a) => a.pos === pos);
13889
- if (!ann) return;
13890
- tr = tr.delete(pos, pos + ann.node.nodeSize);
13891
- });
13901
+ if (removeEmptyFields) {
13902
+ Array.from(toDelete).sort((a, b) => b - a).forEach((pos) => {
13903
+ const ann = annotations.find((a) => a.pos === pos);
13904
+ if (!ann) return;
13905
+ tr = tr.delete(pos, pos + ann.node.nodeSize);
13906
+ });
13907
+ }
13892
13908
  return tr;
13893
13909
  };
13894
13910
  const getFormattedDate = (input = null, format = "") => {
@@ -13906,11 +13922,40 @@ const getFormattedDate = (input = null, format = "") => {
13906
13922
  // e.g. “2025”
13907
13923
  });
13908
13924
  };
13909
- const AnnotatorServices = {
13925
+ const updateHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray, attrs = {} }) => {
13926
+ if (!editor) return;
13927
+ const sectionEditors = getAllHeaderFooterEditors(editor);
13928
+ sectionEditors.forEach(({ editor: sectionEditor, sectionId, type }) => {
13929
+ sectionEditor.commands.updateFieldAnnotations(fieldIdOrArray, attrs);
13930
+ onHeaderFooterDataUpdate(
13931
+ { editor: sectionEditor },
13932
+ editor,
13933
+ sectionId,
13934
+ type
13935
+ );
13936
+ });
13937
+ };
13938
+ const deleteHeaderFooterFieldAnnotations = ({ editor, fieldIdOrArray }) => {
13939
+ if (!editor) return;
13940
+ const sectionEditors = getAllHeaderFooterEditors(editor);
13941
+ sectionEditors.forEach(({ editor: sectionEditor, sectionId, type }) => {
13942
+ sectionEditor.commands.deleteFieldAnnotations(fieldIdOrArray);
13943
+ onHeaderFooterDataUpdate(
13944
+ { editor: sectionEditor },
13945
+ editor,
13946
+ sectionId,
13947
+ type
13948
+ );
13949
+ });
13950
+ };
13951
+ const AnnotatorHelpers = {
13910
13952
  getFieldAttrs,
13911
13953
  processTables,
13912
13954
  annotateDocument,
13913
- annotateHeadersAndFooters
13955
+ annotateHeadersAndFooters,
13956
+ getAllHeaderFooterEditors,
13957
+ updateHeaderFooterFieldAnnotations,
13958
+ deleteHeaderFooterFieldAnnotations
13914
13959
  };
13915
13960
  const CollaborationPluginKey = new PluginKey("collaboration");
13916
13961
  const Collaboration = Extension.create({
@@ -14743,7 +14788,7 @@ const _Editor = class _Editor extends EventEmitter {
14743
14788
  * @returns {Object | void} Migration results
14744
14789
  */
14745
14790
  processCollaborationMigrations() {
14746
- console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.1");
14791
+ console.debug("[checkVersionMigrations] Current editor version", "0.12.31-next.3");
14747
14792
  if (!this.options.ydoc) return;
14748
14793
  const metaMap = this.options.ydoc.getMap("meta");
14749
14794
  let docVersion = metaMap.get("version");
@@ -14832,10 +14877,8 @@ const _Editor = class _Editor extends EventEmitter {
14832
14877
  */
14833
14878
  prepareForAnnotations(annotationValues = []) {
14834
14879
  const { tr } = this.state;
14835
- const { dispatch } = this.view;
14836
- const newTr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
14880
+ const newTr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
14837
14881
  this.view.dispatch(newTr);
14838
- AnnotatorServices.annotateHeadersAndFooters({ editor: this, annotationValues });
14839
14882
  }
14840
14883
  /**
14841
14884
  * Annotate the document with the given annotation values.
@@ -14844,15 +14887,16 @@ const _Editor = class _Editor extends EventEmitter {
14844
14887
  * @param {String[]} hiddenIds List of field ids to remove from the document.
14845
14888
  * @returns {void}
14846
14889
  */
14847
- annotate(annotationValues = [], hiddenIds = []) {
14890
+ annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
14848
14891
  const { state, view, schema } = this;
14849
14892
  let tr = state.tr;
14850
- tr = AnnotatorServices.processTables({ state: this.state, tr, annotationValues });
14851
- tr = AnnotatorServices.annotateDocument({
14893
+ tr = AnnotatorHelpers.processTables({ state: this.state, tr, annotationValues });
14894
+ tr = AnnotatorHelpers.annotateDocument({
14852
14895
  tr,
14853
14896
  schema,
14854
14897
  annotationValues,
14855
14898
  hiddenFieldIds: hiddenIds,
14899
+ removeEmptyFields,
14856
14900
  editor: this
14857
14901
  });
14858
14902
  if (tr.docChanged) view.dispatch(tr.scrollIntoView());
@@ -21235,6 +21279,15 @@ function findFieldAnnotationsBetween(from2, to, doc2) {
21235
21279
  });
21236
21280
  return fieldAnnotations;
21237
21281
  }
21282
+ const getHeaderFooterAnnotations = (editor) => {
21283
+ const editors = getAllHeaderFooterEditors(editor);
21284
+ const allAnnotations = [];
21285
+ editors.forEach(({ id, editor: editor2 }) => {
21286
+ const annotations = getAllFieldAnnotations(editor2.state);
21287
+ allAnnotations.push(...annotations);
21288
+ });
21289
+ return allAnnotations;
21290
+ };
21238
21291
  const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21239
21292
  __proto__: null,
21240
21293
  findFieldAnnotations,
@@ -21244,6 +21297,7 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
21244
21297
  findRemovedFieldAnnotations,
21245
21298
  getAllFieldAnnotations,
21246
21299
  getAllFieldAnnotationsWithRect,
21300
+ getHeaderFooterAnnotations,
21247
21301
  trackFieldAnnotationsDeletion
21248
21302
  }, Symbol.toStringTag, { value: "Module" }));
21249
21303
  function guard(low, high, value) {
@@ -27382,7 +27436,8 @@ export {
27382
27436
  helpers as l,
27383
27437
  index$1 as m,
27384
27438
  index as n,
27385
- getMarksFromSelection as o,
27439
+ AnnotatorHelpers as o,
27440
+ getMarksFromSelection as p,
27386
27441
  redoDepth as r,
27387
27442
  useHighContrastMode as u
27388
27443
  };
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, unref, createBlock, toDisplayString, withDirectives, withKeys, withModifiers, 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-LyqpytFD.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-czvDp00c.js";
2
+ import { x as process$1 } from "./converter-uEzXlNMY.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-D9iCd6-F.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-LyqpytFD.js";
1
+ import { O } from "./chunks/converter-uEzXlNMY.js";
2
2
  export {
3
3
  O as SuperConverter
4
4
  };
@@ -462,7 +462,7 @@ export class Editor extends EventEmitter {
462
462
  * @param {String[]} hiddenIds List of field ids to remove from the document.
463
463
  * @returns {void}
464
464
  */
465
- annotate(annotationValues?: FieldValue[], hiddenIds?: string[]): void;
465
+ annotate(annotationValues?: FieldValue[], hiddenIds?: string[], removeEmptyFields?: boolean): void;
466
466
  /**
467
467
  * Preview annotations in the editor. It stores a copy of the original state.
468
468
  * This can be reverted via closePreview()
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../../src/core/Editor.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AAEH;;;;;GAKG;AACH;;;;;EAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH;;;;GAIG;AACH;IAuqBE;;;;;;;;;;;;OAYG;IACH,+BARW,IAAI,GAAC,IAAI,GAAC,MAAM,WAChB,OAAO,GACL,OAAO,OAAO,CAc1B;IAED;;;;;OAKG;IACH,qCAFa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;;;;;;;;;;uBAGP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAsBP,OAAO;;;;mBACP,OAAO;;;;WACP,MAAM;;6BApGS,mBAAmB"}
@@ -3,18 +3,23 @@ export function processTables({ state, tr, annotationValues }: {
3
3
  editor: any;
4
4
  annotationValues: any[];
5
5
  }): any;
6
- export function annotateDocument({ annotationValues, hiddenFieldIds, schema, tr, editor, }: {
6
+ export function getAllHeaderFooterEditors(editor: Editor): any[];
7
+ export function annotateDocument({ annotationValues, hiddenFieldIds, removeEmptyFields, schema, tr, editor, }: {
7
8
  annotationValues?: any[];
8
9
  hiddenFieldIds?: any[];
10
+ removeEmptyFields?: boolean;
9
11
  schema: any;
10
12
  tr: any;
11
13
  editor: any;
12
14
  }): any;
13
- export namespace AnnotatorServices {
15
+ export namespace AnnotatorHelpers {
14
16
  export { getFieldAttrs };
15
17
  export { processTables };
16
18
  export { annotateDocument };
17
19
  export { annotateHeadersAndFooters };
20
+ export { getAllHeaderFooterEditors };
21
+ export { updateHeaderFooterFieldAnnotations };
22
+ export { deleteHeaderFooterFieldAnnotations };
18
23
  }
19
24
  /**
20
25
  * Annotate headers and footers in the document
@@ -25,10 +30,19 @@ export namespace AnnotatorServices {
25
30
  * @param {Array} param0.hiddenFieldIds List of field IDs to hide
26
31
  * @returns {void}
27
32
  */
28
- declare function annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds }: {
33
+ declare function annotateHeadersAndFooters({ editor, annotationValues, hiddenFieldIds, removeEmptyFields }: {
29
34
  editor: any;
30
35
  annotationValues: any[];
31
36
  hiddenFieldIds: any[];
32
37
  }): void;
38
+ declare function updateHeaderFooterFieldAnnotations({ editor, fieldIdOrArray, attrs }: {
39
+ editor: any;
40
+ fieldIdOrArray: any;
41
+ attrs?: {};
42
+ }): void;
43
+ declare function deleteHeaderFooterFieldAnnotations({ editor, fieldIdOrArray }: {
44
+ editor: any;
45
+ fieldIdOrArray: any;
46
+ }): void;
33
47
  export {};
34
48
  //# sourceMappingURL=annotator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotator.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/annotator.js"],"names":[],"mappings":"AAWO,uEAiBN;AAiCM,+DAHJ;IAAuB,MAAM;IACP,gBAAgB;CACxC,OAkBA;AAuIM;;;;;;QAsFN;;;;;;;AApID;;;;;;;;GAQG;AACH,yFALG;IAAuB,MAAM;IACP,gBAAgB;IAChB,cAAc;CACpC,GAAU,IAAI,CAqChB"}
1
+ {"version":3,"file":"annotator.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/annotator.js"],"names":[],"mappings":"AAWO,uEAiBN;AAiCM,+DAHJ;IAAuB,MAAM;IACP,gBAAgB;CACxC,OAkBA;AA8FM,kDAHI,MAAM,GACJ,KAAQ,CAsCpB;AAwBM;;;;;;;QAyFN;;;;;;;;;;AA/GD;;;;;;;;GAQG;AACH,4GALG;IAAuB,MAAM;IACP,gBAAgB;IAChB,cAAc;CACpC,GAAU,IAAI,CAahB;AAuHD;;;;SAeC;AAED;;;SAeC"}
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-LyqpytFD.js";
2
- import { D } from "./chunks/docx-zipper-CSx2w--M.js";
1
+ import "./chunks/converter-uEzXlNMY.js";
2
+ import { D } from "./chunks/docx-zipper-K49xEYFp.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-czvDp00c.js";
2
- import "./chunks/converter-LyqpytFD.js";
3
- import "./chunks/docx-zipper-CSx2w--M.js";
1
+ import { E } from "./chunks/editor-D9iCd6-F.js";
2
+ import "./chunks/converter-uEzXlNMY.js";
3
+ import "./chunks/docx-zipper-K49xEYFp.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -0,0 +1,2 @@
1
+ export function getHeaderFooterAnnotations(editor: any): any[];
2
+ //# sourceMappingURL=getHeaderFooterAnnotations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHeaderFooterAnnotations.d.ts","sourceRoot":"","sources":["../../../../src/extensions/field-annotation/fieldAnnotationHelpers/getHeaderFooterAnnotations.js"],"names":[],"mappings":"AAOO,yDAFM,KAAQ,CAWpB"}
@@ -6,4 +6,5 @@ export * from "./findFirstFieldAnnotationByFieldId.js";
6
6
  export * from "./findFieldAnnotationsBetween.js";
7
7
  export * from "./findRemovedFieldAnnotations.js";
8
8
  export * from "./trackFieldAnnotationsDeletion.js";
9
+ export * from "./getHeaderFooterAnnotations.js";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CSx2w--M.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-K49xEYFp.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -21,5 +21,5 @@ export namespace Extensions {
21
21
  import { TrackChangesBasePluginKey } from './extensions/track-changes/plugins/index.js';
22
22
  import { CommentsPluginKey } from './extensions/comment/comments-plugin.js';
23
23
  import { Plugin } from 'prosemirror-state';
24
- export { SuperConverter, DocxZipper, SuperToolbar, Editor, SuperEditor, SuperInput, BasicUpload, Toolbar, AIWriter, helpers, fieldAnnotationHelpers, trackChangesHelpers, getMarksFromSelection, getActiveFormatting, getStarterExtensions, getRichTextExtensions, createZip, getAllowedImageDimensions, TrackChangesBasePluginKey, CommentsPluginKey };
24
+ export { SuperConverter, DocxZipper, SuperToolbar, Editor, SuperEditor, SuperInput, BasicUpload, Toolbar, AIWriter, helpers, fieldAnnotationHelpers, trackChangesHelpers, AnnotatorHelpers, getMarksFromSelection, getActiveFormatting, getStarterExtensions, getRichTextExtensions, createZip, getAllowedImageDimensions, TrackChangesBasePluginKey, CommentsPluginKey };
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -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 { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, 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-czvDp00c.js";
13
- import { C, T, m, o, l, n } from "./chunks/editor-czvDp00c.js";
14
- import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-LyqpytFD.js";
15
- import { O } from "./chunks/converter-LyqpytFD.js";
12
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, 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-D9iCd6-F.js";
13
+ import { o, C, T, m, p, l, n } from "./chunks/editor-D9iCd6-F.js";
14
+ import { a2 as getDefaultExportFromCjs, E as v4, a5 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-uEzXlNMY.js";
15
+ import { O } from "./chunks/converter-uEzXlNMY.js";
16
16
  import { ref, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, withModifiers, vModelText, createTextVNode, toDisplayString, Fragment, renderList, 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-BnvzLMKn.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-D-IyvvJz.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-CSx2w--M.js";
19
+ import { D } from "./chunks/docx-zipper-K49xEYFp.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  (function(module) {
@@ -3506,6 +3506,7 @@ const Extensions = {
3506
3506
  };
3507
3507
  export {
3508
3508
  AIWriter,
3509
+ o as AnnotatorHelpers,
3509
3510
  _sfc_main$1 as BasicUpload,
3510
3511
  C as CommentsPluginKey,
3511
3512
  D as DocxZipper,
@@ -3521,7 +3522,7 @@ export {
3521
3522
  m as fieldAnnotationHelpers,
3522
3523
  getActiveFormatting,
3523
3524
  getAllowedImageDimensions,
3524
- o as getMarksFromSelection,
3525
+ p as getMarksFromSelection,
3525
3526
  getRichTextExtensions,
3526
3527
  getStarterExtensions,
3527
3528
  l as helpers,
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-BnvzLMKn.js";
3
- import "./chunks/editor-czvDp00c.js";
2
+ import { T } from "./chunks/toolbar-D-IyvvJz.js";
3
+ import "./chunks/editor-D9iCd6-F.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-CzfjXQ8V.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DyMHUKH-.cjs");
4
4
  require("./chunks/vue-DPZkajuO.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
+ exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
6
7
  exports.BasicUpload = superEditor_es._sfc_main$1;
7
8
  exports.CommentsPluginKey = superEditor_es.CommentsPluginKey;
8
9
  exports.DocxZipper = superEditor_es.DocxZipper;
@@ -1,25 +1,26 @@
1
- import { A, _, C, D, E, a, S, b, c, d, T, e, f, i, g, h, j, k, l, m, n } from "./chunks/super-editor.es-Bt5pMkY-.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-FB6IxNPq.es.js";
2
2
  import "./chunks/vue-IIIZMHTg.es.js";
3
3
  export {
4
4
  A as AIWriter,
5
+ a as AnnotatorHelpers,
5
6
  _ as BasicUpload,
6
7
  C as CommentsPluginKey,
7
8
  D as DocxZipper,
8
9
  E as Editor,
9
- a as Extensions,
10
+ b as Extensions,
10
11
  S as SuperConverter,
11
- b as SuperEditor,
12
- c as SuperInput,
13
- d as SuperToolbar,
12
+ c as SuperEditor,
13
+ d as SuperInput,
14
+ e as SuperToolbar,
14
15
  T as Toolbar,
15
- e as TrackChangesBasePluginKey,
16
- f as createZip,
16
+ f as TrackChangesBasePluginKey,
17
+ g as createZip,
17
18
  i as fieldAnnotationHelpers,
18
- g as getActiveFormatting,
19
- h as getAllowedImageDimensions,
20
- j as getMarksFromSelection,
21
- k as getRichTextExtensions,
22
- l as getStarterExtensions,
23
- m as helpers,
24
- n as trackChangesHelpers
19
+ h as getActiveFormatting,
20
+ j as getAllowedImageDimensions,
21
+ k as getMarksFromSelection,
22
+ l as getRichTextExtensions,
23
+ m as getStarterExtensions,
24
+ n as helpers,
25
+ o as trackChangesHelpers
25
26
  };
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-CzfjXQ8V.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-DyMHUKH-.cjs");
4
4
  const vue = require("./chunks/vue-DPZkajuO.cjs");
5
5
  const jszip = require("./chunks/jszip-Bwu_om3F.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -46574,7 +46574,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
46574
46574
  this.config.colors = shuffleArray(this.config.colors);
46575
46575
  this.userColorMap = /* @__PURE__ */ new Map();
46576
46576
  this.colorIndex = 0;
46577
- this.version = "0.12.31-next.1";
46577
+ this.version = "0.12.31-next.3";
46578
46578
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
46579
46579
  this.superdocId = config.superdocId || uuid.v4();
46580
46580
  this.colors = this.config.colors;
@@ -47142,6 +47142,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
47142
47142
  this.highContrastModeStore.setHighContrastMode(isHighContrast);
47143
47143
  }
47144
47144
  }
47145
+ exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
47145
47146
  exports.Editor = superEditor_es.Editor;
47146
47147
  exports.SuperConverter = superEditor_es.SuperConverter;
47147
47148
  exports.createZip = superEditor_es.createZip;