@harbour-enterprises/superdoc 1.0.0-beta.85 → 1.0.0-beta.87

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-CGlfOU3w.cjs → PdfViewer-Cwmc4rak.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DKSowWMT.es.js → PdfViewer-DAayAt76.es.js} +1 -1
  3. package/dist/chunks/{index-B4I7N08F.es.js → index-BV2SxVfK.es.js} +3 -3
  4. package/dist/chunks/{index-nbBk8Xrw.cjs → index-huIbWXSg.cjs} +3 -3
  5. package/dist/chunks/{index-D8ciXlCs-B1Q8QwX8.cjs → index-rv7o9043-DD5SvBoC.cjs} +1 -1
  6. package/dist/chunks/{index-D8ciXlCs-CB0cgrGv.es.js → index-rv7o9043-DVlRSGhv.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-BblRVT7_.es.js → super-editor.es-BuujpqOr.es.js} +105 -13
  8. package/dist/chunks/{super-editor.es-Hkn9VlOX.cjs → super-editor.es-C43B4f8Z.cjs} +105 -13
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-JgEU6dRK.js → converter-G519mwN2.js} +14 -8
  11. package/dist/super-editor/chunks/{docx-zipper-I9EOoeW0.js → docx-zipper-CHfjJ_h-.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-tcvFrXO7.js → editor-BQsR9BR1.js} +93 -7
  13. package/dist/super-editor/chunks/{index-D8ciXlCs.js → index-rv7o9043.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CIlSwcI_.js → toolbar-DNfQq2Cl.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.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +107 -15
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-jWLMl8Ts.cjs");
4
- const superdoc = require("./index-nbBk8Xrw.cjs");
4
+ const superdoc = require("./index-huIbWXSg.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { y as defineComponent, z as h, O as Transition, a0 as process$1, J as watchEffect, a as computed, r as ref, j as onMounted, W as onUnmounted, b as createElementBlock, o as openBlock, f as createBaseVNode, e as createCommentVNode, u as createVNode, v as unref } from "./vue-Dysv_7z5.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-B4I7N08F.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-BV2SxVfK.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BblRVT7_.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, P as PresentationEditor, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BuujpqOr.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import { E as EventEmitter } from "./eventemitter3-CcXAdeql.es.js";
4
4
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -17251,7 +17251,7 @@ const _sfc_main = {
17251
17251
  __name: "SuperDoc",
17252
17252
  emits: ["selection-update"],
17253
17253
  setup(__props, { emit: __emit }) {
17254
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DKSowWMT.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DAayAt76.es.js"));
17255
17255
  const superdocStore = useSuperdocStore();
17256
17256
  const commentsStore = useCommentsStore();
17257
17257
  const {
@@ -18140,7 +18140,7 @@ class SuperDoc extends EventEmitter {
18140
18140
  this.config.colors = shuffleArray(this.config.colors);
18141
18141
  this.userColorMap = /* @__PURE__ */ new Map();
18142
18142
  this.colorIndex = 0;
18143
- this.version = "1.0.0-beta.85";
18143
+ this.version = "1.0.0-beta.87";
18144
18144
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18145
18145
  this.superdocId = config.superdocId || v4();
18146
18146
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-Hkn9VlOX.cjs");
2
+ const superEditor_es = require("./super-editor.es-C43B4f8Z.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  const eventemitter3 = require("./eventemitter3-DQmQUge-.cjs");
5
5
  const provider = require("@hocuspocus/provider");
@@ -17268,7 +17268,7 @@ const _sfc_main = {
17268
17268
  __name: "SuperDoc",
17269
17269
  emits: ["selection-update"],
17270
17270
  setup(__props, { emit: __emit }) {
17271
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CGlfOU3w.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Cwmc4rak.cjs")));
17272
17272
  const superdocStore = useSuperdocStore();
17273
17273
  const commentsStore = useCommentsStore();
17274
17274
  const {
@@ -18157,7 +18157,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18157
18157
  this.config.colors = shuffleArray(this.config.colors);
18158
18158
  this.userColorMap = /* @__PURE__ */ new Map();
18159
18159
  this.colorIndex = 0;
18160
- this.version = "1.0.0-beta.85";
18160
+ this.version = "1.0.0-beta.87";
18161
18161
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
18162
18162
  this.superdocId = config.superdocId || uuid.v4();
18163
18163
  this.colors = this.config.colors;
@@ -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-Hkn9VlOX.cjs");
3
+ const superEditor_es = require("./super-editor.es-C43B4f8Z.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-BblRVT7_.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-BuujpqOr.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -20293,6 +20293,7 @@ const handleParagraphNode$1 = (params2) => {
20293
20293
  params2,
20294
20294
  inlineParagraphProperties,
20295
20295
  insideTable,
20296
+ false,
20296
20297
  tableStyleId
20297
20298
  );
20298
20299
  const { elements = [], attributes = {}, marks = [] } = parseProperties(node, params2.docx);
@@ -20981,7 +20982,9 @@ const translator$Z = NodeTranslator.from(
20981
20982
  (v2) => integerToString(v2)
20982
20983
  )
20983
20984
  );
20984
- const translator$Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
20985
+ const translator$Y = NodeTranslator.from(
20986
+ createSingleAttrPropertyHandler("w:vMerge", null, "w:val", (val) => !val ? "continue" : val)
20987
+ );
20985
20988
  const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:end"));
20986
20989
  const translator$W = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
20987
20990
  const translator$V = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
@@ -21360,11 +21363,12 @@ function generateTableCellProperties(node) {
21360
21363
  delete tableCellProperties.vAlign;
21361
21364
  }
21362
21365
  const { rowspan } = attrs;
21363
- if (rowspan && rowspan > 1 && tableCellProperties.vMerge !== "restart") {
21366
+ const hasExistingVMerge = tableCellProperties.vMerge != null;
21367
+ if (rowspan && rowspan > 1) {
21364
21368
  tableCellProperties["vMerge"] = "restart";
21365
21369
  } else if (attrs.continueMerge) {
21366
21370
  tableCellProperties["vMerge"] = "continue";
21367
- } else if (tableCellProperties?.vMerge) {
21371
+ } else if (!hasExistingVMerge) {
21368
21372
  delete tableCellProperties.vMerge;
21369
21373
  }
21370
21374
  const { borders = {} } = attrs;
@@ -33454,12 +33458,14 @@ function calculateResolvedParagraphProperties(editor, node, $pos) {
33454
33458
  if (cached) {
33455
33459
  return cached;
33456
33460
  }
33457
- const inTable = Boolean(findParentNodeClosestToPos($pos, (node2) => node2.type.name === "table"));
33461
+ const tableNode = findParentNodeClosestToPos($pos, (node2) => node2.type.name === "table");
33462
+ const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
33458
33463
  const paragraphProperties = resolveParagraphProperties(
33459
33464
  { docx: editor.converter.convertedXml, numbering: editor.converter.numbering },
33460
33465
  node.attrs.paragraphProperties || {},
33461
- inTable,
33462
- false
33466
+ Boolean(tableNode),
33467
+ false,
33468
+ tableStyleId
33463
33469
  );
33464
33470
  resolvedParagraphPropertiesCache.set(node, paragraphProperties);
33465
33471
  return paragraphProperties;
@@ -38325,7 +38331,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
38325
38331
  const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
38326
38332
  if (tblPr && tblPr.elements) {
38327
38333
  if (baseTblPr && baseTblPr.elements) {
38328
- tblPr.elements.push(...baseTblPr.elements);
38334
+ tblPr.elements = [...baseTblPr.elements, ...tblPr.elements];
38329
38335
  }
38330
38336
  const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
38331
38337
  if (tableProperties) {
@@ -42374,7 +42380,7 @@ const _SuperConverter = class _SuperConverter2 {
42374
42380
  static getStoredSuperdocVersion(docx) {
42375
42381
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42376
42382
  }
42377
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.85") {
42383
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.87") {
42378
42384
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42379
42385
  }
42380
42386
  /**
@@ -56540,6 +56546,23 @@ const findTrackedMarkBetween = ({
56540
56546
  };
56541
56547
  }
56542
56548
  });
56549
+ const nodeAtEndPosition = doc2.nodeAt(endPos);
56550
+ if (nodeAtEndPosition?.type?.name === "run") {
56551
+ const node = nodeAtEndPosition.content?.content?.[0];
56552
+ const isTextNode = node?.type?.name === "text";
56553
+ if (isTextNode) {
56554
+ const mark = node.marks.find(
56555
+ (mark2) => mark2.type.name === markName && Object.keys(attrs).every((attr) => mark2.attrs[attr] === attrs[attr])
56556
+ );
56557
+ if (mark && !markFound) {
56558
+ markFound = {
56559
+ from: endPos,
56560
+ to: endPos + node.nodeSize,
56561
+ mark
56562
+ };
56563
+ }
56564
+ }
56565
+ }
56543
56566
  return markFound;
56544
56567
  };
56545
56568
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
@@ -59563,7 +59586,7 @@ const isHeadless = (editor) => {
59563
59586
  const shouldSkipNodeView = (editor) => {
59564
59587
  return isHeadless(editor);
59565
59588
  };
59566
- const summaryVersion = "1.0.0-beta.85";
59589
+ const summaryVersion = "1.0.0-beta.87";
59567
59590
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59568
59591
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59569
59592
  function mapAttributes(attrs) {
@@ -60352,7 +60375,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60352
60375
  { default: remarkStringify },
60353
60376
  { default: remarkGfm }
60354
60377
  ] = await Promise.all([
60355
- import("./index-D8ciXlCs-CB0cgrGv.es.js"),
60378
+ import("./index-rv7o9043-DVlRSGhv.es.js"),
60356
60379
  import("./index-DRCvimau-Cw339678.es.js"),
60357
60380
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60358
60381
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60557,7 +60580,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60557
60580
  * Process collaboration migrations
60558
60581
  */
60559
60582
  processCollaborationMigrations() {
60560
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.85");
60583
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.87");
60561
60584
  if (!this.options.ydoc) return;
60562
60585
  const metaMap = this.options.ydoc.getMap("meta");
60563
60586
  let docVersion = metaMap.get("version");
@@ -63633,7 +63656,9 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63633
63656
  let cellsChanged = false;
63634
63657
  const newCells = row.cells.map((cell) => {
63635
63658
  let cellChanged = false;
63636
- const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map((cb) => hydrateBlock(cb));
63659
+ const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map(
63660
+ (cb) => hydrateBlock(cb)
63661
+ );
63637
63662
  if (cell.blocks && hydratedBlocks !== cell.blocks) {
63638
63663
  cellChanged = true;
63639
63664
  }
@@ -63668,6 +63693,40 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63668
63693
  }
63669
63694
  return blk;
63670
63695
  }
63696
+ if (blk.kind === "drawing") {
63697
+ const drawingBlock = blk;
63698
+ if (drawingBlock.drawingKind !== "shapeGroup") {
63699
+ return blk;
63700
+ }
63701
+ const shapeGroupBlock = drawingBlock;
63702
+ if (!shapeGroupBlock.shapes || shapeGroupBlock.shapes.length === 0) {
63703
+ return blk;
63704
+ }
63705
+ let shapesChanged = false;
63706
+ const hydratedShapes = shapeGroupBlock.shapes.map((shape) => {
63707
+ if (shape.shapeType !== "image") {
63708
+ return shape;
63709
+ }
63710
+ const imageChild = shape;
63711
+ const src = imageChild.attrs?.src;
63712
+ if (!src || src.startsWith("data:")) {
63713
+ return shape;
63714
+ }
63715
+ const resolvedSrc = resolveImageSrc(src);
63716
+ if (resolvedSrc) {
63717
+ shapesChanged = true;
63718
+ return {
63719
+ ...imageChild,
63720
+ attrs: { ...imageChild.attrs, src: resolvedSrc }
63721
+ };
63722
+ }
63723
+ return shape;
63724
+ });
63725
+ if (shapesChanged) {
63726
+ return { ...shapeGroupBlock, shapes: hydratedShapes };
63727
+ }
63728
+ return blk;
63729
+ }
63671
63730
  return blk;
63672
63731
  };
63673
63732
  return hydrateBlock(block);
@@ -73231,6 +73290,7 @@ const renderTableCell = (deps) => {
73231
73290
  cell,
73232
73291
  borders,
73233
73292
  renderLine,
73293
+ renderDrawingContent,
73234
73294
  context,
73235
73295
  applySdtDataset,
73236
73296
  fromLine,
@@ -73373,6 +73433,11 @@ const renderTableCell = (deps) => {
73373
73433
  img.style.height = "100%";
73374
73434
  img.style.objectFit = block.objectFit ?? "contain";
73375
73435
  drawingInner.appendChild(img);
73436
+ } else if (renderDrawingContent) {
73437
+ const drawingContent = renderDrawingContent(block);
73438
+ drawingContent.style.width = "100%";
73439
+ drawingContent.style.height = "100%";
73440
+ drawingInner.appendChild(drawingContent);
73376
73441
  } else {
73377
73442
  const placeholder = doc2.createElement("div");
73378
73443
  placeholder.style.width = "100%";
@@ -73498,6 +73563,7 @@ const renderTableRow = (deps) => {
73498
73563
  allRowHeights,
73499
73564
  context,
73500
73565
  renderLine,
73566
+ renderDrawingContent,
73501
73567
  applySdtDataset,
73502
73568
  continuesFromPrev,
73503
73569
  continuesOnNext,
@@ -73594,6 +73660,7 @@ const renderTableRow = (deps) => {
73594
73660
  cell,
73595
73661
  borders: resolvedBorders,
73596
73662
  renderLine,
73663
+ renderDrawingContent,
73597
73664
  context,
73598
73665
  applySdtDataset,
73599
73666
  fromLine,
@@ -73647,7 +73714,17 @@ function applySdtContainerStyling(doc2, container, sdt, containerSdt) {
73647
73714
  container.appendChild(labelEl);
73648
73715
  }
73649
73716
  const renderTableFragment = (deps) => {
73650
- const { doc: doc2, fragment, blockLookup, context, renderLine, applyFragmentFrame, applySdtDataset, applyStyles: applyStyles2 } = deps;
73717
+ const {
73718
+ doc: doc2,
73719
+ fragment,
73720
+ blockLookup,
73721
+ context,
73722
+ renderLine,
73723
+ renderDrawingContent,
73724
+ applyFragmentFrame,
73725
+ applySdtDataset,
73726
+ applyStyles: applyStyles2
73727
+ } = deps;
73651
73728
  if (!doc2) {
73652
73729
  console.error("DomPainter: document is not available");
73653
73730
  if (typeof document !== "undefined") {
@@ -73777,6 +73854,7 @@ const renderTableFragment = (deps) => {
73777
73854
  allRowHeights,
73778
73855
  context,
73779
73856
  renderLine,
73857
+ renderDrawingContent,
73780
73858
  applySdtDataset,
73781
73859
  // Headers are always rendered as-is (no border suppression)
73782
73860
  continuesFromPrev: false,
@@ -73806,6 +73884,7 @@ const renderTableFragment = (deps) => {
73806
73884
  allRowHeights,
73807
73885
  context,
73808
73886
  renderLine,
73887
+ renderDrawingContent,
73809
73888
  applySdtDataset,
73810
73889
  // Draw top border if table continues from previous fragment (MS Word behavior)
73811
73890
  continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
@@ -76048,12 +76127,25 @@ const _DomPainter = class _DomPainter2 {
76048
76127
  const renderLineForTableCell = (block, line, ctx2) => {
76049
76128
  return this.renderLine(block, line, ctx2, void 0, void 0, true);
76050
76129
  };
76130
+ const renderDrawingContentForTableCell = (block) => {
76131
+ if (block.drawingKind === "image") {
76132
+ return this.createDrawingImageElement(block);
76133
+ }
76134
+ if (block.drawingKind === "shapeGroup") {
76135
+ return this.createShapeGroupElement(block);
76136
+ }
76137
+ if (block.drawingKind === "vectorShape") {
76138
+ return this.createVectorShapeElement(block, block.geometry, false);
76139
+ }
76140
+ return this.createDrawingPlaceholder();
76141
+ };
76051
76142
  return renderTableFragment({
76052
76143
  doc: this.doc,
76053
76144
  fragment,
76054
76145
  context,
76055
76146
  blockLookup: this.blockLookup,
76056
76147
  renderLine: renderLineForTableCell,
76148
+ renderDrawingContent: renderDrawingContentForTableCell,
76057
76149
  applyFragmentFrame: applyFragmentFrameWithSection,
76058
76150
  applySdtDataset: this.applySdtDataset.bind(this),
76059
76151
  applyStyles: applyStyles$2
@@ -20310,6 +20310,7 @@ const handleParagraphNode$1 = (params2) => {
20310
20310
  params2,
20311
20311
  inlineParagraphProperties,
20312
20312
  insideTable,
20313
+ false,
20313
20314
  tableStyleId
20314
20315
  );
20315
20316
  const { elements = [], attributes = {}, marks = [] } = parseProperties(node, params2.docx);
@@ -20998,7 +20999,9 @@ const translator$Z = NodeTranslator.from(
20998
20999
  (v2) => integerToString(v2)
20999
21000
  )
21000
21001
  );
21001
- const translator$Y = NodeTranslator.from(createSingleAttrPropertyHandler("w:vMerge"));
21002
+ const translator$Y = NodeTranslator.from(
21003
+ createSingleAttrPropertyHandler("w:vMerge", null, "w:val", (val) => !val ? "continue" : val)
21004
+ );
21002
21005
  const translator$X = NodeTranslator.from(createBorderPropertyHandler("w:end"));
21003
21006
  const translator$W = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
21004
21007
  const translator$V = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
@@ -21377,11 +21380,12 @@ function generateTableCellProperties(node) {
21377
21380
  delete tableCellProperties.vAlign;
21378
21381
  }
21379
21382
  const { rowspan } = attrs;
21380
- if (rowspan && rowspan > 1 && tableCellProperties.vMerge !== "restart") {
21383
+ const hasExistingVMerge = tableCellProperties.vMerge != null;
21384
+ if (rowspan && rowspan > 1) {
21381
21385
  tableCellProperties["vMerge"] = "restart";
21382
21386
  } else if (attrs.continueMerge) {
21383
21387
  tableCellProperties["vMerge"] = "continue";
21384
- } else if (tableCellProperties?.vMerge) {
21388
+ } else if (!hasExistingVMerge) {
21385
21389
  delete tableCellProperties.vMerge;
21386
21390
  }
21387
21391
  const { borders = {} } = attrs;
@@ -33471,12 +33475,14 @@ function calculateResolvedParagraphProperties(editor, node, $pos) {
33471
33475
  if (cached) {
33472
33476
  return cached;
33473
33477
  }
33474
- const inTable = Boolean(findParentNodeClosestToPos($pos, (node2) => node2.type.name === "table"));
33478
+ const tableNode = findParentNodeClosestToPos($pos, (node2) => node2.type.name === "table");
33479
+ const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
33475
33480
  const paragraphProperties = resolveParagraphProperties(
33476
33481
  { docx: editor.converter.convertedXml, numbering: editor.converter.numbering },
33477
33482
  node.attrs.paragraphProperties || {},
33478
- inTable,
33479
- false
33483
+ Boolean(tableNode),
33484
+ false,
33485
+ tableStyleId
33480
33486
  );
33481
33487
  resolvedParagraphPropertiesCache.set(node, paragraphProperties);
33482
33488
  return paragraphProperties;
@@ -38342,7 +38348,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
38342
38348
  const tblPr = styleTag.elements.find((el) => el.name === "w:tblPr");
38343
38349
  if (tblPr && tblPr.elements) {
38344
38350
  if (baseTblPr && baseTblPr.elements) {
38345
- tblPr.elements.push(...baseTblPr.elements);
38351
+ tblPr.elements = [...baseTblPr.elements, ...tblPr.elements];
38346
38352
  }
38347
38353
  const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
38348
38354
  if (tableProperties) {
@@ -42391,7 +42397,7 @@ const _SuperConverter = class _SuperConverter2 {
42391
42397
  static getStoredSuperdocVersion(docx) {
42392
42398
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42393
42399
  }
42394
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.85") {
42400
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.87") {
42395
42401
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42396
42402
  }
42397
42403
  /**
@@ -56557,6 +56563,23 @@ const findTrackedMarkBetween = ({
56557
56563
  };
56558
56564
  }
56559
56565
  });
56566
+ const nodeAtEndPosition = doc2.nodeAt(endPos);
56567
+ if (nodeAtEndPosition?.type?.name === "run") {
56568
+ const node = nodeAtEndPosition.content?.content?.[0];
56569
+ const isTextNode = node?.type?.name === "text";
56570
+ if (isTextNode) {
56571
+ const mark = node.marks.find(
56572
+ (mark2) => mark2.type.name === markName && Object.keys(attrs).every((attr) => mark2.attrs[attr] === attrs[attr])
56573
+ );
56574
+ if (mark && !markFound) {
56575
+ markFound = {
56576
+ from: endPos,
56577
+ to: endPos + node.nodeSize,
56578
+ mark
56579
+ };
56580
+ }
56581
+ }
56582
+ }
56560
56583
  return markFound;
56561
56584
  };
56562
56585
  const markInsertion = ({ tr, from: from2, to, user, date }) => {
@@ -59580,7 +59603,7 @@ const isHeadless = (editor) => {
59580
59603
  const shouldSkipNodeView = (editor) => {
59581
59604
  return isHeadless(editor);
59582
59605
  };
59583
- const summaryVersion = "1.0.0-beta.85";
59606
+ const summaryVersion = "1.0.0-beta.87";
59584
59607
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59585
59608
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59586
59609
  function mapAttributes(attrs) {
@@ -60369,7 +60392,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60369
60392
  { default: remarkStringify },
60370
60393
  { default: remarkGfm }
60371
60394
  ] = await Promise.all([
60372
- Promise.resolve().then(() => require("./index-D8ciXlCs-B1Q8QwX8.cjs")),
60395
+ Promise.resolve().then(() => require("./index-rv7o9043-DD5SvBoC.cjs")),
60373
60396
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60374
60397
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60375
60398
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60574,7 +60597,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60574
60597
  * Process collaboration migrations
60575
60598
  */
60576
60599
  processCollaborationMigrations() {
60577
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.85");
60600
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.87");
60578
60601
  if (!this.options.ydoc) return;
60579
60602
  const metaMap = this.options.ydoc.getMap("meta");
60580
60603
  let docVersion = metaMap.get("version");
@@ -63650,7 +63673,9 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63650
63673
  let cellsChanged = false;
63651
63674
  const newCells = row.cells.map((cell) => {
63652
63675
  let cellChanged = false;
63653
- const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map((cb) => hydrateBlock(cb));
63676
+ const hydratedBlocks = (cell.blocks ?? (cell.paragraph ? [cell.paragraph] : [])).map(
63677
+ (cb) => hydrateBlock(cb)
63678
+ );
63654
63679
  if (cell.blocks && hydratedBlocks !== cell.blocks) {
63655
63680
  cellChanged = true;
63656
63681
  }
@@ -63685,6 +63710,40 @@ function hydrateImageBlocks(blocks, mediaFiles) {
63685
63710
  }
63686
63711
  return blk;
63687
63712
  }
63713
+ if (blk.kind === "drawing") {
63714
+ const drawingBlock = blk;
63715
+ if (drawingBlock.drawingKind !== "shapeGroup") {
63716
+ return blk;
63717
+ }
63718
+ const shapeGroupBlock = drawingBlock;
63719
+ if (!shapeGroupBlock.shapes || shapeGroupBlock.shapes.length === 0) {
63720
+ return blk;
63721
+ }
63722
+ let shapesChanged = false;
63723
+ const hydratedShapes = shapeGroupBlock.shapes.map((shape) => {
63724
+ if (shape.shapeType !== "image") {
63725
+ return shape;
63726
+ }
63727
+ const imageChild = shape;
63728
+ const src = imageChild.attrs?.src;
63729
+ if (!src || src.startsWith("data:")) {
63730
+ return shape;
63731
+ }
63732
+ const resolvedSrc = resolveImageSrc(src);
63733
+ if (resolvedSrc) {
63734
+ shapesChanged = true;
63735
+ return {
63736
+ ...imageChild,
63737
+ attrs: { ...imageChild.attrs, src: resolvedSrc }
63738
+ };
63739
+ }
63740
+ return shape;
63741
+ });
63742
+ if (shapesChanged) {
63743
+ return { ...shapeGroupBlock, shapes: hydratedShapes };
63744
+ }
63745
+ return blk;
63746
+ }
63688
63747
  return blk;
63689
63748
  };
63690
63749
  return hydrateBlock(block);
@@ -73248,6 +73307,7 @@ const renderTableCell = (deps) => {
73248
73307
  cell,
73249
73308
  borders,
73250
73309
  renderLine,
73310
+ renderDrawingContent,
73251
73311
  context,
73252
73312
  applySdtDataset,
73253
73313
  fromLine,
@@ -73390,6 +73450,11 @@ const renderTableCell = (deps) => {
73390
73450
  img.style.height = "100%";
73391
73451
  img.style.objectFit = block.objectFit ?? "contain";
73392
73452
  drawingInner.appendChild(img);
73453
+ } else if (renderDrawingContent) {
73454
+ const drawingContent = renderDrawingContent(block);
73455
+ drawingContent.style.width = "100%";
73456
+ drawingContent.style.height = "100%";
73457
+ drawingInner.appendChild(drawingContent);
73393
73458
  } else {
73394
73459
  const placeholder = doc2.createElement("div");
73395
73460
  placeholder.style.width = "100%";
@@ -73515,6 +73580,7 @@ const renderTableRow = (deps) => {
73515
73580
  allRowHeights,
73516
73581
  context,
73517
73582
  renderLine,
73583
+ renderDrawingContent,
73518
73584
  applySdtDataset,
73519
73585
  continuesFromPrev,
73520
73586
  continuesOnNext,
@@ -73611,6 +73677,7 @@ const renderTableRow = (deps) => {
73611
73677
  cell,
73612
73678
  borders: resolvedBorders,
73613
73679
  renderLine,
73680
+ renderDrawingContent,
73614
73681
  context,
73615
73682
  applySdtDataset,
73616
73683
  fromLine,
@@ -73664,7 +73731,17 @@ function applySdtContainerStyling(doc2, container, sdt, containerSdt) {
73664
73731
  container.appendChild(labelEl);
73665
73732
  }
73666
73733
  const renderTableFragment = (deps) => {
73667
- const { doc: doc2, fragment, blockLookup, context, renderLine, applyFragmentFrame, applySdtDataset, applyStyles: applyStyles2 } = deps;
73734
+ const {
73735
+ doc: doc2,
73736
+ fragment,
73737
+ blockLookup,
73738
+ context,
73739
+ renderLine,
73740
+ renderDrawingContent,
73741
+ applyFragmentFrame,
73742
+ applySdtDataset,
73743
+ applyStyles: applyStyles2
73744
+ } = deps;
73668
73745
  if (!doc2) {
73669
73746
  console.error("DomPainter: document is not available");
73670
73747
  if (typeof document !== "undefined") {
@@ -73794,6 +73871,7 @@ const renderTableFragment = (deps) => {
73794
73871
  allRowHeights,
73795
73872
  context,
73796
73873
  renderLine,
73874
+ renderDrawingContent,
73797
73875
  applySdtDataset,
73798
73876
  // Headers are always rendered as-is (no border suppression)
73799
73877
  continuesFromPrev: false,
@@ -73823,6 +73901,7 @@ const renderTableFragment = (deps) => {
73823
73901
  allRowHeights,
73824
73902
  context,
73825
73903
  renderLine,
73904
+ renderDrawingContent,
73826
73905
  applySdtDataset,
73827
73906
  // Draw top border if table continues from previous fragment (MS Word behavior)
73828
73907
  continuesFromPrev: isFirstRenderedBodyRow && fragment.continuesFromPrev === true,
@@ -76065,12 +76144,25 @@ const _DomPainter = class _DomPainter2 {
76065
76144
  const renderLineForTableCell = (block, line, ctx2) => {
76066
76145
  return this.renderLine(block, line, ctx2, void 0, void 0, true);
76067
76146
  };
76147
+ const renderDrawingContentForTableCell = (block) => {
76148
+ if (block.drawingKind === "image") {
76149
+ return this.createDrawingImageElement(block);
76150
+ }
76151
+ if (block.drawingKind === "shapeGroup") {
76152
+ return this.createShapeGroupElement(block);
76153
+ }
76154
+ if (block.drawingKind === "vectorShape") {
76155
+ return this.createVectorShapeElement(block, block.geometry, false);
76156
+ }
76157
+ return this.createDrawingPlaceholder();
76158
+ };
76068
76159
  return renderTableFragment({
76069
76160
  doc: this.doc,
76070
76161
  fragment,
76071
76162
  context,
76072
76163
  blockLookup: this.blockLookup,
76073
76164
  renderLine: renderLineForTableCell,
76165
+ renderDrawingContent: renderDrawingContentForTableCell,
76074
76166
  applyFragmentFrame: applyFragmentFrameWithSection,
76075
76167
  applySdtDataset: this.applySdtDataset.bind(this),
76076
76168
  applyStyles: applyStyles$2
@@ -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-JgEU6dRK.js";
3
- import { _ as _export_sfc } from "./chunks/editor-tcvFrXO7.js";
2
+ import { T as TextSelection } from "./chunks/converter-G519mwN2.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-BQsR9BR1.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 = {}) {