@harbour-enterprises/superdoc 0.29.0-next.16 → 0.29.0-next.17

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 (40) hide show
  1. package/dist/chunks/{PdfViewer-B14Psbm5.cjs → PdfViewer-DYxoL3aX.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CpbPbmhH.es.js → PdfViewer-cB0Wc125.es.js} +1 -1
  3. package/dist/chunks/{index-BAB9eQRg.es.js → index-BkH3Ewpn.es.js} +3 -3
  4. package/dist/chunks/{index-BE8ctcJ1-BVHEZaEv.es.js → index-CdXg92JS-CoYVY9yT.es.js} +1 -1
  5. package/dist/chunks/{index-BE8ctcJ1-BsFfsr_5.cjs → index-CdXg92JS-rI1se8w8.cjs} +1 -1
  6. package/dist/chunks/{index-BRloVMt4.cjs → index-Cp4ihfTg.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-soAIWbdF.es.js → super-editor.es-DbVz9iFq.es.js} +58 -31
  8. package/dist/chunks/{super-editor.es-hL-1R4Qv.cjs → super-editor.es-GK0HIFwy.cjs} +58 -31
  9. package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
  10. package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
  11. package/dist/style.css +6 -6
  12. package/dist/super-editor/ai-writer.es.js +2 -2
  13. package/dist/super-editor/chunks/{converter-Dw2FWHjz.js → converter-BxHd90vg.js} +1 -1
  14. package/dist/super-editor/chunks/{docx-zipper-B-OgBQQi.js → docx-zipper-DRDqDf4t.js} +1 -1
  15. package/dist/super-editor/chunks/{editor-CtEAROku.js → editor-BN_AUZwq.js} +65 -38
  16. package/dist/super-editor/chunks/{index-BE8ctcJ1.js → index-CdXg92JS.js} +1 -1
  17. package/dist/super-editor/chunks/{toolbar-Bya4b9Yv.js → toolbar-CeJfRy_U.js} +2 -2
  18. package/dist/super-editor/converter.es.js +1 -1
  19. package/dist/super-editor/docx-zipper.es.js +2 -2
  20. package/dist/super-editor/editor.es.js +3 -3
  21. package/dist/super-editor/file-zipper.es.js +1 -1
  22. package/dist/super-editor/style.css +6 -6
  23. package/dist/super-editor/super-editor/src/components/pagination-helpers.d.ts.map +1 -1
  24. package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
  25. package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts.map +1 -1
  26. package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
  27. package/dist/super-editor/super-editor/src/extensions/pagination/pagination-helpers.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts.map +1 -1
  29. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
  30. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts +1 -0
  31. package/dist/super-editor/super-editor/src/utils/headless-helpers.d.ts.map +1 -1
  32. package/dist/super-editor/super-editor.es.js +14 -13
  33. package/dist/super-editor/toolbar.es.js +2 -2
  34. package/dist/super-editor.cjs +1 -1
  35. package/dist/super-editor.es.js +1 -1
  36. package/dist/superdoc.cjs +2 -2
  37. package/dist/superdoc.es.js +2 -2
  38. package/dist/superdoc.umd.js +60 -33
  39. package/dist/superdoc.umd.js.map +1 -1
  40. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-soAIWbdF.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DbVz9iFq.es.js";
2
2
  import "./chunks/vue-D1vcEBAQ.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-hL-1R4Qv.cjs");
4
- const superdoc = require("./chunks/index-BRloVMt4.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-GK0HIFwy.cjs");
4
+ const superdoc = require("./chunks/index-Cp4ihfTg.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
7
7
  exports.Editor = superEditor_es.Editor;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-soAIWbdF.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-BAB9eQRg.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DbVz9iFq.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-BkH3Ewpn.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
4
  export {
5
5
  a as AnnotatorHelpers,
@@ -35782,7 +35782,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
35782
35782
  static getStoredSuperdocVersion(docx) {
35783
35783
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35784
35784
  }
35785
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.16") {
35785
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-next.17") {
35786
35786
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35787
35787
  }
35788
35788
  /**
@@ -38904,14 +38904,14 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38904
38904
  const zip = await this.zip.loadAsync(file);
38905
38905
  return zip;
38906
38906
  }
38907
- async updateZip({ docx, updatedDocs, originalDocxFile, media: media2, fonts, isHeadless }) {
38907
+ async updateZip({ docx, updatedDocs, originalDocxFile, media: media2, fonts, isHeadless: isHeadless2 }) {
38908
38908
  let zip;
38909
38909
  if (originalDocxFile) {
38910
38910
  zip = await this.exportFromOriginalFile(originalDocxFile, updatedDocs, media2);
38911
38911
  } else {
38912
38912
  zip = await this.exportFromCollaborativeDocx(docx, updatedDocs, media2, fonts);
38913
38913
  }
38914
- const exportType = isHeadless ? "nodebuffer" : "blob";
38914
+ const exportType = isHeadless2 ? "nodebuffer" : "blob";
38915
38915
  return await zip.generateAsync({ type: exportType });
38916
38916
  }
38917
38917
  /**
@@ -58388,9 +58388,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58388
58388
  if (!target || !target.classList) return;
58389
58389
  target.classList.add(STYLE_ISOLATION_CLASS);
58390
58390
  };
58391
+ const isHeadless = (editor) => {
58392
+ return editor?.options?.isHeadless ?? false;
58393
+ };
58394
+ const shouldSkipNodeView = (editor) => {
58395
+ return isHeadless(editor);
58396
+ };
58391
58397
  const PaginationPluginKey = new PluginKey("paginationPlugin");
58392
58398
  const initPaginationData = async (editor) => {
58393
- if (!editor.converter) return;
58399
+ if (isHeadless(editor) || !editor.converter) return;
58394
58400
  const sectionData = { headers: {}, footers: {} };
58395
58401
  const headerIds = editor.converter.headerIds.ids;
58396
58402
  const footerIds = editor.converter.footerIds.ids;
@@ -58526,6 +58532,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
58526
58532
  });
58527
58533
  };
58528
58534
  const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode, documentMode }) => {
58535
+ if (isHeadless(editor)) return;
58529
58536
  editor.converter.headerEditors.forEach((item) => {
58530
58537
  item.editor.setEditable(isEditMode, false);
58531
58538
  item.editor.view.dom.setAttribute("aria-readonly", !isEditMode);
@@ -61595,10 +61602,12 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61595
61602
  };
61596
61603
  if ("orientation" in screen && "addEventListener" in screen.orientation) {
61597
61604
  screen.orientation.addEventListener("change", handleResize);
61598
- } else {
61605
+ } else if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
61599
61606
  window.matchMedia("(orientation: portrait)").addEventListener("change", handleResize);
61600
61607
  }
61601
- window.addEventListener("resize", () => handleResize);
61608
+ if (typeof window !== "undefined" && typeof window.addEventListener === "function") {
61609
+ window.addEventListener("resize", () => handleResize);
61610
+ }
61602
61611
  }
61603
61612
  /**
61604
61613
  * Get document identifier for telemetry (async - may generate hash)
@@ -61712,7 +61721,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61712
61721
  { default: remarkStringify2 },
61713
61722
  { default: remarkGfm2 }
61714
61723
  ] = await Promise.all([
61715
- Promise.resolve().then(() => indexBE8ctcJ1),
61724
+ Promise.resolve().then(() => indexCdXg92JS),
61716
61725
  Promise.resolve().then(() => indexDRCvimau),
61717
61726
  Promise.resolve().then(() => indexC_x_N6Uh),
61718
61727
  Promise.resolve().then(() => indexD_sWOSiG),
@@ -61764,7 +61773,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61764
61773
  this.initDefaultStyles();
61765
61774
  hasMadeUpdate = true;
61766
61775
  }
61767
- if (hasMadeUpdate) {
61776
+ if (hasMadeUpdate && !isHeadless(this)) {
61768
61777
  const newTr = this.view.state.tr;
61769
61778
  newTr.setMeta("forceUpdatePagination", true);
61770
61779
  this.view.dispatch(newTr);
@@ -61930,7 +61939,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
61930
61939
  * @returns {Object | void} Migration results
61931
61940
  */
61932
61941
  processCollaborationMigrations() {
61933
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.16");
61942
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-next.17");
61934
61943
  if (!this.options.ydoc) return;
61935
61944
  const metaMap = this.options.ydoc.getMap("meta");
61936
61945
  let docVersion = metaMap.get("version");
@@ -62364,16 +62373,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62364
62373
  handleClick: __privateMethod$1(this, _Editor_instances, handleNodeSelection_fn).bind(this),
62365
62374
  handleDoubleClick: async (view, pos, event) => {
62366
62375
  if (this.options.documentMode !== "editing") return;
62367
- const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
62368
- const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
62369
- if (isHeader || isFooter) {
62370
- const eventClone = new event.constructor(event.type);
62371
- event.target.dispatchEvent(eventClone);
62372
- if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
62373
- return;
62376
+ if (!isHeadless(this)) {
62377
+ const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
62378
+ const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
62379
+ if (isHeader || isFooter) {
62380
+ const eventClone = new event.constructor(event.type);
62381
+ event.target.dispatchEvent(eventClone);
62382
+ if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
62383
+ return;
62384
+ }
62374
62385
  }
62375
62386
  event.stopPropagation();
62376
- if (!this.options.editable) {
62387
+ if (!this.options.editable && !isHeadless(this)) {
62377
62388
  this.setEditable(true, false);
62378
62389
  toggleHeaderFooterEditMode({
62379
62390
  editor: this,
@@ -67009,9 +67020,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67009
67020
  }
67010
67021
  });
67011
67022
  }
67012
- const shouldSkipNodeView = (editor) => {
67013
- return editor.options.isHeadless;
67014
- };
67015
67023
  const ListItem = Node$1.create({
67016
67024
  name: "listItem",
67017
67025
  content: "paragraph* block*",
@@ -72983,7 +72991,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
72983
72991
  }
72984
72992
  if (dispatch) {
72985
72993
  commands2.updateFieldAnnotationsAttributes([annotation], attrs);
72986
- if (this.editor.options.pagination) {
72994
+ if (this.editor.options.pagination && !isHeadless(this.editor)) {
72987
72995
  setTimeout(() => {
72988
72996
  const newTr = this.editor.view.state.tr;
72989
72997
  newTr.setMeta("forceUpdatePagination", true);
@@ -74920,7 +74928,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74920
74928
  const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
74921
74929
  if (dispatch) {
74922
74930
  tr.replaceSelectionWith(pageNumberNode, false);
74923
- tr.setMeta("forceUpdatePagination", true);
74931
+ if (!isHeadless(editor)) {
74932
+ tr.setMeta("forceUpdatePagination", true);
74933
+ }
74924
74934
  }
74925
74935
  return true;
74926
74936
  }
@@ -83587,6 +83597,10 @@ ${l}
83587
83597
  };
83588
83598
  },
83589
83599
  addCommands() {
83600
+ const editor = this.editor;
83601
+ if (isHeadless(editor)) {
83602
+ return {};
83603
+ }
83590
83604
  return {
83591
83605
  insertPageBreak: () => ({ commands: commands2 }) => {
83592
83606
  return commands2.insertContent({
@@ -83597,20 +83611,26 @@ ${l}
83597
83611
  * Toggle pagination on/off
83598
83612
  * @returns {void}
83599
83613
  */
83600
- togglePagination: () => ({ tr, state: state2, dispatch, editor }) => {
83614
+ togglePagination: () => ({ tr, state: state2, dispatch, editor: editor2 }) => {
83601
83615
  const isEnabled = PaginationPluginKey.getState(state2)?.isEnabled;
83602
83616
  tr.setMeta(PaginationPluginKey, { isEnabled: !isEnabled });
83603
83617
  if (dispatch) {
83604
83618
  dispatch(tr);
83605
- editor.initDefaultStyles(editor.element, !isEnabled);
83619
+ editor2.initDefaultStyles(editor2.element, !isEnabled);
83606
83620
  return true;
83607
83621
  }
83608
83622
  }
83609
83623
  };
83610
83624
  },
83611
83625
  addShortcuts() {
83626
+ const editor = this.editor;
83627
+ if (isHeadless(editor)) {
83628
+ return {};
83629
+ }
83612
83630
  return {
83613
- "Mod-Enter": () => this.editor.commands.insertPageBreak()
83631
+ "Mod-Enter": () => {
83632
+ return editor.commands.insertPageBreak();
83633
+ }
83614
83634
  };
83615
83635
  },
83616
83636
  /**
@@ -83618,6 +83638,9 @@ ${l}
83618
83638
  */
83619
83639
  addPmPlugins() {
83620
83640
  const editor = this.editor;
83641
+ if (isHeadless(editor)) {
83642
+ return [];
83643
+ }
83621
83644
  let isUpdating = false;
83622
83645
  let shouldUpdate = false;
83623
83646
  let hasInitialized = false;
@@ -83633,7 +83656,7 @@ ${l}
83633
83656
  isReadyToInit: false,
83634
83657
  decorations: DecorationSet.empty,
83635
83658
  isDebugging,
83636
- isEnabled: editor.options.pagination
83659
+ isEnabled: editor.options.pagination && !isHeadless(editor)
83637
83660
  };
83638
83661
  },
83639
83662
  apply(tr, oldState, prevEditorState, newEditorState) {
@@ -83711,6 +83734,7 @@ ${l}
83711
83734
  let previousDecorations = DecorationSet.empty;
83712
83735
  return {
83713
83736
  update: (view) => {
83737
+ if (isHeadless(editor)) return;
83714
83738
  if (!PaginationPluginKey.getState(view.state)?.isEnabled) return;
83715
83739
  if (!shouldUpdate || isUpdating) return;
83716
83740
  const performPaginationUpdate = () => {
@@ -83734,6 +83758,7 @@ ${l}
83734
83758
  },
83735
83759
  props: {
83736
83760
  decorations(state2) {
83761
+ if (isHeadless(editor)) return DecorationSet.empty;
83737
83762
  const pluginState = PaginationPluginKey.getState(state2);
83738
83763
  return pluginState.isEnabled ? pluginState.decorations : DecorationSet.empty;
83739
83764
  }
@@ -84102,7 +84127,7 @@ ${l}
84102
84127
  return void 0;
84103
84128
  };
84104
84129
  const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
84105
- if (editor.options.documentMode !== "editing") return;
84130
+ if (isHeadless(editor) || editor.options.documentMode !== "editing") return;
84106
84131
  editor.setEditable(false, false);
84107
84132
  toggleHeaderFooterEditMode({
84108
84133
  editor,
@@ -84174,6 +84199,7 @@ ${l}
84174
84199
  return actualBreak;
84175
84200
  }
84176
84201
  const onImageLoad = (editor) => {
84202
+ if (isHeadless(editor)) return;
84177
84203
  if (typeof requestAnimationFrame !== "function") return;
84178
84204
  requestAnimationFrame(() => {
84179
84205
  const newTr = editor.view.state.tr;
@@ -85013,9 +85039,9 @@ ${l}
85013
85039
  return {};
85014
85040
  },
85015
85041
  addPmPlugins() {
85016
- const isHeadless = this.editor.options.isHeadless;
85042
+ const isHeadless2 = this.editor.options.isHeadless;
85017
85043
  const hasDocument = typeof document !== "undefined";
85018
- if (isHeadless || !hasDocument) return [];
85044
+ if (isHeadless2 || !hasDocument) return [];
85019
85045
  return [nodeResizer(["image"], this.editor)];
85020
85046
  }
85021
85047
  });
@@ -100160,7 +100186,7 @@ ${style2}
100160
100186
  }
100161
100187
  };
100162
100188
  function adjustPaginationBreaks(editorElem, editor) {
100163
- if (!editorElem.value || !editor?.value?.options?.scale) return;
100189
+ if (!editorElem.value || !editor?.value?.options?.scale || isHeadless(editor)) return;
100164
100190
  const zoom = editor.value.options.scale;
100165
100191
  const bounds = editorElem.value.getBoundingClientRect();
100166
100192
  const breakNodes = editorElem.value.querySelectorAll(".pagination-break-wrapper");
@@ -100594,6 +100620,7 @@ ${style2}
100594
100620
  ...props.options
100595
100621
  });
100596
100622
  editor.value.on("paginationUpdate", () => {
100623
+ if (isHeadless(editor.value)) return;
100597
100624
  adjustPaginationBreaks(editorElem, editor);
100598
100625
  });
100599
100626
  editor.value.on("collaborationReady", () => {
@@ -100752,7 +100779,7 @@ ${style2}
100752
100779
  };
100753
100780
  }
100754
100781
  };
100755
- const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-9d25f5b3"]]);
100782
+ const SuperEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$1$1, [["__scopeId", "data-v-cd3558fe"]]);
100756
100783
  const _hoisted_1$h = ["innerHTML"];
100757
100784
  const _sfc_main$i = {
100758
100785
  __name: "SuperInput",
@@ -118166,7 +118193,7 @@ ${style2}
118166
118193
  this.config.colors = shuffleArray(this.config.colors);
118167
118194
  this.userColorMap = /* @__PURE__ */ new Map();
118168
118195
  this.colorIndex = 0;
118169
- this.version = "0.29.0-next.16";
118196
+ this.version = "0.29.0-next.17";
118170
118197
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
118171
118198
  this.superdocId = config2.superdocId || v4();
118172
118199
  this.colors = this.config.colors;
@@ -120566,7 +120593,7 @@ ${style2}
120566
120593
  value && typeof value === "object" && "byteLength" in value && "byteOffset" in value
120567
120594
  );
120568
120595
  }
120569
- const indexBE8ctcJ1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120596
+ const indexCdXg92JS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120570
120597
  __proto__: null,
120571
120598
  unified
120572
120599
  }, Symbol.toStringTag, { value: "Module" }));