@harbour-enterprises/superdoc 0.28.0-next.11 → 0.28.0-next.12

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-CLpN99Rl.es.js → PdfViewer-BsJq49rR.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-CvsrAT4c.cjs → PdfViewer-D8L8mpOs.cjs} +1 -1
  3. package/dist/chunks/{index-DL9bff78-Cf4UBVvQ.cjs → index-BNr0wgOU-Bg5kSvF0.cjs} +1 -1
  4. package/dist/chunks/{index-DL9bff78-8izww2lB.es.js → index-BNr0wgOU-j0xGZdr7.es.js} +1 -1
  5. package/dist/chunks/{index-CNPV5EVY.es.js → index-ByV1n--x.es.js} +3 -3
  6. package/dist/chunks/{index-sLveeSfi.cjs → index-x4srxOl3.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-0SXIzzbj.es.js → super-editor.es-C0LbO3l0.es.js} +103 -45
  8. package/dist/chunks/{super-editor.es-Dy32MdYk.cjs → super-editor.es-CANt5-KH.cjs} +103 -45
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-DMwo26F4.js → converter-AHcrZseN.js} +1 -1
  11. package/dist/super-editor/chunks/{docx-zipper-CuoYR_fZ.js → docx-zipper-BAc8o9wi.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-BQ9mPcm5.js → editor-BwNyV6ke.js} +104 -46
  13. package/dist/super-editor/chunks/{index-DL9bff78.js → index-BNr0wgOU.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-D59d-aMm.js → toolbar-Bx1rJX7n.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -1
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +105 -47
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CNPV5EVY.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-ByV1n--x.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-sLveeSfi.cjs");
4
+ const superdoc = require("./index-x4srxOl3.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-Dy32MdYk.cjs");
3
+ const superEditor_es = require("./super-editor.es-CANt5-KH.cjs");
4
4
  const indexCvBqQJbG = require("./index-CvBqQJbG-Dwm0THD7.cjs");
5
5
  function bail(error) {
6
6
  if (error) {
@@ -1,4 +1,4 @@
1
- import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-0SXIzzbj.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-C0LbO3l0.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-0SXIzzbj.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-C0LbO3l0.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -17156,7 +17156,7 @@ const _sfc_main = {
17156
17156
  __name: "SuperDoc",
17157
17157
  emits: ["selection-update"],
17158
17158
  setup(__props, { emit: __emit }) {
17159
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CLpN99Rl.es.js"));
17159
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BsJq49rR.es.js"));
17160
17160
  const superdocStore = useSuperdocStore();
17161
17161
  const commentsStore = useCommentsStore();
17162
17162
  const {
@@ -17920,7 +17920,7 @@ class SuperDoc extends EventEmitter {
17920
17920
  this.config.colors = shuffleArray(this.config.colors);
17921
17921
  this.userColorMap = /* @__PURE__ */ new Map();
17922
17922
  this.colorIndex = 0;
17923
- this.version = "0.27.2";
17923
+ this.version = "0.28.1";
17924
17924
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17925
17925
  this.superdocId = config.superdocId || v4();
17926
17926
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-Dy32MdYk.cjs");
2
+ const superEditor_es = require("./super-editor.es-CANt5-KH.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -17173,7 +17173,7 @@ const _sfc_main = {
17173
17173
  __name: "SuperDoc",
17174
17174
  emits: ["selection-update"],
17175
17175
  setup(__props, { emit: __emit }) {
17176
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CvsrAT4c.cjs")));
17176
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D8L8mpOs.cjs")));
17177
17177
  const superdocStore = useSuperdocStore();
17178
17178
  const commentsStore = useCommentsStore();
17179
17179
  const {
@@ -17937,7 +17937,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17937
17937
  this.config.colors = shuffleArray(this.config.colors);
17938
17938
  this.userColorMap = /* @__PURE__ */ new Map();
17939
17939
  this.colorIndex = 0;
17940
- this.version = "0.27.2";
17940
+ this.version = "0.28.1";
17941
17941
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17942
17942
  this.superdocId = config.superdocId || uuid.v4();
17943
17943
  this.colors = this.config.colors;
@@ -35497,7 +35497,7 @@ const _SuperConverter = class _SuperConverter2 {
35497
35497
  static getStoredSuperdocVersion(docx) {
35498
35498
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35499
35499
  }
35500
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.27.2") {
35500
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.28.1") {
35501
35501
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35502
35502
  }
35503
35503
  /**
@@ -53632,7 +53632,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53632
53632
  { default: remarkStringify },
53633
53633
  { default: remarkGfm }
53634
53634
  ] = await Promise.all([
53635
- import("./index-DL9bff78-8izww2lB.es.js"),
53635
+ import("./index-BNr0wgOU-j0xGZdr7.es.js"),
53636
53636
  import("./index-DRCvimau-Cw339678.es.js"),
53637
53637
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
53638
53638
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -53850,7 +53850,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53850
53850
  * @returns {Object | void} Migration results
53851
53851
  */
53852
53852
  processCollaborationMigrations() {
53853
- console.debug("[checkVersionMigrations] Current editor version", "0.27.2");
53853
+ console.debug("[checkVersionMigrations] Current editor version", "0.28.1");
53854
53854
  if (!this.options.ydoc) return;
53855
53855
  const metaMap = this.options.ydoc.getMap("meta");
53856
53856
  let docVersion = metaMap.get("version");
@@ -59481,10 +59481,16 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59481
59481
  const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
59482
59482
  if (!paragraphContext) return;
59483
59483
  try {
59484
- const { tabStops, flattened, startPos } = paragraphContext;
59485
- const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
59486
- if (entryIndex === -1) return;
59487
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59484
+ const { tabStops, flattened, positionMap, startPos } = paragraphContext;
59485
+ const entryIndex = positionMap.get(pos);
59486
+ if (entryIndex === void 0) return;
59487
+ if (paragraphContext.indentWidth === void 0) {
59488
+ paragraphContext.indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59489
+ }
59490
+ if (paragraphContext.tabHeight === void 0) {
59491
+ paragraphContext.tabHeight = calcTabHeight($pos);
59492
+ }
59493
+ const indentWidth = paragraphContext.indentWidth;
59488
59494
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
59489
59495
  const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
59490
59496
  let tabWidth;
@@ -59526,7 +59532,7 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59526
59532
  tabWidth = defaultTabDistance - currentWidth % defaultLineLength % defaultTabDistance;
59527
59533
  if (tabWidth === 0) tabWidth = defaultTabDistance;
59528
59534
  }
59529
- const tabHeight = calcTabHeight($pos);
59535
+ const tabHeight = paragraphContext.tabHeight;
59530
59536
  decorations.push(
59531
59537
  Decoration.node(pos, pos + node.nodeSize, {
59532
59538
  style: `width: ${tabWidth}px; height: ${tabHeight};${extraStyles}`
@@ -59554,13 +59560,16 @@ function getParagraphContext($pos, cache2, helpers2) {
59554
59560
  tabStops = style2.definition.styles.tabStops;
59555
59561
  }
59556
59562
  }
59563
+ const { entries, positionMap } = flattenParagraph(node, startPos);
59557
59564
  cache2.set(startPos, {
59558
59565
  paragraph: node,
59559
59566
  paragraphDepth: depth,
59560
59567
  startPos,
59561
59568
  indent: node.attrs?.indent || {},
59562
59569
  tabStops,
59563
- flattened: flattenParagraph(node, startPos),
59570
+ flattened: entries,
59571
+ positionMap,
59572
+ // Store position map for O(1) lookups
59564
59573
  accumulatedTabWidth: 0
59565
59574
  });
59566
59575
  }
@@ -59571,6 +59580,7 @@ function getParagraphContext($pos, cache2, helpers2) {
59571
59580
  }
59572
59581
  function flattenParagraph(paragraph, paragraphStartPos) {
59573
59582
  const entries = [];
59583
+ const positionMap = /* @__PURE__ */ new Map();
59574
59584
  const walk = (node, basePos) => {
59575
59585
  if (!node) return;
59576
59586
  if (node.type?.name === "run") {
@@ -59580,13 +59590,16 @@ function flattenParagraph(paragraph, paragraphStartPos) {
59580
59590
  });
59581
59591
  return;
59582
59592
  }
59583
- entries.push({ node, pos: basePos - 1 });
59593
+ const pos = basePos - 1;
59594
+ const index2 = entries.length;
59595
+ entries.push({ node, pos });
59596
+ positionMap.set(pos, index2);
59584
59597
  };
59585
59598
  paragraph.forEach((child, offset2) => {
59586
59599
  const childPos = paragraphStartPos + offset2 + 1;
59587
59600
  walk(child, childPos);
59588
59601
  });
59589
- return entries;
59602
+ return { entries, positionMap };
59590
59603
  }
59591
59604
  function findNextTabIndex(flattened, fromIndex) {
59592
59605
  for (let i = fromIndex; i < flattened.length; i++) {
@@ -59744,6 +59757,21 @@ const TabNode = Node$1.create({
59744
59757
  },
59745
59758
  addPmPlugins() {
59746
59759
  const { view, helpers: helpers2 } = this.editor;
59760
+ const mergeRanges = (ranges) => {
59761
+ if (ranges.length === 0) return [];
59762
+ const sorted = ranges.slice().sort((a, b2) => a[0] - b2[0]);
59763
+ const merged = [sorted[0]];
59764
+ for (let i = 1; i < sorted.length; i++) {
59765
+ const [start2, end2] = sorted[i];
59766
+ const last = merged[merged.length - 1];
59767
+ if (start2 <= last[1]) {
59768
+ last[1] = Math.max(last[1], end2);
59769
+ } else {
59770
+ merged.push([start2, end2]);
59771
+ }
59772
+ }
59773
+ return merged;
59774
+ };
59747
59775
  const tabPlugin = new Plugin({
59748
59776
  name: "tabPlugin",
59749
59777
  key: new PluginKey("tabPlugin"),
@@ -59754,43 +59782,56 @@ const TabNode = Node$1.create({
59754
59782
  apply(tr, { decorations }, _oldState, newState) {
59755
59783
  if (!decorations) {
59756
59784
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
59785
+ return { decorations };
59757
59786
  }
59758
- if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
59787
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
59759
59788
  return { decorations };
59760
59789
  }
59761
59790
  decorations = decorations.map(tr.mapping, tr.doc);
59762
- let rangesToRecalculate = [];
59791
+ const rangesToRecalculate = [];
59792
+ const containsTab = (node) => node.type.name === "tab";
59763
59793
  tr.steps.forEach((step, index2) => {
59764
- const stepMap = step.getMap();
59765
- if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
59766
- const $from = tr.docs[index2].resolve(step.from);
59767
- const $to = tr.docs[index2].resolve(step.to);
59768
- const start2 = $from.start(Math.min($from.depth, 1));
59769
- const end2 = $to.end(Math.min($to.depth, 1));
59770
- let addRange2 = false;
59771
- tr.docs[index2].nodesBetween(start2, end2, (node) => {
59772
- if (node.type.name === "tab") {
59773
- addRange2 = true;
59794
+ if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
59795
+ return;
59796
+ }
59797
+ let hasTabInRange = false;
59798
+ if (step.slice?.content) {
59799
+ step.slice.content.descendants((node) => {
59800
+ if (containsTab(node)) {
59801
+ hasTabInRange = true;
59802
+ return false;
59774
59803
  }
59775
59804
  });
59776
- if (!addRange2 && step.slice?.content) {
59777
- step.slice.content.descendants((node) => {
59778
- if (node.type.name === "tab") {
59779
- addRange2 = true;
59780
- }
59781
- });
59782
- }
59783
- if (addRange2) {
59784
- rangesToRecalculate.push([start2, end2]);
59785
- }
59786
59805
  }
59787
- rangesToRecalculate = rangesToRecalculate.map(([from2, to]) => {
59788
- const mappedFrom = stepMap.map(from2, -1);
59789
- const mappedTo = stepMap.map(to, 1);
59790
- return [mappedFrom, mappedTo];
59791
- });
59806
+ if (!hasTabInRange) {
59807
+ tr.docs[index2].nodesBetween(step.from, step.to, (node) => {
59808
+ if (containsTab(node)) {
59809
+ hasTabInRange = true;
59810
+ return false;
59811
+ }
59812
+ });
59813
+ }
59814
+ if (!hasTabInRange) {
59815
+ return;
59816
+ }
59817
+ let fromPos = step.from;
59818
+ let toPos = step.to;
59819
+ for (let i = index2; i < tr.steps.length; i++) {
59820
+ const stepMap = tr.steps[i].getMap();
59821
+ fromPos = stepMap.map(fromPos, -1);
59822
+ toPos = stepMap.map(toPos, 1);
59823
+ }
59824
+ const $from = newState.doc.resolve(fromPos);
59825
+ const $to = newState.doc.resolve(toPos);
59826
+ const start2 = $from.start(Math.min($from.depth, 1));
59827
+ const end2 = $to.end(Math.min($to.depth, 1));
59828
+ rangesToRecalculate.push([start2, end2]);
59792
59829
  });
59793
- rangesToRecalculate.forEach(([start2, end2]) => {
59830
+ if (rangesToRecalculate.length === 0) {
59831
+ return { decorations };
59832
+ }
59833
+ const mergedRanges = mergeRanges(rangesToRecalculate);
59834
+ mergedRanges.forEach(([start2, end2]) => {
59794
59835
  const oldDecorations = decorations.find(start2, end2);
59795
59836
  decorations = decorations.remove(oldDecorations);
59796
59837
  const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
@@ -65954,15 +65995,15 @@ const Image = Node$1.create({
65954
65995
  style2 += "float: right;";
65955
65996
  floatRight = true;
65956
65997
  } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
65957
- const pageStylesData2 = getDataFromPageStyles({
65998
+ const pageStylesData = getDataFromPageStyles({
65958
65999
  editor: this.editor,
65959
66000
  marginOffset,
65960
66001
  size: size2,
65961
66002
  attrs
65962
66003
  });
65963
- style2 += pageStylesData2.style;
65964
- floatRight = pageStylesData2.floatRight;
65965
- baseHorizontal = pageStylesData2.baseHorizontal;
66004
+ style2 += pageStylesData.style;
66005
+ floatRight = pageStylesData.floatRight;
66006
+ baseHorizontal = pageStylesData.baseHorizontal;
65966
66007
  }
65967
66008
  if (attrs.distTop) margin.top += attrs.distTop;
65968
66009
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
@@ -65970,7 +66011,7 @@ const Image = Node$1.create({
65970
66011
  if (attrs.distRight) margin.right += attrs.distRight;
65971
66012
  break;
65972
66013
  case "Through":
65973
- case "Tight":
66014
+ case "Tight": {
65974
66015
  style2 += "clear: both;";
65975
66016
  const pageStylesData = getDataFromPageStyles({
65976
66017
  editor: this.editor,
@@ -66007,11 +66048,14 @@ const Image = Node$1.create({
66007
66048
  style2 += `shape-outside: polygon(${points});`;
66008
66049
  }
66009
66050
  break;
66051
+ }
66010
66052
  case "TopAndBottom":
66011
66053
  style2 += "display: block; clear: both;";
66054
+ if (!anchorData) {
66055
+ centered = true;
66056
+ }
66012
66057
  if (attrs.distTop) margin.top += attrs.distTop;
66013
66058
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
66014
- centered = true;
66015
66059
  break;
66016
66060
  }
66017
66061
  }
@@ -66031,6 +66075,20 @@ const Image = Node$1.create({
66031
66075
  style2 += `position: absolute; ${anchorData.alignH}: 0;`;
66032
66076
  }
66033
66077
  break;
66078
+ case "column":
66079
+ if (anchorData.alignH === "center") {
66080
+ centered = true;
66081
+ } else if (anchorData.alignH === "right") {
66082
+ floatRight = true;
66083
+ if (!style2.includes("float: right;")) {
66084
+ style2 += "float: right;";
66085
+ }
66086
+ } else if (anchorData.alignH === "left") {
66087
+ if (!style2.includes("float: left;")) {
66088
+ style2 += "float: left;";
66089
+ }
66090
+ }
66091
+ break;
66034
66092
  }
66035
66093
  }
66036
66094
  if (hasAnchorData || hasMarginOffsets) {
@@ -35514,7 +35514,7 @@ const _SuperConverter = class _SuperConverter2 {
35514
35514
  static getStoredSuperdocVersion(docx) {
35515
35515
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35516
35516
  }
35517
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.27.2") {
35517
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.28.1") {
35518
35518
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35519
35519
  }
35520
35520
  /**
@@ -53649,7 +53649,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53649
53649
  { default: remarkStringify },
53650
53650
  { default: remarkGfm }
53651
53651
  ] = await Promise.all([
53652
- Promise.resolve().then(() => require("./index-DL9bff78-Cf4UBVvQ.cjs")),
53652
+ Promise.resolve().then(() => require("./index-BNr0wgOU-Bg5kSvF0.cjs")),
53653
53653
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
53654
53654
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
53655
53655
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -53867,7 +53867,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53867
53867
  * @returns {Object | void} Migration results
53868
53868
  */
53869
53869
  processCollaborationMigrations() {
53870
- console.debug("[checkVersionMigrations] Current editor version", "0.27.2");
53870
+ console.debug("[checkVersionMigrations] Current editor version", "0.28.1");
53871
53871
  if (!this.options.ydoc) return;
53872
53872
  const metaMap = this.options.ydoc.getMap("meta");
53873
53873
  let docVersion = metaMap.get("version");
@@ -59498,10 +59498,16 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59498
59498
  const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
59499
59499
  if (!paragraphContext) return;
59500
59500
  try {
59501
- const { tabStops, flattened, startPos } = paragraphContext;
59502
- const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
59503
- if (entryIndex === -1) return;
59504
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59501
+ const { tabStops, flattened, positionMap, startPos } = paragraphContext;
59502
+ const entryIndex = positionMap.get(pos);
59503
+ if (entryIndex === void 0) return;
59504
+ if (paragraphContext.indentWidth === void 0) {
59505
+ paragraphContext.indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
59506
+ }
59507
+ if (paragraphContext.tabHeight === void 0) {
59508
+ paragraphContext.tabHeight = calcTabHeight($pos);
59509
+ }
59510
+ const indentWidth = paragraphContext.indentWidth;
59505
59511
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
59506
59512
  const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
59507
59513
  let tabWidth;
@@ -59543,7 +59549,7 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
59543
59549
  tabWidth = defaultTabDistance - currentWidth % defaultLineLength % defaultTabDistance;
59544
59550
  if (tabWidth === 0) tabWidth = defaultTabDistance;
59545
59551
  }
59546
- const tabHeight = calcTabHeight($pos);
59552
+ const tabHeight = paragraphContext.tabHeight;
59547
59553
  decorations.push(
59548
59554
  Decoration.node(pos, pos + node.nodeSize, {
59549
59555
  style: `width: ${tabWidth}px; height: ${tabHeight};${extraStyles}`
@@ -59571,13 +59577,16 @@ function getParagraphContext($pos, cache2, helpers2) {
59571
59577
  tabStops = style2.definition.styles.tabStops;
59572
59578
  }
59573
59579
  }
59580
+ const { entries, positionMap } = flattenParagraph(node, startPos);
59574
59581
  cache2.set(startPos, {
59575
59582
  paragraph: node,
59576
59583
  paragraphDepth: depth,
59577
59584
  startPos,
59578
59585
  indent: node.attrs?.indent || {},
59579
59586
  tabStops,
59580
- flattened: flattenParagraph(node, startPos),
59587
+ flattened: entries,
59588
+ positionMap,
59589
+ // Store position map for O(1) lookups
59581
59590
  accumulatedTabWidth: 0
59582
59591
  });
59583
59592
  }
@@ -59588,6 +59597,7 @@ function getParagraphContext($pos, cache2, helpers2) {
59588
59597
  }
59589
59598
  function flattenParagraph(paragraph, paragraphStartPos) {
59590
59599
  const entries = [];
59600
+ const positionMap = /* @__PURE__ */ new Map();
59591
59601
  const walk = (node, basePos) => {
59592
59602
  if (!node) return;
59593
59603
  if (node.type?.name === "run") {
@@ -59597,13 +59607,16 @@ function flattenParagraph(paragraph, paragraphStartPos) {
59597
59607
  });
59598
59608
  return;
59599
59609
  }
59600
- entries.push({ node, pos: basePos - 1 });
59610
+ const pos = basePos - 1;
59611
+ const index2 = entries.length;
59612
+ entries.push({ node, pos });
59613
+ positionMap.set(pos, index2);
59601
59614
  };
59602
59615
  paragraph.forEach((child, offset2) => {
59603
59616
  const childPos = paragraphStartPos + offset2 + 1;
59604
59617
  walk(child, childPos);
59605
59618
  });
59606
- return entries;
59619
+ return { entries, positionMap };
59607
59620
  }
59608
59621
  function findNextTabIndex(flattened, fromIndex) {
59609
59622
  for (let i = fromIndex; i < flattened.length; i++) {
@@ -59761,6 +59774,21 @@ const TabNode = Node$1.create({
59761
59774
  },
59762
59775
  addPmPlugins() {
59763
59776
  const { view, helpers: helpers2 } = this.editor;
59777
+ const mergeRanges = (ranges) => {
59778
+ if (ranges.length === 0) return [];
59779
+ const sorted = ranges.slice().sort((a, b2) => a[0] - b2[0]);
59780
+ const merged = [sorted[0]];
59781
+ for (let i = 1; i < sorted.length; i++) {
59782
+ const [start2, end2] = sorted[i];
59783
+ const last = merged[merged.length - 1];
59784
+ if (start2 <= last[1]) {
59785
+ last[1] = Math.max(last[1], end2);
59786
+ } else {
59787
+ merged.push([start2, end2]);
59788
+ }
59789
+ }
59790
+ return merged;
59791
+ };
59764
59792
  const tabPlugin = new Plugin({
59765
59793
  name: "tabPlugin",
59766
59794
  key: new PluginKey("tabPlugin"),
@@ -59771,43 +59799,56 @@ const TabNode = Node$1.create({
59771
59799
  apply(tr, { decorations }, _oldState, newState) {
59772
59800
  if (!decorations) {
59773
59801
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
59802
+ return { decorations };
59774
59803
  }
59775
- if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
59804
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate")) {
59776
59805
  return { decorations };
59777
59806
  }
59778
59807
  decorations = decorations.map(tr.mapping, tr.doc);
59779
- let rangesToRecalculate = [];
59808
+ const rangesToRecalculate = [];
59809
+ const containsTab = (node) => node.type.name === "tab";
59780
59810
  tr.steps.forEach((step, index2) => {
59781
- const stepMap = step.getMap();
59782
- if (step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1) {
59783
- const $from = tr.docs[index2].resolve(step.from);
59784
- const $to = tr.docs[index2].resolve(step.to);
59785
- const start2 = $from.start(Math.min($from.depth, 1));
59786
- const end2 = $to.end(Math.min($to.depth, 1));
59787
- let addRange2 = false;
59788
- tr.docs[index2].nodesBetween(start2, end2, (node) => {
59789
- if (node.type.name === "tab") {
59790
- addRange2 = true;
59811
+ if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep$1)) {
59812
+ return;
59813
+ }
59814
+ let hasTabInRange = false;
59815
+ if (step.slice?.content) {
59816
+ step.slice.content.descendants((node) => {
59817
+ if (containsTab(node)) {
59818
+ hasTabInRange = true;
59819
+ return false;
59791
59820
  }
59792
59821
  });
59793
- if (!addRange2 && step.slice?.content) {
59794
- step.slice.content.descendants((node) => {
59795
- if (node.type.name === "tab") {
59796
- addRange2 = true;
59797
- }
59798
- });
59799
- }
59800
- if (addRange2) {
59801
- rangesToRecalculate.push([start2, end2]);
59802
- }
59803
59822
  }
59804
- rangesToRecalculate = rangesToRecalculate.map(([from2, to]) => {
59805
- const mappedFrom = stepMap.map(from2, -1);
59806
- const mappedTo = stepMap.map(to, 1);
59807
- return [mappedFrom, mappedTo];
59808
- });
59823
+ if (!hasTabInRange) {
59824
+ tr.docs[index2].nodesBetween(step.from, step.to, (node) => {
59825
+ if (containsTab(node)) {
59826
+ hasTabInRange = true;
59827
+ return false;
59828
+ }
59829
+ });
59830
+ }
59831
+ if (!hasTabInRange) {
59832
+ return;
59833
+ }
59834
+ let fromPos = step.from;
59835
+ let toPos = step.to;
59836
+ for (let i = index2; i < tr.steps.length; i++) {
59837
+ const stepMap = tr.steps[i].getMap();
59838
+ fromPos = stepMap.map(fromPos, -1);
59839
+ toPos = stepMap.map(toPos, 1);
59840
+ }
59841
+ const $from = newState.doc.resolve(fromPos);
59842
+ const $to = newState.doc.resolve(toPos);
59843
+ const start2 = $from.start(Math.min($from.depth, 1));
59844
+ const end2 = $to.end(Math.min($to.depth, 1));
59845
+ rangesToRecalculate.push([start2, end2]);
59809
59846
  });
59810
- rangesToRecalculate.forEach(([start2, end2]) => {
59847
+ if (rangesToRecalculate.length === 0) {
59848
+ return { decorations };
59849
+ }
59850
+ const mergedRanges = mergeRanges(rangesToRecalculate);
59851
+ mergedRanges.forEach(([start2, end2]) => {
59811
59852
  const oldDecorations = decorations.find(start2, end2);
59812
59853
  decorations = decorations.remove(oldDecorations);
59813
59854
  const newDecorations = getTabDecorations(newState.doc, view, helpers2, start2, end2);
@@ -65971,15 +66012,15 @@ const Image = Node$1.create({
65971
66012
  style2 += "float: right;";
65972
66013
  floatRight = true;
65973
66014
  } else if (["largest", "bothSides"].includes(attrs.wrapText)) {
65974
- const pageStylesData2 = getDataFromPageStyles({
66015
+ const pageStylesData = getDataFromPageStyles({
65975
66016
  editor: this.editor,
65976
66017
  marginOffset,
65977
66018
  size: size2,
65978
66019
  attrs
65979
66020
  });
65980
- style2 += pageStylesData2.style;
65981
- floatRight = pageStylesData2.floatRight;
65982
- baseHorizontal = pageStylesData2.baseHorizontal;
66021
+ style2 += pageStylesData.style;
66022
+ floatRight = pageStylesData.floatRight;
66023
+ baseHorizontal = pageStylesData.baseHorizontal;
65983
66024
  }
65984
66025
  if (attrs.distTop) margin.top += attrs.distTop;
65985
66026
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
@@ -65987,7 +66028,7 @@ const Image = Node$1.create({
65987
66028
  if (attrs.distRight) margin.right += attrs.distRight;
65988
66029
  break;
65989
66030
  case "Through":
65990
- case "Tight":
66031
+ case "Tight": {
65991
66032
  style2 += "clear: both;";
65992
66033
  const pageStylesData = getDataFromPageStyles({
65993
66034
  editor: this.editor,
@@ -66024,11 +66065,14 @@ const Image = Node$1.create({
66024
66065
  style2 += `shape-outside: polygon(${points});`;
66025
66066
  }
66026
66067
  break;
66068
+ }
66027
66069
  case "TopAndBottom":
66028
66070
  style2 += "display: block; clear: both;";
66071
+ if (!anchorData) {
66072
+ centered = true;
66073
+ }
66029
66074
  if (attrs.distTop) margin.top += attrs.distTop;
66030
66075
  if (attrs.distBottom) margin.bottom += attrs.distBottom;
66031
- centered = true;
66032
66076
  break;
66033
66077
  }
66034
66078
  }
@@ -66048,6 +66092,20 @@ const Image = Node$1.create({
66048
66092
  style2 += `position: absolute; ${anchorData.alignH}: 0;`;
66049
66093
  }
66050
66094
  break;
66095
+ case "column":
66096
+ if (anchorData.alignH === "center") {
66097
+ centered = true;
66098
+ } else if (anchorData.alignH === "right") {
66099
+ floatRight = true;
66100
+ if (!style2.includes("float: right;")) {
66101
+ style2 += "float: right;";
66102
+ }
66103
+ } else if (anchorData.alignH === "left") {
66104
+ if (!style2.includes("float: left;")) {
66105
+ style2 += "float: left;";
66106
+ }
66107
+ }
66108
+ break;
66051
66109
  }
66052
66110
  }
66053
66111
  if (hasAnchorData || hasMarginOffsets) {
@@ -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-DMwo26F4.js";
3
- import { _ as _export_sfc } from "./chunks/editor-BQ9mPcm5.js";
2
+ import { T as TextSelection } from "./chunks/converter-AHcrZseN.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-BwNyV6ke.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 = {}) {
@@ -35504,7 +35504,7 @@ const _SuperConverter = class _SuperConverter {
35504
35504
  static getStoredSuperdocVersion(docx) {
35505
35505
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
35506
35506
  }
35507
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.27.2") {
35507
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.28.1") {
35508
35508
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
35509
35509
  }
35510
35510
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DMwo26F4.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-AHcrZseN.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
  }