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

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-Cl8-bF2d.es.js → PdfViewer-gQqtBsXT.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-otVXTOCF.cjs → PdfViewer-kLZVOUbz.cjs} +1 -1
  3. package/dist/chunks/{index-Da8gsiup.es.js → index-CNPZHNDf.es.js} +3 -3
  4. package/dist/chunks/{index-dhmURjT9-eBXRY_y8.cjs → index-GF5Urhpn-BNFw-VyP.cjs} +1 -1
  5. package/dist/chunks/{index-dhmURjT9-C4FbtHG8.es.js → index-GF5Urhpn-LFkKkWot.es.js} +1 -1
  6. package/dist/chunks/{index-DvRDR0Q1.cjs → index-cUgy4sJN.cjs} +3 -3
  7. package/dist/chunks/{super-editor.es-BPfJzTNn.cjs → super-editor.es-44RL9-Ca.cjs} +32753 -32321
  8. package/dist/chunks/{super-editor.es-Bo6Jt_tq.es.js → super-editor.es-DfLaDbHA.es.js} +32753 -32321
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-Cww1mCyd.js → converter-Bfu1F5pk.js} +91 -26
  11. package/dist/super-editor/chunks/{docx-zipper-BlOp_CYx.js → docx-zipper-Cl08Z_S_.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-D3MjMYeX.js → editor-CwTMBaym.js} +33580 -33076
  13. package/dist/super-editor/chunks/{index-dhmURjT9.js → index-GF5Urhpn.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CuJJlHlv.js → toolbar-DZTp7DIF.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 +32743 -32311
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -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-Bfu1F5pk.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CwTMBaym.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.82") {
42630
42695
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
42631
42696
  }
42632
42697
  /**
@@ -43358,8 +43423,8 @@ export {
43358
43423
  twipsToLines as a7,
43359
43424
  pixelsToTwips as a8,
43360
43425
  helpers as a9,
43361
- SelectionRange as aA,
43362
- Transform as aB,
43426
+ InputRule as aA,
43427
+ convertSizeToCSS as aB,
43363
43428
  findParentNodeClosestToPos as aC,
43364
43429
  isInTable as aD,
43365
43430
  generateDocxRandomId as aE,
@@ -43384,23 +43449,23 @@ export {
43384
43449
  EditorState as ag,
43385
43450
  isActive as ah,
43386
43451
  unflattenListsInHtml as ai,
43387
- resolveParagraphProperties as aj,
43388
- _getReferencedTableStyles as ak,
43389
- parseSizeUnit as al,
43390
- minMax as am,
43391
- updateDOMAttributes as an,
43392
- findChildren as ao,
43393
- generateRandomSigned32BitIntStrId as ap,
43394
- decodeRPrFromMarks as aq,
43395
- calculateResolvedParagraphProperties as ar,
43396
- resolveRunProperties as as,
43397
- encodeCSSFromPPr as at,
43398
- twipsToPixels as au,
43399
- encodeCSSFromRPr as av,
43400
- generateOrderedListIndex as aw,
43401
- docxNumberingHelpers as ax,
43402
- InputRule as ay,
43403
- convertSizeToCSS as az,
43452
+ SelectionRange as aj,
43453
+ Transform as ak,
43454
+ resolveParagraphProperties as al,
43455
+ _getReferencedTableStyles as am,
43456
+ parseSizeUnit as an,
43457
+ minMax as ao,
43458
+ updateDOMAttributes as ap,
43459
+ findChildren as aq,
43460
+ generateRandomSigned32BitIntStrId as ar,
43461
+ decodeRPrFromMarks as as,
43462
+ calculateResolvedParagraphProperties as at,
43463
+ resolveRunProperties as au,
43464
+ encodeCSSFromPPr as av,
43465
+ twipsToPixels as aw,
43466
+ encodeCSSFromRPr as ax,
43467
+ generateOrderedListIndex as ay,
43468
+ docxNumberingHelpers as az,
43404
43469
  Slice as b,
43405
43470
  DOMParser$1 as c,
43406
43471
  Mark as d,
@@ -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-Bfu1F5pk.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
  }