@harbour-enterprises/superdoc 1.0.0-beta.80 → 1.0.0-beta.81

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-otVXTOCF.cjs → PdfViewer-BQvWj9WT.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-Cl8-bF2d.es.js → PdfViewer-Ctnh2N_O.es.js} +1 -1
  3. package/dist/chunks/{index-DvRDR0Q1.cjs → index-BbmC10xF.cjs} +3 -3
  4. package/dist/chunks/{index-Da8gsiup.es.js → index-C-Pdo0ND.es.js} +3 -3
  5. package/dist/chunks/{index-dhmURjT9-eBXRY_y8.cjs → index-IjeMBukf-BVs_Hga_.cjs} +1 -1
  6. package/dist/chunks/{index-dhmURjT9-C4FbtHG8.es.js → index-IjeMBukf-dEWPAX8f.es.js} +1 -1
  7. package/dist/chunks/{super-editor.es-Bo6Jt_tq.es.js → super-editor.es-CO8LXugA.es.js} +85 -12
  8. package/dist/chunks/{super-editor.es-BPfJzTNn.cjs → super-editor.es-D3uoIURW.cjs} +85 -12
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Cww1mCyd.js → converter-CbcgpI3f.js} +72 -7
  11. package/dist/super-editor/chunks/{docx-zipper-BlOp_CYx.js → docx-zipper-2XxpGSAi.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-D3MjMYeX.js → editor-y07m2wx4.js} +15 -7
  13. package/dist/super-editor/chunks/{index-dhmURjT9.js → index-IjeMBukf.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CuJJlHlv.js → toolbar-ClrfxKAI.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 +87 -14
  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-DvRDR0Q1.cjs");
4
+ const superdoc = require("./index-BbmC10xF.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-Da8gsiup.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-C-Pdo0ND.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-BPfJzTNn.cjs");
2
+ const superEditor_es = require("./super-editor.es-D3uoIURW.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-otVXTOCF.cjs")));
17271
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-BQvWj9WT.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.80";
18160
+ this.version = "1.0.0-beta.81";
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,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-Bo6Jt_tq.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-CO8LXugA.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-Cl8-bF2d.es.js"));
17254
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-Ctnh2N_O.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.80";
18143
+ this.version = "1.0.0-beta.81";
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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./super-editor.es-BPfJzTNn.cjs");
3
+ const superEditor_es = require("./super-editor.es-D3uoIURW.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-Bo6Jt_tq.es.js";
1
+ import { s as getDefaultExportFromCjs$2 } from "./super-editor.es-CO8LXugA.es.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG-CvBqQJbG.es.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -40202,26 +40202,40 @@ const tabNodeEntityHandler = {
40202
40202
  };
40203
40203
  const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
40204
40204
  const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$5);
40205
- function preProcessPageInstruction(nodesToCombine) {
40205
+ function preProcessPageInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40206
40206
  const pageNumNode = {
40207
40207
  name: "sd:autoPageNumber",
40208
40208
  type: "element"
40209
40209
  };
40210
+ let foundContentRPr = false;
40210
40211
  nodesToCombine.forEach((n) => {
40211
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
40212
- if (rPrNode) pageNumNode.elements = [rPrNode];
40212
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40213
+ if (rPrNode) {
40214
+ pageNumNode.elements = [rPrNode];
40215
+ foundContentRPr = true;
40216
+ }
40213
40217
  });
40218
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40219
+ pageNumNode.elements = [fieldRunRPr];
40220
+ }
40214
40221
  return [pageNumNode];
40215
40222
  }
40216
- function preProcessNumPagesInstruction(nodesToCombine) {
40223
+ function preProcessNumPagesInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40217
40224
  const totalPageNumNode = {
40218
40225
  name: "sd:totalPageNumber",
40219
40226
  type: "element"
40220
40227
  };
40228
+ let foundContentRPr = false;
40221
40229
  nodesToCombine.forEach((n) => {
40222
40230
  const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40223
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
40231
+ if (rPrNode) {
40232
+ totalPageNumNode.elements = [rPrNode];
40233
+ foundContentRPr = true;
40234
+ }
40224
40235
  });
40236
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40237
+ totalPageNumNode.elements = [fieldRunRPr];
40238
+ }
40225
40239
  return [totalPageNumNode];
40226
40240
  }
40227
40241
  function preProcessPageRefInstruction(nodesToCombine, instrText) {
@@ -40428,7 +40442,7 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
40428
40442
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
40429
40443
  const preprocessor = fieldInfo.fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
40430
40444
  const contentNodes = fieldInfo.contentNodes;
40431
- const processedField = preprocessor(contentNodes, fieldInfo.instrText);
40445
+ const processedField = preprocessor(contentNodes, fieldInfo.instrText, fieldInfo.fieldRunRPr);
40432
40446
  processedNodes.push(...processedField);
40433
40447
  i = fieldInfo.endIndex + 1;
40434
40448
  continue;
@@ -40461,6 +40475,12 @@ function scanFieldSequence(nodes, beginIndex) {
40461
40475
  let separateIndex = -1;
40462
40476
  let endIndex = -1;
40463
40477
  const contentNodes = [];
40478
+ let fieldRunRPr = null;
40479
+ const beginNode = nodes[beginIndex];
40480
+ const beginRPr = beginNode.elements?.find((el) => el.name === "w:rPr");
40481
+ if (beginRPr && hasSignificantStyling(beginRPr)) {
40482
+ fieldRunRPr = beginRPr;
40483
+ }
40464
40484
  for (let i = beginIndex + 1; i < nodes.length; i++) {
40465
40485
  const node = nodes[i];
40466
40486
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
@@ -40469,6 +40489,12 @@ function scanFieldSequence(nodes, beginIndex) {
40469
40489
  if (instrTextEl) {
40470
40490
  instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40471
40491
  }
40492
+ if (!fieldRunRPr || separateIndex === -1 && fldType !== "end") {
40493
+ const rPrNode = node.elements?.find((el) => el.name === "w:rPr");
40494
+ if (rPrNode && hasSignificantStyling(rPrNode)) {
40495
+ fieldRunRPr = rPrNode;
40496
+ }
40497
+ }
40472
40498
  if (fldType === "separate") {
40473
40499
  separateIndex = i;
40474
40500
  } else if (fldType === "end") {
@@ -40486,9 +40512,48 @@ function scanFieldSequence(nodes, beginIndex) {
40486
40512
  fieldType,
40487
40513
  instrText: instrText.trim(),
40488
40514
  contentNodes,
40515
+ fieldRunRPr,
40489
40516
  endIndex
40490
40517
  };
40491
40518
  }
40519
+ function hasSignificantStyling(rPrNode) {
40520
+ if (!rPrNode?.elements?.length) {
40521
+ return false;
40522
+ }
40523
+ const significantElements = [
40524
+ "w:rStyle",
40525
+ // Run style reference (Word commonly uses this for page number formatting)
40526
+ "w:rFonts",
40527
+ // Font family
40528
+ "w:sz",
40529
+ // Font size
40530
+ "w:szCs",
40531
+ // Complex script font size
40532
+ "w:b",
40533
+ // Bold
40534
+ "w:bCs",
40535
+ // Complex script bold
40536
+ "w:i",
40537
+ // Italic
40538
+ "w:iCs",
40539
+ // Complex script italic
40540
+ "w:u",
40541
+ // Underline
40542
+ "w:color",
40543
+ // Font color
40544
+ "w:highlight",
40545
+ // Highlight color
40546
+ "w:strike",
40547
+ // Strikethrough
40548
+ "w:dstrike",
40549
+ // Double strikethrough
40550
+ "w:caps",
40551
+ // All caps
40552
+ "w:smallCaps"
40553
+ // Small caps
40554
+ ];
40555
+ return rPrNode.elements.some((el) => significantElements.includes(el.name));
40556
+ }
40492
40557
  const commentRangeStartHandlerEntity = generateV2HandlerEntity(
40493
40558
  "commentRangeStartHandler",
40494
40559
  commentRangeStartTranslator
@@ -42309,7 +42374,7 @@ const _SuperConverter = class _SuperConverter2 {
42309
42374
  static getStoredSuperdocVersion(docx) {
42310
42375
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42311
42376
  }
42312
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.80") {
42377
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.81") {
42313
42378
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42314
42379
  }
42315
42380
  /**
@@ -59498,7 +59563,7 @@ const isHeadless = (editor) => {
59498
59563
  const shouldSkipNodeView = (editor) => {
59499
59564
  return isHeadless(editor);
59500
59565
  };
59501
- const summaryVersion = "1.0.0-beta.80";
59566
+ const summaryVersion = "1.0.0-beta.81";
59502
59567
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59503
59568
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59504
59569
  function mapAttributes(attrs) {
@@ -60287,7 +60352,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60287
60352
  { default: remarkStringify },
60288
60353
  { default: remarkGfm }
60289
60354
  ] = await Promise.all([
60290
- import("./index-dhmURjT9-C4FbtHG8.es.js"),
60355
+ import("./index-IjeMBukf-dEWPAX8f.es.js"),
60291
60356
  import("./index-DRCvimau-Cw339678.es.js"),
60292
60357
  import("./index-C_x_N6Uh-DJn8hIEt.es.js"),
60293
60358
  import("./index-D_sWOSiG-DE96TaT5.es.js"),
@@ -60492,7 +60557,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60492
60557
  * Process collaboration migrations
60493
60558
  */
60494
60559
  processCollaborationMigrations() {
60495
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.80");
60560
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.81");
60496
60561
  if (!this.options.ydoc) return;
60497
60562
  const metaMap = this.options.ydoc.getMap("meta");
60498
60563
  let docVersion = metaMap.get("version");
@@ -62699,7 +62764,10 @@ function tokenNodeToRun(node, positions, defaultFont, defaultSize, inheritedMark
62699
62764
  run2.pmStart = pos.start;
62700
62765
  run2.pmEnd = pos.end;
62701
62766
  }
62702
- const marks = [...node.marks ?? [], ...inheritedMarks ?? []];
62767
+ const nodeMarks = node.marks ?? [];
62768
+ const marksAsAttrs = Array.isArray(node.attrs?.marksAsAttrs) ? node.attrs.marksAsAttrs : [];
62769
+ const effectiveMarks = nodeMarks.length > 0 ? nodeMarks : marksAsAttrs;
62770
+ const marks = [...effectiveMarks, ...inheritedMarks ?? []];
62703
62771
  applyMarksToRun(run2, marks, hyperlinkConfig, themeColors);
62704
62772
  return run2;
62705
62773
  }
@@ -84031,10 +84099,15 @@ getBlocks_fn = function(descriptor) {
84031
84099
  const providedMedia = __privateGet$1(this, _mediaFiles);
84032
84100
  const fallbackMedia = rootConverter?.media;
84033
84101
  const mediaFiles = providedMedia && Object.keys(providedMedia).length > 0 ? providedMedia : fallbackMedia;
84102
+ const docDefaults = rootConverter?.getDocumentDefaultStyles?.();
84103
+ const defaultFont = docDefaults?.typeface;
84104
+ const defaultSize = docDefaults?.fontSizePt != null ? docDefaults.fontSizePt * (96 / 72) : void 0;
84034
84105
  const result = toFlowBlocks(doc2, {
84035
84106
  mediaFiles,
84036
84107
  blockIdPrefix,
84037
- converterContext
84108
+ converterContext,
84109
+ defaultFont,
84110
+ defaultSize
84038
84111
  });
84039
84112
  const blocks = result.blocks;
84040
84113
  __privateGet$1(this, _blockCache).set(descriptor.id, { docRef: doc2, blocks });
@@ -40219,26 +40219,40 @@ const tabNodeEntityHandler = {
40219
40219
  };
40220
40220
  const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
40221
40221
  const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$5);
40222
- function preProcessPageInstruction(nodesToCombine) {
40222
+ function preProcessPageInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40223
40223
  const pageNumNode = {
40224
40224
  name: "sd:autoPageNumber",
40225
40225
  type: "element"
40226
40226
  };
40227
+ let foundContentRPr = false;
40227
40228
  nodesToCombine.forEach((n) => {
40228
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
40229
- if (rPrNode) pageNumNode.elements = [rPrNode];
40229
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40230
+ if (rPrNode) {
40231
+ pageNumNode.elements = [rPrNode];
40232
+ foundContentRPr = true;
40233
+ }
40230
40234
  });
40235
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40236
+ pageNumNode.elements = [fieldRunRPr];
40237
+ }
40231
40238
  return [pageNumNode];
40232
40239
  }
40233
- function preProcessNumPagesInstruction(nodesToCombine) {
40240
+ function preProcessNumPagesInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40234
40241
  const totalPageNumNode = {
40235
40242
  name: "sd:totalPageNumber",
40236
40243
  type: "element"
40237
40244
  };
40245
+ let foundContentRPr = false;
40238
40246
  nodesToCombine.forEach((n) => {
40239
40247
  const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40240
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
40248
+ if (rPrNode) {
40249
+ totalPageNumNode.elements = [rPrNode];
40250
+ foundContentRPr = true;
40251
+ }
40241
40252
  });
40253
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40254
+ totalPageNumNode.elements = [fieldRunRPr];
40255
+ }
40242
40256
  return [totalPageNumNode];
40243
40257
  }
40244
40258
  function preProcessPageRefInstruction(nodesToCombine, instrText) {
@@ -40445,7 +40459,7 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
40445
40459
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
40446
40460
  const preprocessor = fieldInfo.fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
40447
40461
  const contentNodes = fieldInfo.contentNodes;
40448
- const processedField = preprocessor(contentNodes, fieldInfo.instrText);
40462
+ const processedField = preprocessor(contentNodes, fieldInfo.instrText, fieldInfo.fieldRunRPr);
40449
40463
  processedNodes.push(...processedField);
40450
40464
  i = fieldInfo.endIndex + 1;
40451
40465
  continue;
@@ -40478,6 +40492,12 @@ function scanFieldSequence(nodes, beginIndex) {
40478
40492
  let separateIndex = -1;
40479
40493
  let endIndex = -1;
40480
40494
  const contentNodes = [];
40495
+ let fieldRunRPr = null;
40496
+ const beginNode = nodes[beginIndex];
40497
+ const beginRPr = beginNode.elements?.find((el) => el.name === "w:rPr");
40498
+ if (beginRPr && hasSignificantStyling(beginRPr)) {
40499
+ fieldRunRPr = beginRPr;
40500
+ }
40481
40501
  for (let i = beginIndex + 1; i < nodes.length; i++) {
40482
40502
  const node = nodes[i];
40483
40503
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
@@ -40486,6 +40506,12 @@ function scanFieldSequence(nodes, beginIndex) {
40486
40506
  if (instrTextEl) {
40487
40507
  instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40488
40508
  }
40509
+ if (!fieldRunRPr || separateIndex === -1 && fldType !== "end") {
40510
+ const rPrNode = node.elements?.find((el) => el.name === "w:rPr");
40511
+ if (rPrNode && hasSignificantStyling(rPrNode)) {
40512
+ fieldRunRPr = rPrNode;
40513
+ }
40514
+ }
40489
40515
  if (fldType === "separate") {
40490
40516
  separateIndex = i;
40491
40517
  } else if (fldType === "end") {
@@ -40503,9 +40529,48 @@ function scanFieldSequence(nodes, beginIndex) {
40503
40529
  fieldType,
40504
40530
  instrText: instrText.trim(),
40505
40531
  contentNodes,
40532
+ fieldRunRPr,
40506
40533
  endIndex
40507
40534
  };
40508
40535
  }
40536
+ function hasSignificantStyling(rPrNode) {
40537
+ if (!rPrNode?.elements?.length) {
40538
+ return false;
40539
+ }
40540
+ const significantElements = [
40541
+ "w:rStyle",
40542
+ // Run style reference (Word commonly uses this for page number formatting)
40543
+ "w:rFonts",
40544
+ // Font family
40545
+ "w:sz",
40546
+ // Font size
40547
+ "w:szCs",
40548
+ // Complex script font size
40549
+ "w:b",
40550
+ // Bold
40551
+ "w:bCs",
40552
+ // Complex script bold
40553
+ "w:i",
40554
+ // Italic
40555
+ "w:iCs",
40556
+ // Complex script italic
40557
+ "w:u",
40558
+ // Underline
40559
+ "w:color",
40560
+ // Font color
40561
+ "w:highlight",
40562
+ // Highlight color
40563
+ "w:strike",
40564
+ // Strikethrough
40565
+ "w:dstrike",
40566
+ // Double strikethrough
40567
+ "w:caps",
40568
+ // All caps
40569
+ "w:smallCaps"
40570
+ // Small caps
40571
+ ];
40572
+ return rPrNode.elements.some((el) => significantElements.includes(el.name));
40573
+ }
40509
40574
  const commentRangeStartHandlerEntity = generateV2HandlerEntity(
40510
40575
  "commentRangeStartHandler",
40511
40576
  commentRangeStartTranslator
@@ -42326,7 +42391,7 @@ const _SuperConverter = class _SuperConverter2 {
42326
42391
  static getStoredSuperdocVersion(docx) {
42327
42392
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
42328
42393
  }
42329
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.80") {
42394
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.0.0-beta.81") {
42330
42395
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
42331
42396
  }
42332
42397
  /**
@@ -59515,7 +59580,7 @@ const isHeadless = (editor) => {
59515
59580
  const shouldSkipNodeView = (editor) => {
59516
59581
  return isHeadless(editor);
59517
59582
  };
59518
- const summaryVersion = "1.0.0-beta.80";
59583
+ const summaryVersion = "1.0.0-beta.81";
59519
59584
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
59520
59585
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
59521
59586
  function mapAttributes(attrs) {
@@ -60304,7 +60369,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60304
60369
  { default: remarkStringify },
60305
60370
  { default: remarkGfm }
60306
60371
  ] = await Promise.all([
60307
- Promise.resolve().then(() => require("./index-dhmURjT9-eBXRY_y8.cjs")),
60372
+ Promise.resolve().then(() => require("./index-IjeMBukf-BVs_Hga_.cjs")),
60308
60373
  Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
60309
60374
  Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
60310
60375
  Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
@@ -60509,7 +60574,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60509
60574
  * Process collaboration migrations
60510
60575
  */
60511
60576
  processCollaborationMigrations() {
60512
- console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.80");
60577
+ console.debug("[checkVersionMigrations] Current editor version", "1.0.0-beta.81");
60513
60578
  if (!this.options.ydoc) return;
60514
60579
  const metaMap = this.options.ydoc.getMap("meta");
60515
60580
  let docVersion = metaMap.get("version");
@@ -62716,7 +62781,10 @@ function tokenNodeToRun(node, positions, defaultFont, defaultSize, inheritedMark
62716
62781
  run2.pmStart = pos.start;
62717
62782
  run2.pmEnd = pos.end;
62718
62783
  }
62719
- const marks = [...node.marks ?? [], ...inheritedMarks ?? []];
62784
+ const nodeMarks = node.marks ?? [];
62785
+ const marksAsAttrs = Array.isArray(node.attrs?.marksAsAttrs) ? node.attrs.marksAsAttrs : [];
62786
+ const effectiveMarks = nodeMarks.length > 0 ? nodeMarks : marksAsAttrs;
62787
+ const marks = [...effectiveMarks, ...inheritedMarks ?? []];
62720
62788
  applyMarksToRun(run2, marks, hyperlinkConfig, themeColors);
62721
62789
  return run2;
62722
62790
  }
@@ -84048,10 +84116,15 @@ getBlocks_fn = function(descriptor) {
84048
84116
  const providedMedia = __privateGet$1(this, _mediaFiles);
84049
84117
  const fallbackMedia = rootConverter?.media;
84050
84118
  const mediaFiles = providedMedia && Object.keys(providedMedia).length > 0 ? providedMedia : fallbackMedia;
84119
+ const docDefaults = rootConverter?.getDocumentDefaultStyles?.();
84120
+ const defaultFont = docDefaults?.typeface;
84121
+ const defaultSize = docDefaults?.fontSizePt != null ? docDefaults.fontSizePt * (96 / 72) : void 0;
84051
84122
  const result = toFlowBlocks(doc2, {
84052
84123
  mediaFiles,
84053
84124
  blockIdPrefix,
84054
- converterContext
84125
+ converterContext,
84126
+ defaultFont,
84127
+ defaultSize
84055
84128
  });
84056
84129
  const blocks = result.blocks;
84057
84130
  __privateGet$1(this, _blockCache).set(descriptor.id, { docRef: doc2, blocks });
@@ -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-Cww1mCyd.js";
3
- import { _ as _export_sfc } from "./chunks/editor-D3MjMYeX.js";
2
+ import { T as TextSelection } from "./chunks/converter-CbcgpI3f.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-y07m2wx4.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 = {}) {
@@ -40483,26 +40483,40 @@ const tabNodeEntityHandler = {
40483
40483
  };
40484
40484
  const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
40485
40485
  const tableOfContentsHandlerEntity = generateV2HandlerEntity("tableOfContentsHandler", translator$5);
40486
- function preProcessPageInstruction(nodesToCombine) {
40486
+ function preProcessPageInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40487
40487
  const pageNumNode = {
40488
40488
  name: "sd:autoPageNumber",
40489
40489
  type: "element"
40490
40490
  };
40491
+ let foundContentRPr = false;
40491
40492
  nodesToCombine.forEach((n) => {
40492
- const rPrNode = n.elements.find((el) => el.name === "w:rPr");
40493
- if (rPrNode) pageNumNode.elements = [rPrNode];
40493
+ const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40494
+ if (rPrNode) {
40495
+ pageNumNode.elements = [rPrNode];
40496
+ foundContentRPr = true;
40497
+ }
40494
40498
  });
40499
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40500
+ pageNumNode.elements = [fieldRunRPr];
40501
+ }
40495
40502
  return [pageNumNode];
40496
40503
  }
40497
- function preProcessNumPagesInstruction(nodesToCombine) {
40504
+ function preProcessNumPagesInstruction(nodesToCombine, _instrText, fieldRunRPr = null) {
40498
40505
  const totalPageNumNode = {
40499
40506
  name: "sd:totalPageNumber",
40500
40507
  type: "element"
40501
40508
  };
40509
+ let foundContentRPr = false;
40502
40510
  nodesToCombine.forEach((n) => {
40503
40511
  const rPrNode = n.elements?.find((el) => el.name === "w:rPr");
40504
- if (rPrNode) totalPageNumNode.elements = [rPrNode];
40512
+ if (rPrNode) {
40513
+ totalPageNumNode.elements = [rPrNode];
40514
+ foundContentRPr = true;
40515
+ }
40505
40516
  });
40517
+ if (!foundContentRPr && fieldRunRPr && fieldRunRPr.name === "w:rPr") {
40518
+ totalPageNumNode.elements = [fieldRunRPr];
40519
+ }
40506
40520
  return [totalPageNumNode];
40507
40521
  }
40508
40522
  function preProcessPageRefInstruction(nodesToCombine, instrText) {
@@ -40709,7 +40723,7 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
40709
40723
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
40710
40724
  const preprocessor = fieldInfo.fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
40711
40725
  const contentNodes = fieldInfo.contentNodes;
40712
- const processedField = preprocessor(contentNodes, fieldInfo.instrText);
40726
+ const processedField = preprocessor(contentNodes, fieldInfo.instrText, fieldInfo.fieldRunRPr);
40713
40727
  processedNodes.push(...processedField);
40714
40728
  i = fieldInfo.endIndex + 1;
40715
40729
  continue;
@@ -40742,6 +40756,12 @@ function scanFieldSequence(nodes, beginIndex) {
40742
40756
  let separateIndex = -1;
40743
40757
  let endIndex = -1;
40744
40758
  const contentNodes = [];
40759
+ let fieldRunRPr = null;
40760
+ const beginNode = nodes[beginIndex];
40761
+ const beginRPr = beginNode.elements?.find((el) => el.name === "w:rPr");
40762
+ if (beginRPr && hasSignificantStyling(beginRPr)) {
40763
+ fieldRunRPr = beginRPr;
40764
+ }
40745
40765
  for (let i = beginIndex + 1; i < nodes.length; i++) {
40746
40766
  const node = nodes[i];
40747
40767
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
@@ -40750,6 +40770,12 @@ function scanFieldSequence(nodes, beginIndex) {
40750
40770
  if (instrTextEl) {
40751
40771
  instrText += (instrTextEl.elements?.[0]?.text || "") + " ";
40752
40772
  }
40773
+ if (!fieldRunRPr || separateIndex === -1 && fldType !== "end") {
40774
+ const rPrNode = node.elements?.find((el) => el.name === "w:rPr");
40775
+ if (rPrNode && hasSignificantStyling(rPrNode)) {
40776
+ fieldRunRPr = rPrNode;
40777
+ }
40778
+ }
40753
40779
  if (fldType === "separate") {
40754
40780
  separateIndex = i;
40755
40781
  } else if (fldType === "end") {
@@ -40767,9 +40793,48 @@ function scanFieldSequence(nodes, beginIndex) {
40767
40793
  fieldType,
40768
40794
  instrText: instrText.trim(),
40769
40795
  contentNodes,
40796
+ fieldRunRPr,
40770
40797
  endIndex
40771
40798
  };
40772
40799
  }
40800
+ function hasSignificantStyling(rPrNode) {
40801
+ if (!rPrNode?.elements?.length) {
40802
+ return false;
40803
+ }
40804
+ const significantElements = [
40805
+ "w:rStyle",
40806
+ // Run style reference (Word commonly uses this for page number formatting)
40807
+ "w:rFonts",
40808
+ // Font family
40809
+ "w:sz",
40810
+ // Font size
40811
+ "w:szCs",
40812
+ // Complex script font size
40813
+ "w:b",
40814
+ // Bold
40815
+ "w:bCs",
40816
+ // Complex script bold
40817
+ "w:i",
40818
+ // Italic
40819
+ "w:iCs",
40820
+ // Complex script italic
40821
+ "w:u",
40822
+ // Underline
40823
+ "w:color",
40824
+ // Font color
40825
+ "w:highlight",
40826
+ // Highlight color
40827
+ "w:strike",
40828
+ // Strikethrough
40829
+ "w:dstrike",
40830
+ // Double strikethrough
40831
+ "w:caps",
40832
+ // All caps
40833
+ "w:smallCaps"
40834
+ // Small caps
40835
+ ];
40836
+ return rPrNode.elements.some((el) => significantElements.includes(el.name));
40837
+ }
40773
40838
  const commentRangeStartHandlerEntity = generateV2HandlerEntity(
40774
40839
  "commentRangeStartHandler",
40775
40840
  commentRangeStartTranslator
@@ -42626,7 +42691,7 @@ const _SuperConverter = class _SuperConverter {
42626
42691
  static getStoredSuperdocVersion(docx) {
42627
42692
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
42628
42693
  }
42629
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.80") {
42694
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.0.0-beta.81") {
42630
42695
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42631
42696
  }
42632
42697
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-Cww1mCyd.js";
1
+ import { p as process$1, aJ as commonjsGlobal, B as Buffer, aK as getDefaultExportFromCjs, aL as getContentTypesFromXml, aM as xmljs } from "./converter-CbcgpI3f.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
  }