@harbour-enterprises/superdoc 1.11.0-next.21 → 1.11.0-next.22

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.
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, b as computed, r as ref, e as onMounted, f as onUnmounted, o as openBlock, c as createElementBlock, a as createBaseVNode, g as createVNode, u as unref, i as createCommentVNode } from "./vue-DiPLN5sT.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-B5i8s3Gl.es.js";
3
- import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-W9Qomx1w.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-y5bPYBSo.es.js";
3
+ import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-BReDwbRB.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-BkoOkkmT.cjs");
4
- const superdoc = require("./index-DlL8R7hU.cjs");
5
- const index = require("./index-CFOdE-8c.cjs");
4
+ const superdoc = require("./index-DeANZ0Nh.cjs");
5
+ const index = require("./index-BpdDOn7C.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -33800,7 +33800,7 @@ class SuperConverter {
33800
33800
  static getStoredSuperdocVersion(docx) {
33801
33801
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33802
33802
  }
33803
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.11.0-next.21") {
33803
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.11.0-next.22") {
33804
33804
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33805
33805
  }
33806
33806
  /**
@@ -33801,7 +33801,7 @@ class SuperConverter {
33801
33801
  static getStoredSuperdocVersion(docx) {
33802
33802
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33803
33803
  }
33804
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.11.0-next.21") {
33804
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.11.0-next.22") {
33805
33805
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33806
33806
  }
33807
33807
  /**
@@ -1,4 +1,4 @@
1
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as Plugin, j as PluginKey, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$2, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as replaceStep$1, y as canJoin, z as joinPoint, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString } from "./SuperConverter-vUKHON-n.es.js";
1
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as Plugin, j as PluginKey, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$2, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as replaceStep$1, y as canJoin, z as joinPoint, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString } from "./SuperConverter-A279jqWE.es.js";
2
2
  import { j as twipsToInches, m as inchesToTwips, p as ptToTwips, d as linesToTwips, f as twipsToLines, k as pixelsToTwips, z as resolveOpcTargetPath, B as Buffer$3, D as getArrayBufferFromUrl, h as halfPointToPoints, c as twipsToPixels$2, E as convertSizeToCSS, F as inchesToPixels } from "./helpers-BqdwtJE0.es.js";
3
3
  import { p as process$1$2, r as ref, b as computed, c as createElementBlock, F as Fragment$1, U as renderList, O as withModifiers, o as openBlock, Q as normalizeClass, M as toDisplayString, i as createCommentVNode, a as createBaseVNode, V as createApp, e as onMounted, f as onUnmounted, u as unref, S as withDirectives, Y as vModelText, D as nextTick, N as normalizeStyle, B as watch, Z as withKeys, _ as createTextVNode, g as createVNode, h as h$1, $ as readonly, E as getCurrentInstance, l as onBeforeUnmount, s as reactive, m as onBeforeMount, j as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, k as provide, q as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, K as shallowRef, w as watchEffect, J as global$2, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, x as markRaw, P as createBlock, L as withCtx, a9 as useCssVars, W as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-DiPLN5sT.es.js";
4
4
  import "./jszip.min-BCZQ7Wq2.es.js";
@@ -15599,6 +15599,16 @@ const applyRemoteHeaderFooterChanges = (editor, key2, data) => {
15599
15599
  }
15600
15600
  };
15601
15601
  new PluginKey("collaboration");
15602
+ const headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap();
15603
+ const headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet();
15604
+ const registerHeadlessBindingCleanup = (editor, cleanup) => {
15605
+ if (!cleanup || headlessCleanupRegisteredEditors.has(editor)) return;
15606
+ headlessCleanupRegisteredEditors.add(editor);
15607
+ editor.once("destroy", () => {
15608
+ cleanup();
15609
+ headlessCleanupRegisteredEditors.delete(editor);
15610
+ });
15611
+ };
15602
15612
  const Collaboration = Extension.create({
15603
15613
  name: "collaboration",
15604
15614
  priority: 1e3,
@@ -15638,8 +15648,18 @@ const Collaboration = Extension.create({
15638
15648
  }
15639
15649
  });
15640
15650
  });
15651
+ if (this.editor.options.isHeadless) {
15652
+ const cleanup = initHeadlessBinding(this.editor);
15653
+ registerHeadlessBindingCleanup(this.editor, cleanup);
15654
+ }
15641
15655
  return [syncPlugin];
15642
15656
  },
15657
+ onCreate() {
15658
+ if (this.editor.options.isHeadless && this.editor.options.ydoc) {
15659
+ const cleanup = initHeadlessBinding(this.editor);
15660
+ registerHeadlessBindingCleanup(this.editor, cleanup);
15661
+ }
15662
+ },
15643
15663
  addCommands() {
15644
15664
  return {
15645
15665
  addImageToCollaboration: ({ mediaPath, fileData }) => () => {
@@ -15718,6 +15738,93 @@ const generateCollaborationData = async (editor) => {
15718
15738
  await updateYdocDocxData(editor, ydoc);
15719
15739
  return encodeStateAsUpdate(ydoc);
15720
15740
  };
15741
+ const initHeadlessBinding = (editor) => {
15742
+ const existing = headlessBindingStateByEditor.get(editor);
15743
+ if (existing?.cleanup) {
15744
+ return existing.cleanup;
15745
+ }
15746
+ const state = {
15747
+ binding: null,
15748
+ cleanup: null,
15749
+ warnedMissingBinding: false
15750
+ };
15751
+ headlessBindingStateByEditor.set(editor, state);
15752
+ const headlessViewShim = {
15753
+ get state() {
15754
+ return editor.state;
15755
+ },
15756
+ dispatch: (tr) => {
15757
+ editor.dispatch(tr);
15758
+ },
15759
+ hasFocus: () => false,
15760
+ // Minimal DOM stubs required by y-prosemirror's renderSnapshot/undo operations
15761
+ _root: {
15762
+ getSelection: () => null,
15763
+ createRange: () => ({})
15764
+ }
15765
+ };
15766
+ const ensureInitializedBinding = () => {
15767
+ if (!editor.options.ydoc || !editor.state) return null;
15768
+ const syncState = ySyncPluginKey.getState(editor.state);
15769
+ if (!syncState?.binding) {
15770
+ if (!state.warnedMissingBinding) {
15771
+ console.warn("[Collaboration] Headless binding init: no sync state or binding found");
15772
+ state.warnedMissingBinding = true;
15773
+ }
15774
+ return null;
15775
+ }
15776
+ state.warnedMissingBinding = false;
15777
+ const binding = syncState.binding;
15778
+ if (state.binding === binding) {
15779
+ return binding;
15780
+ }
15781
+ binding.initView(headlessViewShim);
15782
+ if (typeof binding._forceRerender === "function") {
15783
+ binding._forceRerender();
15784
+ }
15785
+ if (editor.options.isNewFile) {
15786
+ initializeMetaMap(editor.options.ydoc, editor);
15787
+ }
15788
+ state.binding = binding;
15789
+ return binding;
15790
+ };
15791
+ const transactionHandler = ({ transaction }) => {
15792
+ if (!editor.options.ydoc) return;
15793
+ const meta = transaction.getMeta(ySyncPluginKey);
15794
+ if (meta?.isChangeOrigin) return;
15795
+ const binding = ensureInitializedBinding();
15796
+ if (!binding) return;
15797
+ if (typeof binding._prosemirrorChanged !== "function") return;
15798
+ const addToHistory = transaction.getMeta("addToHistory") !== false;
15799
+ if (!addToHistory) {
15800
+ const undoPluginState = yUndoPluginKey.getState(editor.state);
15801
+ undoPluginState?.undoManager?.stopCapturing?.();
15802
+ }
15803
+ const syncToYjs = () => {
15804
+ const ydoc = editor.options.ydoc;
15805
+ if (!ydoc) return;
15806
+ ydoc.transact((tr) => {
15807
+ tr?.meta?.set?.("addToHistory", addToHistory);
15808
+ binding._prosemirrorChanged(editor.state.doc);
15809
+ }, ySyncPluginKey);
15810
+ };
15811
+ if (typeof binding.mux === "function") {
15812
+ binding.mux(syncToYjs);
15813
+ return;
15814
+ }
15815
+ syncToYjs();
15816
+ };
15817
+ editor.on("transaction", transactionHandler);
15818
+ ensureInitializedBinding();
15819
+ state.cleanup = () => {
15820
+ editor.off("transaction", transactionHandler);
15821
+ if (headlessBindingStateByEditor.get(editor) === state) {
15822
+ headlessBindingStateByEditor.delete(editor);
15823
+ }
15824
+ headlessCleanupRegisteredEditors.delete(editor);
15825
+ };
15826
+ return state.cleanup;
15827
+ };
15721
15828
  const isHighContrastMode = ref(false);
15722
15829
  function useHighContrastMode() {
15723
15830
  const setHighContrastMode = (value) => {
@@ -16785,7 +16892,7 @@ const canUseDOM = () => {
16785
16892
  return false;
16786
16893
  }
16787
16894
  };
16788
- const summaryVersion = "1.11.0-next.21";
16895
+ const summaryVersion = "1.11.0-next.22";
16789
16896
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
16790
16897
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
16791
16898
  function mapAttributes(attrs) {
@@ -19540,7 +19647,7 @@ class Editor extends EventEmitter {
19540
19647
  * Process collaboration migrations
19541
19648
  */
19542
19649
  processCollaborationMigrations() {
19543
- console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.21");
19650
+ console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.22");
19544
19651
  if (!this.options.ydoc) return;
19545
19652
  const metaMap = this.options.ydoc.getMap("meta");
19546
19653
  let docVersion = metaMap.get("version");
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_converter = require("./SuperConverter-CxneyoRE.cjs");
2
+ const superEditor_converter = require("./SuperConverter-DDUENMZ4.cjs");
3
3
  const helpers$1 = require("./helpers-OFep8CYR.cjs");
4
4
  const vue = require("./vue-BkoOkkmT.cjs");
5
5
  require("./jszip.min-oAFpNMh5.cjs");
@@ -15616,6 +15616,16 @@ const applyRemoteHeaderFooterChanges = (editor, key2, data) => {
15616
15616
  }
15617
15617
  };
15618
15618
  new superEditor_converter.PluginKey("collaboration");
15619
+ const headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap();
15620
+ const headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet();
15621
+ const registerHeadlessBindingCleanup = (editor, cleanup) => {
15622
+ if (!cleanup || headlessCleanupRegisteredEditors.has(editor)) return;
15623
+ headlessCleanupRegisteredEditors.add(editor);
15624
+ editor.once("destroy", () => {
15625
+ cleanup();
15626
+ headlessCleanupRegisteredEditors.delete(editor);
15627
+ });
15628
+ };
15619
15629
  const Collaboration = Extension.create({
15620
15630
  name: "collaboration",
15621
15631
  priority: 1e3,
@@ -15655,8 +15665,18 @@ const Collaboration = Extension.create({
15655
15665
  }
15656
15666
  });
15657
15667
  });
15668
+ if (this.editor.options.isHeadless) {
15669
+ const cleanup = initHeadlessBinding(this.editor);
15670
+ registerHeadlessBindingCleanup(this.editor, cleanup);
15671
+ }
15658
15672
  return [syncPlugin];
15659
15673
  },
15674
+ onCreate() {
15675
+ if (this.editor.options.isHeadless && this.editor.options.ydoc) {
15676
+ const cleanup = initHeadlessBinding(this.editor);
15677
+ registerHeadlessBindingCleanup(this.editor, cleanup);
15678
+ }
15679
+ },
15660
15680
  addCommands() {
15661
15681
  return {
15662
15682
  addImageToCollaboration: ({ mediaPath, fileData }) => () => {
@@ -15735,6 +15755,93 @@ const generateCollaborationData = async (editor) => {
15735
15755
  await updateYdocDocxData(editor, ydoc);
15736
15756
  return Y$1.encodeStateAsUpdate(ydoc);
15737
15757
  };
15758
+ const initHeadlessBinding = (editor) => {
15759
+ const existing = headlessBindingStateByEditor.get(editor);
15760
+ if (existing?.cleanup) {
15761
+ return existing.cleanup;
15762
+ }
15763
+ const state = {
15764
+ binding: null,
15765
+ cleanup: null,
15766
+ warnedMissingBinding: false
15767
+ };
15768
+ headlessBindingStateByEditor.set(editor, state);
15769
+ const headlessViewShim = {
15770
+ get state() {
15771
+ return editor.state;
15772
+ },
15773
+ dispatch: (tr) => {
15774
+ editor.dispatch(tr);
15775
+ },
15776
+ hasFocus: () => false,
15777
+ // Minimal DOM stubs required by y-prosemirror's renderSnapshot/undo operations
15778
+ _root: {
15779
+ getSelection: () => null,
15780
+ createRange: () => ({})
15781
+ }
15782
+ };
15783
+ const ensureInitializedBinding = () => {
15784
+ if (!editor.options.ydoc || !editor.state) return null;
15785
+ const syncState = ySyncPluginKey.getState(editor.state);
15786
+ if (!syncState?.binding) {
15787
+ if (!state.warnedMissingBinding) {
15788
+ console.warn("[Collaboration] Headless binding init: no sync state or binding found");
15789
+ state.warnedMissingBinding = true;
15790
+ }
15791
+ return null;
15792
+ }
15793
+ state.warnedMissingBinding = false;
15794
+ const binding = syncState.binding;
15795
+ if (state.binding === binding) {
15796
+ return binding;
15797
+ }
15798
+ binding.initView(headlessViewShim);
15799
+ if (typeof binding._forceRerender === "function") {
15800
+ binding._forceRerender();
15801
+ }
15802
+ if (editor.options.isNewFile) {
15803
+ initializeMetaMap(editor.options.ydoc, editor);
15804
+ }
15805
+ state.binding = binding;
15806
+ return binding;
15807
+ };
15808
+ const transactionHandler = ({ transaction }) => {
15809
+ if (!editor.options.ydoc) return;
15810
+ const meta = transaction.getMeta(ySyncPluginKey);
15811
+ if (meta?.isChangeOrigin) return;
15812
+ const binding = ensureInitializedBinding();
15813
+ if (!binding) return;
15814
+ if (typeof binding._prosemirrorChanged !== "function") return;
15815
+ const addToHistory = transaction.getMeta("addToHistory") !== false;
15816
+ if (!addToHistory) {
15817
+ const undoPluginState = yUndoPluginKey.getState(editor.state);
15818
+ undoPluginState?.undoManager?.stopCapturing?.();
15819
+ }
15820
+ const syncToYjs = () => {
15821
+ const ydoc = editor.options.ydoc;
15822
+ if (!ydoc) return;
15823
+ ydoc.transact((tr) => {
15824
+ tr?.meta?.set?.("addToHistory", addToHistory);
15825
+ binding._prosemirrorChanged(editor.state.doc);
15826
+ }, ySyncPluginKey);
15827
+ };
15828
+ if (typeof binding.mux === "function") {
15829
+ binding.mux(syncToYjs);
15830
+ return;
15831
+ }
15832
+ syncToYjs();
15833
+ };
15834
+ editor.on("transaction", transactionHandler);
15835
+ ensureInitializedBinding();
15836
+ state.cleanup = () => {
15837
+ editor.off("transaction", transactionHandler);
15838
+ if (headlessBindingStateByEditor.get(editor) === state) {
15839
+ headlessBindingStateByEditor.delete(editor);
15840
+ }
15841
+ headlessCleanupRegisteredEditors.delete(editor);
15842
+ };
15843
+ return state.cleanup;
15844
+ };
15738
15845
  const isHighContrastMode = vue.ref(false);
15739
15846
  function useHighContrastMode() {
15740
15847
  const setHighContrastMode = (value) => {
@@ -16802,7 +16909,7 @@ const canUseDOM = () => {
16802
16909
  return false;
16803
16910
  }
16804
16911
  };
16805
- const summaryVersion = "1.11.0-next.21";
16912
+ const summaryVersion = "1.11.0-next.22";
16806
16913
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
16807
16914
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
16808
16915
  function mapAttributes(attrs) {
@@ -19557,7 +19664,7 @@ class Editor extends EventEmitter {
19557
19664
  * Process collaboration migrations
19558
19665
  */
19559
19666
  processCollaborationMigrations() {
19560
- console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.21");
19667
+ console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.22");
19561
19668
  if (!this.options.ydoc) return;
19562
19669
  const metaMap = this.options.ydoc.getMap("meta");
19563
19670
  let docVersion = metaMap.get("version");
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const index = require("./index-CFOdE-8c.cjs");
2
+ const index = require("./index-BpdDOn7C.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  require("./helpers-OFep8CYR.cjs");
5
- require("./SuperConverter-CxneyoRE.cjs");
5
+ require("./SuperConverter-DDUENMZ4.cjs");
6
6
  const eventemitter3 = require("./eventemitter3-D-UiF04J.cjs");
7
7
  const vue = require("./vue-BkoOkkmT.cjs");
8
8
  require("./jszip.min-oAFpNMh5.cjs");
@@ -7805,7 +7805,7 @@ const _sfc_main = {
7805
7805
  __name: "SuperDoc",
7806
7806
  emits: ["selection-update"],
7807
7807
  setup(__props, { emit: __emit }) {
7808
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-GjMC3bao.cjs")));
7808
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dqmp_7zZ.cjs")));
7809
7809
  const superdocStore = useSuperdocStore();
7810
7810
  const commentsStore = useCommentsStore();
7811
7811
  const {
@@ -8797,7 +8797,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8797
8797
  this.config.colors = shuffleArray(this.config.colors);
8798
8798
  this.userColorMap = /* @__PURE__ */ new Map();
8799
8799
  this.colorIndex = 0;
8800
- this.version = "1.11.0-next.21";
8800
+ this.version = "1.11.0-next.22";
8801
8801
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8802
8802
  this.superdocId = config.superdocId || uuid.v4();
8803
8803
  this.colors = this.config.colors;
@@ -1,7 +1,7 @@
1
- import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, l as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, f as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, d as SuperInput, aG as vClickOutside, P as PresentationEditor, c as SuperEditor, A as AIWriter, aH as NConfigProvider, e as SuperToolbar } from "./index-W9Qomx1w.es.js";
1
+ import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, l as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, f as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, d as SuperInput, aG as vClickOutside, P as PresentationEditor, c as SuperEditor, A as AIWriter, aH as NConfigProvider, e as SuperToolbar } from "./index-BReDwbRB.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import "./helpers-BqdwtJE0.es.js";
4
- import "./SuperConverter-vUKHON-n.es.js";
4
+ import "./SuperConverter-A279jqWE.es.js";
5
5
  import { E as EventEmitter } from "./eventemitter3-DdGu2UnW.es.js";
6
6
  import { j as inject, k as provide, b as computed, l as onBeforeUnmount, p as process$1, m as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, n as TransitionGroup, w as watchEffect, r as ref, e as onMounted, q as Teleport, F as Fragment, s as reactive, v as effectScope, x as markRaw, y as toRaw, z as isRef, A as isReactive, B as watch, u as unref, C as hasInjectionContext, D as nextTick, E as getCurrentInstance, G as getCurrentScope, H as onScopeDispose, I as toRefs, J as global, K as shallowRef, o as openBlock, c as createElementBlock, g as createVNode, L as withCtx, a as createBaseVNode, M as toDisplayString, N as normalizeStyle, i as createCommentVNode, O as withModifiers, P as createBlock, Q as normalizeClass, R as resolveDirective, S as withDirectives, U as renderList, V as createApp, W as resolveDynamicComponent, X as defineAsyncComponent } from "./vue-DiPLN5sT.es.js";
7
7
  import "./jszip.min-BCZQ7Wq2.es.js";
@@ -7788,7 +7788,7 @@ const _sfc_main = {
7788
7788
  __name: "SuperDoc",
7789
7789
  emits: ["selection-update"],
7790
7790
  setup(__props, { emit: __emit }) {
7791
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CGbxSJtS.es.js"));
7791
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-C388QrUH.es.js"));
7792
7792
  const superdocStore = useSuperdocStore();
7793
7793
  const commentsStore = useCommentsStore();
7794
7794
  const {
@@ -8780,7 +8780,7 @@ class SuperDoc extends EventEmitter {
8780
8780
  this.config.colors = shuffleArray(this.config.colors);
8781
8781
  this.userColorMap = /* @__PURE__ */ new Map();
8782
8782
  this.colorIndex = 0;
8783
- this.version = "1.11.0-next.21";
8783
+ this.version = "1.11.0-next.22";
8784
8784
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8785
8785
  this.superdocId = config.superdocId || v4();
8786
8786
  this.colors = this.config.colors;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/helpers-OFep8CYR.cjs");
4
- const superEditor_converter = require("../chunks/SuperConverter-CxneyoRE.cjs");
4
+ const superEditor_converter = require("../chunks/SuperConverter-DDUENMZ4.cjs");
5
5
  require("../chunks/uuid-R7L08bOx.cjs");
6
6
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,5 +1,5 @@
1
1
  import "../chunks/helpers-BqdwtJE0.es.js";
2
- import { S } from "../chunks/SuperConverter-vUKHON-n.es.js";
2
+ import { S } from "../chunks/SuperConverter-A279jqWE.es.js";
3
3
  import "../chunks/uuid-CjlX8hrF.es.js";
4
4
  export {
5
5
  S as SuperConverter
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../../src/extensions/collaboration/collaboration.js"],"names":[],"mappings":"AAMA,oDAAqE;AAErE;;;;;0BAiEG;AAEI,gEAQN;AAEM,gEASN;AAwDM,6FAKN;0BA1JyB,mBAAmB;0BADnB,gBAAgB"}
1
+ {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../../src/extensions/collaboration/collaboration.js"],"names":[],"mappings":"AAMA,oDAAqE;AAcrE;;;;;0BAgFG;AAEI,gEAQN;AAEM,gEASN;AAwDM,6FAKN;0BArLyB,mBAAmB;0BADnB,gBAAgB"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-CFOdE-8c.cjs");
3
+ const index = require("./chunks/index-BpdDOn7C.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-BkoOkkmT.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-CxneyoRE.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-DDUENMZ4.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { N as Node, M as Mark } from "./chunks/index-W9Qomx1w.es.js";
2
- import { A, a, C, E, b, P, S, _, c, d, e, T, f, i, g, h, j, k, l, m, n } from "./chunks/index-W9Qomx1w.es.js";
1
+ import { N as Node, M as Mark } from "./chunks/index-BReDwbRB.es.js";
2
+ import { A, a, C, E, b, P, S, _, c, d, e, T, f, i, g, h, j, k, l, m, n } from "./chunks/index-BReDwbRB.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, o as openBlock, c as createElementBlock, a as createBaseVNode } from "./chunks/vue-DiPLN5sT.es.js";
6
- import { S as S2, r } from "./chunks/SuperConverter-vUKHON-n.es.js";
6
+ import { S as S2, r } from "./chunks/SuperConverter-A279jqWE.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-CFOdE-8c.cjs");
4
- const superdoc = require("./chunks/index-DlL8R7hU.cjs");
3
+ const index = require("./chunks/index-BpdDOn7C.cjs");
4
+ const superdoc = require("./chunks/index-DeANZ0Nh.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
- const superEditor_converter = require("./chunks/SuperConverter-CxneyoRE.cjs");
6
+ const superEditor_converter = require("./chunks/SuperConverter-DDUENMZ4.cjs");
7
7
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
8
8
  require("./chunks/helpers-OFep8CYR.cjs");
9
9
  require("./chunks/jszip.min-oAFpNMh5.cjs");
@@ -1,7 +1,7 @@
1
- import { a, E, b, S, i, ay, k, m, n } from "./chunks/index-W9Qomx1w.es.js";
2
- import { D, H, P, S as S2, c, g } from "./chunks/index-B5i8s3Gl.es.js";
1
+ import { a, E, b, S, i, ay, k, m, n } from "./chunks/index-BReDwbRB.es.js";
2
+ import { D, H, P, S as S2, c, g } from "./chunks/index-y5bPYBSo.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
- import { S as S3, r } from "./chunks/SuperConverter-vUKHON-n.es.js";
4
+ import { S as S3, r } from "./chunks/SuperConverter-A279jqWE.es.js";
5
5
  import { createZip } from "./super-editor/file-zipper.es.js";
6
6
  import "./chunks/helpers-BqdwtJE0.es.js";
7
7
  import "./chunks/jszip.min-BCZQ7Wq2.es.js";
@@ -37505,7 +37505,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37505
37505
  static getStoredSuperdocVersion(docx) {
37506
37506
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
37507
37507
  }
37508
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.11.0-next.21") {
37508
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.11.0-next.22") {
37509
37509
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
37510
37510
  }
37511
37511
  /**
@@ -55710,6 +55710,16 @@ ${err.toString()}`);
55710
55710
  }
55711
55711
  };
55712
55712
  new PluginKey("collaboration");
55713
+ const headlessBindingStateByEditor = /* @__PURE__ */ new WeakMap();
55714
+ const headlessCleanupRegisteredEditors = /* @__PURE__ */ new WeakSet();
55715
+ const registerHeadlessBindingCleanup = (editor, cleanup) => {
55716
+ if (!cleanup || headlessCleanupRegisteredEditors.has(editor)) return;
55717
+ headlessCleanupRegisteredEditors.add(editor);
55718
+ editor.once("destroy", () => {
55719
+ cleanup();
55720
+ headlessCleanupRegisteredEditors.delete(editor);
55721
+ });
55722
+ };
55713
55723
  const Collaboration = Extension.create({
55714
55724
  name: "collaboration",
55715
55725
  priority: 1e3,
@@ -55749,8 +55759,18 @@ ${err.toString()}`);
55749
55759
  }
55750
55760
  });
55751
55761
  });
55762
+ if (this.editor.options.isHeadless) {
55763
+ const cleanup = initHeadlessBinding(this.editor);
55764
+ registerHeadlessBindingCleanup(this.editor, cleanup);
55765
+ }
55752
55766
  return [syncPlugin];
55753
55767
  },
55768
+ onCreate() {
55769
+ if (this.editor.options.isHeadless && this.editor.options.ydoc) {
55770
+ const cleanup = initHeadlessBinding(this.editor);
55771
+ registerHeadlessBindingCleanup(this.editor, cleanup);
55772
+ }
55773
+ },
55754
55774
  addCommands() {
55755
55775
  return {
55756
55776
  addImageToCollaboration: ({ mediaPath, fileData }) => () => {
@@ -55829,6 +55849,93 @@ ${err.toString()}`);
55829
55849
  await updateYdocDocxData(editor, ydoc);
55830
55850
  return Y$1.encodeStateAsUpdate(ydoc);
55831
55851
  };
55852
+ const initHeadlessBinding = (editor) => {
55853
+ const existing = headlessBindingStateByEditor.get(editor);
55854
+ if (existing?.cleanup) {
55855
+ return existing.cleanup;
55856
+ }
55857
+ const state = {
55858
+ binding: null,
55859
+ cleanup: null,
55860
+ warnedMissingBinding: false
55861
+ };
55862
+ headlessBindingStateByEditor.set(editor, state);
55863
+ const headlessViewShim = {
55864
+ get state() {
55865
+ return editor.state;
55866
+ },
55867
+ dispatch: (tr) => {
55868
+ editor.dispatch(tr);
55869
+ },
55870
+ hasFocus: () => false,
55871
+ // Minimal DOM stubs required by y-prosemirror's renderSnapshot/undo operations
55872
+ _root: {
55873
+ getSelection: () => null,
55874
+ createRange: () => ({})
55875
+ }
55876
+ };
55877
+ const ensureInitializedBinding = () => {
55878
+ if (!editor.options.ydoc || !editor.state) return null;
55879
+ const syncState = ySyncPluginKey.getState(editor.state);
55880
+ if (!syncState?.binding) {
55881
+ if (!state.warnedMissingBinding) {
55882
+ console.warn("[Collaboration] Headless binding init: no sync state or binding found");
55883
+ state.warnedMissingBinding = true;
55884
+ }
55885
+ return null;
55886
+ }
55887
+ state.warnedMissingBinding = false;
55888
+ const binding = syncState.binding;
55889
+ if (state.binding === binding) {
55890
+ return binding;
55891
+ }
55892
+ binding.initView(headlessViewShim);
55893
+ if (typeof binding._forceRerender === "function") {
55894
+ binding._forceRerender();
55895
+ }
55896
+ if (editor.options.isNewFile) {
55897
+ initializeMetaMap(editor.options.ydoc, editor);
55898
+ }
55899
+ state.binding = binding;
55900
+ return binding;
55901
+ };
55902
+ const transactionHandler = ({ transaction }) => {
55903
+ if (!editor.options.ydoc) return;
55904
+ const meta2 = transaction.getMeta(ySyncPluginKey);
55905
+ if (meta2?.isChangeOrigin) return;
55906
+ const binding = ensureInitializedBinding();
55907
+ if (!binding) return;
55908
+ if (typeof binding._prosemirrorChanged !== "function") return;
55909
+ const addToHistory = transaction.getMeta("addToHistory") !== false;
55910
+ if (!addToHistory) {
55911
+ const undoPluginState = yUndoPluginKey.getState(editor.state);
55912
+ undoPluginState?.undoManager?.stopCapturing?.();
55913
+ }
55914
+ const syncToYjs = () => {
55915
+ const ydoc = editor.options.ydoc;
55916
+ if (!ydoc) return;
55917
+ ydoc.transact((tr) => {
55918
+ tr?.meta?.set?.("addToHistory", addToHistory);
55919
+ binding._prosemirrorChanged(editor.state.doc);
55920
+ }, ySyncPluginKey);
55921
+ };
55922
+ if (typeof binding.mux === "function") {
55923
+ binding.mux(syncToYjs);
55924
+ return;
55925
+ }
55926
+ syncToYjs();
55927
+ };
55928
+ editor.on("transaction", transactionHandler);
55929
+ ensureInitializedBinding();
55930
+ state.cleanup = () => {
55931
+ editor.off("transaction", transactionHandler);
55932
+ if (headlessBindingStateByEditor.get(editor) === state) {
55933
+ headlessBindingStateByEditor.delete(editor);
55934
+ }
55935
+ headlessCleanupRegisteredEditors.delete(editor);
55936
+ };
55937
+ return state.cleanup;
55938
+ };
55832
55939
  // @__NO_SIDE_EFFECTS__
55833
55940
  function makeMap(str) {
55834
55941
  const map2 = /* @__PURE__ */ Object.create(null);
@@ -64748,7 +64855,7 @@ ${err.toString()}`);
64748
64855
  return false;
64749
64856
  }
64750
64857
  };
64751
- const summaryVersion = "1.11.0-next.21";
64858
+ const summaryVersion = "1.11.0-next.22";
64752
64859
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
64753
64860
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
64754
64861
  function mapAttributes(attrs) {
@@ -67504,7 +67611,7 @@ ${err.toString()}`);
67504
67611
  * Process collaboration migrations
67505
67612
  */
67506
67613
  processCollaborationMigrations() {
67507
- console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.21");
67614
+ console.debug("[checkVersionMigrations] Current editor version", "1.11.0-next.22");
67508
67615
  if (!this.options.ydoc) return;
67509
67616
  const metaMap = this.options.ydoc.getMap("meta");
67510
67617
  let docVersion = metaMap.get("version");
@@ -152297,7 +152404,7 @@ ${reason}`);
152297
152404
  this.config.colors = shuffleArray(this.config.colors);
152298
152405
  this.userColorMap = /* @__PURE__ */ new Map();
152299
152406
  this.colorIndex = 0;
152300
- this.version = "1.11.0-next.21";
152407
+ this.version = "1.11.0-next.22";
152301
152408
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
152302
152409
  this.superdocId = config2.superdocId || v4();
152303
152410
  this.colors = this.config.colors;