@harbour-enterprises/superdoc 0.11.59 → 0.11.60

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 (31) hide show
  1. package/dist/chunks/{index-iv-kAVLp.cjs → index-B1MhwjTC.cjs} +2 -2
  2. package/dist/chunks/{index-Bok8hAYK.es.js → index-BrSjd1Id.es.js} +1 -1
  3. package/dist/chunks/{index-BMaqSK4V.cjs → index-CMBtuT02.cjs} +1 -1
  4. package/dist/chunks/{index-TEuKY2Tw.es.js → index-SKpROzLW.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-CcLjgzVN.cjs → super-editor.es-6RJfgkuP.cjs} +52 -3
  6. package/dist/chunks/{super-editor.es-GCGh72cA.es.js → super-editor.es-CWoldIVO.es.js} +52 -3
  7. package/dist/chunks/{url-ETipSgh6.es.js → url-CAZQTNP3.es.js} +1 -1
  8. package/dist/chunks/{url-5p0aHHfv.cjs → url-DuggQ5JR.cjs} +1 -1
  9. package/dist/chunks/{xml-js-zDoWuw54.cjs → xml-js-B7Vccv2s.cjs} +89 -75
  10. package/dist/chunks/{xml-js-76kJDM0_.es.js → xml-js-BV-kCPOA.es.js} +89 -75
  11. package/dist/super-editor/ai-writer.es.js +2 -2
  12. package/dist/super-editor/chunks/{converter-CxUKSS50.js → converter-Dptp_3H8.js} +2 -2
  13. package/dist/super-editor/chunks/{docx-zipper-C8L5bK_c.js → docx-zipper-BNTwjTIm.js} +1 -1
  14. package/dist/super-editor/chunks/{editor-D562_uCU.js → editor-Denpr49N.js} +52 -3
  15. package/dist/super-editor/chunks/{toolbar-DXGphEz9.js → toolbar-DTVYQvE4.js} +2 -2
  16. package/dist/super-editor/converter.es.js +1 -1
  17. package/dist/super-editor/docx-zipper.es.js +2 -2
  18. package/dist/super-editor/editor.es.js +3 -3
  19. package/dist/super-editor/extensions/collaboration/collaboration-helpers.d.ts +2 -0
  20. package/dist/super-editor/extensions/collaboration/collaboration-helpers.d.ts.map +1 -0
  21. package/dist/super-editor/extensions/collaboration/collaboration.d.ts.map +1 -1
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/super-editor.es.js +6 -6
  24. package/dist/super-editor/toolbar.es.js +2 -2
  25. package/dist/super-editor.cjs +1 -1
  26. package/dist/super-editor.es.js +1 -1
  27. package/dist/superdoc.cjs +5 -5
  28. package/dist/superdoc.es.js +6 -6
  29. package/dist/superdoc.umd.js +53 -4
  30. package/dist/superdoc.umd.js.map +1 -1
  31. package/package.json +1 -1
@@ -456,7 +456,7 @@ var type = TypeError;
456
456
  var uri = URIError;
457
457
  var abs$1 = Math.abs;
458
458
  var floor$1 = Math.floor;
459
- var max$2 = Math.max;
459
+ var max$1 = Math.max;
460
460
  var min$1 = Math.min;
461
461
  var pow$1 = Math.pow;
462
462
  var round$1 = Math.round;
@@ -516,77 +516,91 @@ function requireHasSymbols() {
516
516
  var Reflect_getPrototypeOf = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
517
517
  var $Object$2 = esObjectAtoms;
518
518
  var Object_getPrototypeOf = $Object$2.getPrototypeOf || null;
519
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
520
- var toStr$3 = Object.prototype.toString;
521
- var max$1 = Math.max;
522
- var funcType = "[object Function]";
523
- var concatty = function concatty2(a, b) {
524
- var arr = [];
525
- for (var i = 0; i < a.length; i += 1) {
526
- arr[i] = a[i];
527
- }
528
- for (var j = 0; j < b.length; j += 1) {
529
- arr[j + a.length] = b[j];
530
- }
531
- return arr;
532
- };
533
- var slicy = function slicy2(arrLike, offset) {
534
- var arr = [];
535
- for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
536
- arr[j] = arrLike[i];
537
- }
538
- return arr;
539
- };
540
- var joiny = function(arr, joiner) {
541
- var str = "";
542
- for (var i = 0; i < arr.length; i += 1) {
543
- str += arr[i];
544
- if (i + 1 < arr.length) {
545
- str += joiner;
519
+ var implementation;
520
+ var hasRequiredImplementation;
521
+ function requireImplementation() {
522
+ if (hasRequiredImplementation) return implementation;
523
+ hasRequiredImplementation = 1;
524
+ var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
525
+ var toStr2 = Object.prototype.toString;
526
+ var max2 = Math.max;
527
+ var funcType = "[object Function]";
528
+ var concatty = function concatty2(a, b) {
529
+ var arr = [];
530
+ for (var i = 0; i < a.length; i += 1) {
531
+ arr[i] = a[i];
532
+ }
533
+ for (var j = 0; j < b.length; j += 1) {
534
+ arr[j + a.length] = b[j];
535
+ }
536
+ return arr;
537
+ };
538
+ var slicy = function slicy2(arrLike, offset) {
539
+ var arr = [];
540
+ for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
541
+ arr[j] = arrLike[i];
546
542
  }
547
- }
548
- return str;
549
- };
550
- var implementation$1 = function bind(that) {
551
- var target = this;
552
- if (typeof target !== "function" || toStr$3.apply(target) !== funcType) {
553
- throw new TypeError(ERROR_MESSAGE + target);
554
- }
555
- var args = slicy(arguments, 1);
556
- var bound;
557
- var binder = function() {
558
- if (this instanceof bound) {
559
- var result = target.apply(
560
- this,
561
- concatty(args, arguments)
562
- );
563
- if (Object(result) === result) {
564
- return result;
543
+ return arr;
544
+ };
545
+ var joiny = function(arr, joiner) {
546
+ var str = "";
547
+ for (var i = 0; i < arr.length; i += 1) {
548
+ str += arr[i];
549
+ if (i + 1 < arr.length) {
550
+ str += joiner;
565
551
  }
566
- return this;
567
552
  }
568
- return target.apply(
569
- that,
570
- concatty(args, arguments)
571
- );
553
+ return str;
572
554
  };
573
- var boundLength = max$1(0, target.length - args.length);
574
- var boundArgs = [];
575
- for (var i = 0; i < boundLength; i++) {
576
- boundArgs[i] = "$" + i;
577
- }
578
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
579
- if (target.prototype) {
580
- var Empty = function Empty2() {
555
+ implementation = function bind2(that) {
556
+ var target = this;
557
+ if (typeof target !== "function" || toStr2.apply(target) !== funcType) {
558
+ throw new TypeError(ERROR_MESSAGE + target);
559
+ }
560
+ var args = slicy(arguments, 1);
561
+ var bound;
562
+ var binder = function() {
563
+ if (this instanceof bound) {
564
+ var result = target.apply(
565
+ this,
566
+ concatty(args, arguments)
567
+ );
568
+ if (Object(result) === result) {
569
+ return result;
570
+ }
571
+ return this;
572
+ }
573
+ return target.apply(
574
+ that,
575
+ concatty(args, arguments)
576
+ );
581
577
  };
582
- Empty.prototype = target.prototype;
583
- bound.prototype = new Empty();
584
- Empty.prototype = null;
585
- }
586
- return bound;
587
- };
588
- var implementation = implementation$1;
589
- var functionBind = Function.prototype.bind || implementation;
578
+ var boundLength = max2(0, target.length - args.length);
579
+ var boundArgs = [];
580
+ for (var i = 0; i < boundLength; i++) {
581
+ boundArgs[i] = "$" + i;
582
+ }
583
+ bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
584
+ if (target.prototype) {
585
+ var Empty = function Empty2() {
586
+ };
587
+ Empty.prototype = target.prototype;
588
+ bound.prototype = new Empty();
589
+ Empty.prototype = null;
590
+ }
591
+ return bound;
592
+ };
593
+ return implementation;
594
+ }
595
+ var functionBind;
596
+ var hasRequiredFunctionBind;
597
+ function requireFunctionBind() {
598
+ if (hasRequiredFunctionBind) return functionBind;
599
+ hasRequiredFunctionBind = 1;
600
+ var implementation2 = requireImplementation();
601
+ functionBind = Function.prototype.bind || implementation2;
602
+ return functionBind;
603
+ }
590
604
  var functionCall;
591
605
  var hasRequiredFunctionCall;
592
606
  function requireFunctionCall() {
@@ -604,12 +618,12 @@ function requireFunctionApply() {
604
618
  return functionApply;
605
619
  }
606
620
  var reflectApply$1 = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
607
- var bind$3 = functionBind;
621
+ var bind$3 = requireFunctionBind();
608
622
  var $apply$2 = requireFunctionApply();
609
623
  var $call$2 = requireFunctionCall();
610
624
  var $reflectApply = reflectApply$1;
611
625
  var actualApply$1 = $reflectApply || bind$3.call($call$2, $apply$2);
612
- var bind$2 = functionBind;
626
+ var bind$2 = requireFunctionBind();
613
627
  var $TypeError$4 = type;
614
628
  var $call$1 = requireFunctionCall();
615
629
  var $actualApply = actualApply$1;
@@ -663,8 +677,8 @@ function requireHasown() {
663
677
  hasRequiredHasown = 1;
664
678
  var call = Function.prototype.call;
665
679
  var $hasOwn = Object.prototype.hasOwnProperty;
666
- var bind3 = functionBind;
667
- hasown = bind3.call(call, $hasOwn);
680
+ var bind2 = requireFunctionBind();
681
+ hasown = bind2.call(call, $hasOwn);
668
682
  return hasown;
669
683
  }
670
684
  var undefined$1;
@@ -678,7 +692,7 @@ var $TypeError$3 = type;
678
692
  var $URIError = uri;
679
693
  var abs = abs$1;
680
694
  var floor = floor$1;
681
- var max = max$2;
695
+ var max = max$1;
682
696
  var min = min$1;
683
697
  var pow = pow$1;
684
698
  var round = round$1;
@@ -883,7 +897,7 @@ var LEGACY_ALIASES = {
883
897
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
884
898
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
885
899
  };
886
- var bind$1 = functionBind;
900
+ var bind$1 = requireFunctionBind();
887
901
  var hasOwn$1 = requireHasown();
888
902
  var $concat = bind$1.call($call, Array.prototype.concat);
889
903
  var $spliceApply = bind$1.call($apply$1, Array.prototype.splice);
@@ -1425,11 +1439,11 @@ var setFunctionLength = function setFunctionLength2(fn2, length) {
1425
1439
  }
1426
1440
  return fn2;
1427
1441
  };
1428
- var bind2 = functionBind;
1442
+ var bind = requireFunctionBind();
1429
1443
  var $apply = requireFunctionApply();
1430
1444
  var actualApply = actualApply$1;
1431
1445
  var applyBind = function applyBind2() {
1432
- return actualApply(bind2, $apply, arguments);
1446
+ return actualApply(bind, $apply, arguments);
1433
1447
  };
1434
1448
  (function(module) {
1435
1449
  var setFunctionLength$1 = setFunctionLength;
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-CxUKSS50.js";
3
- import { _ as _export_sfc } from "./chunks/editor-D562_uCU.js";
2
+ import { T as TextSelection } from "./chunks/converter-Dptp_3H8.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-Denpr49N.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -23229,7 +23229,7 @@ const _SuperConverter = class _SuperConverter {
23229
23229
  return;
23230
23230
  }
23231
23231
  }
23232
- static updateDocumentVersion(docx = this.convertedXml, version = "0.11.59") {
23232
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.11.60") {
23233
23233
  const customLocation = "docProps/custom.xml";
23234
23234
  if (!docx[customLocation]) {
23235
23235
  docx[customLocation] = generateCustomXml();
@@ -23582,7 +23582,7 @@ function storeSuperdocVersion(docx) {
23582
23582
  function generateCustomXml() {
23583
23583
  return DEFAULT_CUSTOM_XML;
23584
23584
  }
23585
- function generateSuperdocVersion(pid = 2, version = "0.11.59") {
23585
+ function generateSuperdocVersion(pid = 2, version = "0.11.60") {
23586
23586
  return {
23587
23587
  type: "element",
23588
23588
  name: "property",
@@ -1,4 +1,4 @@
1
- import { x as process$1, a0 as commonjsGlobal, B as Buffer, a1 as getDefaultExportFromCjs, a2 as getContentTypesFromXml, a3 as xmljs } from "./converter-CxUKSS50.js";
1
+ import { x as process$1, a0 as commonjsGlobal, B as Buffer, a1 as getDefaultExportFromCjs, a2 as getContentTypesFromXml, a3 as xmljs } from "./converter-Dptp_3H8.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, 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, T as TextSelection, 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 parseSizeUnit, V as getLineHeightValueString, W as toKebabCase, X as kebabCase, Y as getColStyleDeclaration, Z as SelectionRange, _ as Transform, $ as createColGroup } from "./converter-CxUKSS50.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, c as callOrGet, i as isEmptyObject, S as Schema$1, 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, T as TextSelection, 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 parseSizeUnit, V as getLineHeightValueString, W as toKebabCase, X as kebabCase, Y as getColStyleDeclaration, Z as SelectionRange, _ as Transform, $ as createColGroup } from "./converter-Dptp_3H8.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-C8L5bK_c.js";
17
+ import { D as DocxZipper } from "./docx-zipper-BNTwjTIm.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -14179,7 +14179,7 @@ const _Editor = class _Editor extends EventEmitter {
14179
14179
  * @returns {Object | void} Migration results
14180
14180
  */
14181
14181
  processCollaborationMigrations() {
14182
- console.debug("[checkVersionMigrations] Current editor version", "0.11.59");
14182
+ console.debug("[checkVersionMigrations] Current editor version", "0.11.60");
14183
14183
  if (!this.options.ydoc) return;
14184
14184
  const metaMap = this.options.ydoc.getMap("meta");
14185
14185
  let docVersion = metaMap.get("version");
@@ -15497,6 +15497,27 @@ const Gapcursor = Extension.create({
15497
15497
  };
15498
15498
  }
15499
15499
  });
15500
+ const updateYdocDocxData = async (editor) => {
15501
+ if (!editor.options.ydoc) return;
15502
+ const metaMap = editor.options.ydoc.getMap("meta");
15503
+ const docx = [...metaMap.get("docx")];
15504
+ const newXml = await editor.exportDocx({ getUpdatedDocs: true });
15505
+ Object.keys(newXml).forEach((key) => {
15506
+ if (key.includes("header") || key.includes("footer")) {
15507
+ const fileIndex = docx.findIndex((item) => item.name === key);
15508
+ if (fileIndex > -1) {
15509
+ docx.splice(fileIndex, 1);
15510
+ }
15511
+ docx.push({
15512
+ name: key,
15513
+ content: newXml[key]
15514
+ });
15515
+ }
15516
+ });
15517
+ editor.options.ydoc.transact(() => {
15518
+ metaMap.set("docx", docx);
15519
+ }, { event: "docx-update", user: editor.options.user });
15520
+ };
15500
15521
  const CollaborationPluginKey = new PluginKey("collaboration");
15501
15522
  const Collaboration = Extension.create({
15502
15523
  name: "collaboration",
@@ -15515,6 +15536,7 @@ const Collaboration = Extension.create({
15515
15536
  const undoPlugin = createUndoPlugin();
15516
15537
  initDocumentLockHandler(this.options.ydoc, this.editor);
15517
15538
  initSyncListener(this.options.ydoc, this.editor, this);
15539
+ initDocumentListener({ ydoc: this.options.ydoc, editor: this.editor });
15518
15540
  const [syncPlugin, fragment] = createSyncPlugin(this.options.ydoc, this.editor);
15519
15541
  this.options.fragment = fragment;
15520
15542
  const metaMap = this.options.ydoc.getMap("media");
@@ -15593,6 +15615,33 @@ const initDocumentLockHandler = (ydoc, editor) => {
15593
15615
  editor.emit("locked", { editor, isLocked, lockedBy });
15594
15616
  });
15595
15617
  };
15618
+ const checkDocxChanged = (transaction) => {
15619
+ for (const [key, value] of transaction.changed?.entries()) {
15620
+ if (value instanceof Set && value.has("docx")) {
15621
+ return true;
15622
+ }
15623
+ }
15624
+ return false;
15625
+ };
15626
+ const initDocumentListener = ({ ydoc, editor }) => {
15627
+ const debouncedUpdate = debounce$2((editor2) => {
15628
+ updateYdocDocxData(editor2);
15629
+ }, 1e3);
15630
+ ydoc.on("afterTransaction", (transaction) => {
15631
+ const { local } = transaction;
15632
+ const hasChangedDocx = checkDocxChanged(transaction);
15633
+ if (!hasChangedDocx && transaction.changed?.size && local) {
15634
+ debouncedUpdate(editor);
15635
+ }
15636
+ });
15637
+ };
15638
+ const debounce$2 = (fn2, wait) => {
15639
+ let timeout2 = null;
15640
+ return (...args) => {
15641
+ clearTimeout(timeout2);
15642
+ timeout2 = setTimeout(() => fn2.apply(void 0, args), wait);
15643
+ };
15644
+ };
15596
15645
  const initSyncListener = (ydoc, editor, extension) => {
15597
15646
  const provider = editor.options.collaborationProvider;
15598
15647
  if (!provider) return;
@@ -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-CxUKSS50.js";
3
- import { _ as _export_sfc, g as global$1 } from "./editor-D562_uCU.js";
2
+ import { x as process$1 } from "./converter-Dptp_3H8.js";
3
+ import { _ as _export_sfc, g as global$1 } from "./editor-Denpr49N.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-CxUKSS50.js";
1
+ import { O } from "./chunks/converter-Dptp_3H8.js";
2
2
  export {
3
3
  O as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-CxUKSS50.js";
2
- import { D } from "./chunks/docx-zipper-C8L5bK_c.js";
1
+ import "./chunks/converter-Dptp_3H8.js";
2
+ import { D } from "./chunks/docx-zipper-BNTwjTIm.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-D562_uCU.js";
2
- import "./chunks/converter-CxUKSS50.js";
3
- import "./chunks/docx-zipper-C8L5bK_c.js";
1
+ import { E } from "./chunks/editor-Denpr49N.js";
2
+ import "./chunks/converter-Dptp_3H8.js";
3
+ import "./chunks/docx-zipper-BNTwjTIm.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -0,0 +1,2 @@
1
+ export function updateYdocDocxData(editor: Editor): Promise<void>;
2
+ //# sourceMappingURL=collaboration-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collaboration-helpers.d.ts","sourceRoot":"","sources":["../../../src/extensions/collaboration/collaboration-helpers.js"],"names":[],"mappings":"AAMO,2CAHI,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAyBzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../../src/extensions/collaboration/collaboration.js"],"names":[],"mappings":"AAIA,oDAAqE;AAErE,gCA8EG;0BAnFuB,mBAAmB"}
1
+ {"version":3,"file":"collaboration.d.ts","sourceRoot":"","sources":["../../../src/extensions/collaboration/collaboration.js"],"names":[],"mappings":"AAKA,oDAAqE;AAErE,gCA+EG;0BArFuB,mBAAmB"}
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-C8L5bK_c.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BNTwjTIm.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions, M as Mark, j as Extension, A as Attribute, N as Node } from "./chunks/editor-D562_uCU.js";
13
- import { C, T, l, n, k, m } from "./chunks/editor-D562_uCU.js";
14
- import { a1 as getDefaultExportFromCjs, E as v4, a4 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-CxUKSS50.js";
15
- import { O } from "./chunks/converter-CxUKSS50.js";
12
+ import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions, M as Mark, j as Extension, A as Attribute, N as Node } from "./chunks/editor-Denpr49N.js";
13
+ import { C, T, l, n, k, m } from "./chunks/editor-Denpr49N.js";
14
+ import { a1 as getDefaultExportFromCjs, E as v4, a4 as vClickOutside, T as TextSelection, a as Plugin } from "./chunks/converter-Dptp_3H8.js";
15
+ import { O } from "./chunks/converter-Dptp_3H8.js";
16
16
  import { ref, createElementBlock, openBlock, createElementVNode, unref, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, normalizeClass, 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-DXGphEz9.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-DTVYQvE4.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-C8L5bK_c.js";
19
+ import { D } from "./chunks/docx-zipper-BNTwjTIm.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  (function(module) {
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-DXGphEz9.js";
3
- import "./chunks/editor-D562_uCU.js";
2
+ import { T } from "./chunks/toolbar-DTVYQvE4.js";
3
+ import "./chunks/editor-Denpr49N.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-CcLjgzVN.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-6RJfgkuP.cjs");
4
4
  require("./chunks/vue-DPZkajuO.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.BasicUpload = superEditor_es._sfc_main$1;
@@ -1,4 +1,4 @@
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-GCGh72cA.es.js";
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-CWoldIVO.es.js";
2
2
  import "./chunks/vue-IIIZMHTg.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-CcLjgzVN.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-6RJfgkuP.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");
@@ -23174,13 +23174,13 @@ var __webpack_exports__$1 = globalThis.pdfjsLib = {};
23174
23174
  "./chunks/empty-lth7LH78.cjs"
23175
23175
  )), http = await Promise.resolve().then(() => require(
23176
23176
  /*webpackIgnore: true*/
23177
- "./chunks/index-iv-kAVLp.cjs"
23177
+ "./chunks/index-B1MhwjTC.cjs"
23178
23178
  )).then((n) => n.index), https = await Promise.resolve().then(() => require(
23179
23179
  /*webpackIgnore: true*/
23180
- "./chunks/index-BMaqSK4V.cjs"
23180
+ "./chunks/index-CMBtuT02.cjs"
23181
23181
  )).then((n) => n.index), url = await Promise.resolve().then(() => require(
23182
23182
  /*webpackIgnore: true*/
23183
- "./chunks/url-5p0aHHfv.cjs"
23183
+ "./chunks/url-DuggQ5JR.cjs"
23184
23184
  )).then((n) => n.url);
23185
23185
  let canvas, path2d;
23186
23186
  try {
@@ -46557,7 +46557,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
46557
46557
  this.config.colors = shuffleArray(this.config.colors);
46558
46558
  this.userColorMap = /* @__PURE__ */ new Map();
46559
46559
  this.colorIndex = 0;
46560
- this.version = "0.11.59";
46560
+ this.version = "0.11.60";
46561
46561
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
46562
46562
  this.superdocId = config.superdocId || uuid.v4();
46563
46563
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
- import { n as index$1, C as CommentsPluginKey, e as TrackChangesBasePluginKey, E as Editor, k as getRichTextExtensions, c as SuperInput, A as AIWriter, b as SuperEditor, d as SuperToolbar, f as createZip } from "./chunks/super-editor.es-GCGh72cA.es.js";
2
- import { S, i, m } from "./chunks/super-editor.es-GCGh72cA.es.js";
1
+ import { n as index$1, C as CommentsPluginKey, e as TrackChangesBasePluginKey, E as Editor, k as getRichTextExtensions, c as SuperInput, A as AIWriter, b as SuperEditor, d as SuperToolbar, f as createZip } from "./chunks/super-editor.es-CWoldIVO.es.js";
2
+ import { S, i, m } from "./chunks/super-editor.es-CWoldIVO.es.js";
3
3
  import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, D as toRef, i as inject, q as getCurrentInstance, l as watch, y as unref, a1 as hasInjectionContext, N as reactive, u as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, K as shallowRef, O as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, U as onActivated, s as onDeactivated, A as createTextVNode, F as Fragment, R as Comment, m as defineComponent, E as provide, I as withDirectives, C as h, V as Teleport, S as renderSlot, W as isVNode, J as watchEffect, P as Transition, G as mergeProps, Q as vShow, H as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, x as createVNode, z as withCtx, f as createBaseVNode, B as normalizeStyle, e as createCommentVNode, v as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, X as onUnmounted, a6 as resolveDynamicComponent } from "./chunks/vue-IIIZMHTg.es.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-BmWWPxfF.es.js";
5
5
  import { B as BlankDOCX } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -23173,13 +23173,13 @@ var __webpack_exports__$1 = globalThis.pdfjsLib = {};
23173
23173
  "./chunks/empty-smM22Y5N.es.js"
23174
23174
  ), http = await import(
23175
23175
  /*webpackIgnore: true*/
23176
- "./chunks/index-TEuKY2Tw.es.js"
23176
+ "./chunks/index-SKpROzLW.es.js"
23177
23177
  ).then((n) => n.i), https = await import(
23178
23178
  /*webpackIgnore: true*/
23179
- "./chunks/index-Bok8hAYK.es.js"
23179
+ "./chunks/index-BrSjd1Id.es.js"
23180
23180
  ).then((n) => n.i), url = await import(
23181
23181
  /*webpackIgnore: true*/
23182
- "./chunks/url-ETipSgh6.es.js"
23182
+ "./chunks/url-CAZQTNP3.es.js"
23183
23183
  ).then((n) => n.u);
23184
23184
  let canvas, path2d;
23185
23185
  try {
@@ -46556,7 +46556,7 @@ class SuperDoc extends EventEmitter {
46556
46556
  this.config.colors = shuffleArray(this.config.colors);
46557
46557
  this.userColorMap = /* @__PURE__ */ new Map();
46558
46558
  this.colorIndex = 0;
46559
- this.version = "0.11.59";
46559
+ this.version = "0.11.60";
46560
46560
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
46561
46561
  this.superdocId = config.superdocId || v4();
46562
46562
  this.colors = this.config.colors;
@@ -30587,7 +30587,7 @@
30587
30587
  return;
30588
30588
  }
30589
30589
  }
30590
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.11.59") {
30590
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.11.60") {
30591
30591
  const customLocation = "docProps/custom.xml";
30592
30592
  if (!docx[customLocation]) {
30593
30593
  docx[customLocation] = generateCustomXml();
@@ -30937,7 +30937,7 @@
30937
30937
  function generateCustomXml() {
30938
30938
  return DEFAULT_CUSTOM_XML;
30939
30939
  }
30940
- function generateSuperdocVersion(pid = 2, version2 = "0.11.59") {
30940
+ function generateSuperdocVersion(pid = 2, version2 = "0.11.60") {
30941
30941
  return {
30942
30942
  type: "element",
30943
30943
  name: "property",
@@ -47585,7 +47585,7 @@
47585
47585
  * @returns {Object | void} Migration results
47586
47586
  */
47587
47587
  processCollaborationMigrations() {
47588
- console.debug("[checkVersionMigrations] Current editor version", "0.11.59");
47588
+ console.debug("[checkVersionMigrations] Current editor version", "0.11.60");
47589
47589
  if (!this.options.ydoc) return;
47590
47590
  const metaMap = this.options.ydoc.getMap("meta");
47591
47591
  let docVersion = metaMap.get("version");
@@ -48769,6 +48769,27 @@
48769
48769
  };
48770
48770
  }
48771
48771
  });
48772
+ const updateYdocDocxData = async (editor) => {
48773
+ if (!editor.options.ydoc) return;
48774
+ const metaMap = editor.options.ydoc.getMap("meta");
48775
+ const docx = [...metaMap.get("docx")];
48776
+ const newXml = await editor.exportDocx({ getUpdatedDocs: true });
48777
+ Object.keys(newXml).forEach((key) => {
48778
+ if (key.includes("header") || key.includes("footer")) {
48779
+ const fileIndex = docx.findIndex((item) => item.name === key);
48780
+ if (fileIndex > -1) {
48781
+ docx.splice(fileIndex, 1);
48782
+ }
48783
+ docx.push({
48784
+ name: key,
48785
+ content: newXml[key]
48786
+ });
48787
+ }
48788
+ });
48789
+ editor.options.ydoc.transact(() => {
48790
+ metaMap.set("docx", docx);
48791
+ }, { event: "docx-update", user: editor.options.user });
48792
+ };
48772
48793
  const CollaborationPluginKey = new PluginKey("collaboration");
48773
48794
  const Collaboration = Extension.create({
48774
48795
  name: "collaboration",
@@ -48787,6 +48808,7 @@
48787
48808
  const undoPlugin = createUndoPlugin();
48788
48809
  initDocumentLockHandler(this.options.ydoc, this.editor);
48789
48810
  initSyncListener(this.options.ydoc, this.editor, this);
48811
+ initDocumentListener({ ydoc: this.options.ydoc, editor: this.editor });
48790
48812
  const [syncPlugin, fragment] = createSyncPlugin(this.options.ydoc, this.editor);
48791
48813
  this.options.fragment = fragment;
48792
48814
  const metaMap = this.options.ydoc.getMap("media");
@@ -48865,6 +48887,33 @@
48865
48887
  editor.emit("locked", { editor, isLocked, lockedBy });
48866
48888
  });
48867
48889
  };
48890
+ const checkDocxChanged = (transaction) => {
48891
+ for (const [key, value] of transaction.changed?.entries()) {
48892
+ if (value instanceof Set && value.has("docx")) {
48893
+ return true;
48894
+ }
48895
+ }
48896
+ return false;
48897
+ };
48898
+ const initDocumentListener = ({ ydoc, editor }) => {
48899
+ const debouncedUpdate = debounce$2((editor2) => {
48900
+ updateYdocDocxData(editor2);
48901
+ }, 1e3);
48902
+ ydoc.on("afterTransaction", (transaction) => {
48903
+ const { local } = transaction;
48904
+ const hasChangedDocx = checkDocxChanged(transaction);
48905
+ if (!hasChangedDocx && transaction.changed?.size && local) {
48906
+ debouncedUpdate(editor);
48907
+ }
48908
+ });
48909
+ };
48910
+ const debounce$2 = (fn2, wait) => {
48911
+ let timeout2 = null;
48912
+ return (...args) => {
48913
+ clearTimeout(timeout2);
48914
+ timeout2 = setTimeout(() => fn2.apply(void 0, args), wait);
48915
+ };
48916
+ };
48868
48917
  const initSyncListener = (ydoc, editor, extension) => {
48869
48918
  const provider2 = editor.options.collaborationProvider;
48870
48919
  if (!provider2) return;
@@ -88540,7 +88589,7 @@ ${style2}
88540
88589
  this.config.colors = shuffleArray(this.config.colors);
88541
88590
  this.userColorMap = /* @__PURE__ */ new Map();
88542
88591
  this.colorIndex = 0;
88543
- this.version = "0.11.59";
88592
+ this.version = "0.11.60";
88544
88593
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
88545
88594
  this.superdocId = config.superdocId || v4();
88546
88595
  this.colors = this.config.colors;