@superdoc-dev/mcp 0.3.0-next.60 → 0.3.0-next.62

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 (2) hide show
  1. package/dist/index.js +612 -87
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -51837,7 +51837,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
51837
51837
  emptyOptions2 = {};
51838
51838
  });
51839
51839
 
51840
- // ../../packages/superdoc/dist/chunks/SuperConverter-ing-1fvK.es.js
51840
+ // ../../packages/superdoc/dist/chunks/SuperConverter-BLL9JGke.es.js
51841
51841
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
51842
51842
  const fieldValue = extension$1.config[field];
51843
51843
  if (typeof fieldValue === "function")
@@ -95639,13 +95639,14 @@ var isRegExp = (value) => {
95639
95639
  default:
95640
95640
  return null;
95641
95641
  }
95642
- }, SKIP_FIELD_PROCESSING_NODE_NAMES$1, shouldSkipFieldProcessing$1 = (node2) => SKIP_FIELD_PROCESSING_NODE_NAMES$1.has(node2?.name), preProcessNodesForFldChar = (nodes = [], docx) => {
95642
+ }, TRACK_CHANGE_ELEMENT_NAMES, TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES, isTrackChangeElement = (node2) => TRACK_CHANGE_ELEMENT_NAMES.has(node2?.name), isTranslatedTrackChangeElement = (node2) => TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES.has(node2?.name), SKIP_FIELD_PROCESSING_NODE_NAMES$1, shouldSkipFieldProcessing$1 = (node2) => SKIP_FIELD_PROCESSING_NODE_NAMES$1.has(node2?.name), preProcessNodesForFldChar = (nodes = [], docx) => {
95643
95643
  const processedNodes = [];
95644
95644
  let collectedNodesStack = [];
95645
95645
  let rawCollectedNodesStack = [];
95646
95646
  let fieldRunRPrStack = [];
95647
95647
  let currentFieldStack = [];
95648
95648
  let unpairedEnd = null;
95649
+ let unpairedEndPreserveRaw = null;
95649
95650
  let collecting = false;
95650
95651
  const rawNodeSourceTokens = /* @__PURE__ */ new WeakMap;
95651
95652
  const finalizeField = () => {
@@ -95654,8 +95655,11 @@ var isRegExp = (value) => {
95654
95655
  const rawCollectedNodes = rawCollectedNodesStack.pop().filter((n) => n !== null);
95655
95656
  const fieldRunRPr = fieldRunRPrStack.pop() ?? null;
95656
95657
  const currentField = currentFieldStack.pop();
95657
- const combinedResult = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
95658
- const outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
95658
+ let outputNodes = rawCollectedNodes;
95659
+ if (!currentField.preserveRaw) {
95660
+ const combinedResult = _processCombinedNodesForFldChar(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
95661
+ outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
95662
+ }
95659
95663
  if (collectedNodesStack.length === 0)
95660
95664
  processedNodes.push(...outputNodes);
95661
95665
  else {
@@ -95763,7 +95767,10 @@ var isRegExp = (value) => {
95763
95767
  node2.elements = childResult.processedNodes;
95764
95768
  if (childResult.unpairedBegin)
95765
95769
  childResult.unpairedBegin.forEach((pendingField) => {
95766
- currentFieldStack.push(pendingField.fieldInfo);
95770
+ const fieldInfo = { ...pendingField.fieldInfo };
95771
+ if (fieldInfo.preserveRaw || isTrackChangeElement(node2))
95772
+ fieldInfo.preserveRaw = true;
95773
+ currentFieldStack.push(fieldInfo);
95767
95774
  collectedNodesStack.push([node2]);
95768
95775
  const rawStack = [rawNode];
95769
95776
  rawCollectedNodesStack.push(rawStack);
@@ -95771,6 +95778,16 @@ var isRegExp = (value) => {
95771
95778
  capturedRawNodes.add(rawNode);
95772
95779
  });
95773
95780
  else if (childResult.unpairedEnd) {
95781
+ const shouldPreserveRaw = childResult.unpairedEndPreserveRaw || isTrackChangeElement(node2);
95782
+ if (collectedNodesStack.length === 0) {
95783
+ processedNodes.push(shouldPreserveRaw ? rawNode : node2);
95784
+ unpairedEnd = true;
95785
+ if (shouldPreserveRaw)
95786
+ unpairedEndPreserveRaw = true;
95787
+ return;
95788
+ }
95789
+ if (shouldPreserveRaw)
95790
+ currentFieldStack[currentFieldStack.length - 1].preserveRaw = true;
95774
95791
  collectedNodesStack[collectedNodesStack.length - 1].push(node2);
95775
95792
  captureRawNodeForCurrentField(rawNode, capturedRawNodes, rawSourceToken);
95776
95793
  finalizeField();
@@ -95809,7 +95826,8 @@ var isRegExp = (value) => {
95809
95826
  return {
95810
95827
  processedNodes,
95811
95828
  unpairedBegin,
95812
- unpairedEnd
95829
+ unpairedEnd,
95830
+ unpairedEndPreserveRaw
95813
95831
  };
95814
95832
  }, _processCombinedNodesForFldChar = (nodesToCombine = [], instrText, docx, instructionTokens, fieldRunRPr) => {
95815
95833
  const instructionType = instrText.trim().split(" ")[0];
@@ -101991,10 +102009,10 @@ var isRegExp = (value) => {
101991
102009
  }
101992
102010
  });
101993
102011
  return subs;
101994
- }, config$5, translator$81, isTrackChangeElement = (node2) => node2?.name === "w:del" || node2?.name === "w:ins", unwrapTrackChangeNode = (node2) => {
102012
+ }, config$5, translator$81, unwrapTrackChangeNode = (node2) => {
101995
102013
  if (!node2)
101996
102014
  return null;
101997
- if (isTrackChangeElement(node2))
102015
+ if (isTranslatedTrackChangeElement(node2))
101998
102016
  return node2;
101999
102017
  if (node2.name === "w:sdt") {
102000
102018
  const content$2 = node2.elements?.find((element) => element.name === "w:sdtContent");
@@ -103429,11 +103447,11 @@ var isRegExp = (value) => {
103429
103447
  };
103430
103448
  return nodeListHandlerFn;
103431
103449
  }, DEFAULT_SECTION_PROPS, importHeadersFooters = (docx, converter, mainEditor, numbering, translatedNumbering, translatedLinkedStyles) => {
103432
- const { elements } = docx["word/_rels/document.xml.rels"]?.elements.find((el) => el.name === "Relationships") || { elements: [] };
103450
+ const elements = docx["word/_rels/document.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
103433
103451
  const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
103434
103452
  const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
103435
- const headers = elements.filter((el) => el.attributes["Type"] === headerType);
103436
- const footers = elements.filter((el) => el.attributes["Type"] === footerType);
103453
+ const headers = elements.filter((el) => el.attributes?.["Type"] === headerType);
103454
+ const footers = elements.filter((el) => el.attributes?.["Type"] === footerType);
103437
103455
  const allSectPrElements = (findSectPr(docx["word/document.xml"]) || []).flatMap((el) => el.elements);
103438
103456
  if (!mainEditor)
103439
103457
  return;
@@ -104407,7 +104425,7 @@ var isRegExp = (value) => {
104407
104425
  state.kern = kernNode.attributes["w:val"];
104408
104426
  }
104409
104427
  }, SuperConverter;
104410
- var init_SuperConverter_ing_1fvK_es = __esm(() => {
104428
+ var init_SuperConverter_BLL9JGke_es = __esm(() => {
104411
104429
  init_rolldown_runtime_Bg48TavK_es();
104412
104430
  init_jszip_C49i9kUs_es();
104413
104431
  init_xml_js_CqGKpaft_es();
@@ -132317,6 +132335,13 @@ var init_SuperConverter_ing_1fvK_es = __esm(() => {
132317
132335
  })(UTIF, pako$1);
132318
132336
  })();
132319
132337
  }))(), 1);
132338
+ TRACK_CHANGE_ELEMENT_NAMES = new Set([
132339
+ "w:del",
132340
+ "w:ins",
132341
+ "w:moveFrom",
132342
+ "w:moveTo"
132343
+ ]);
132344
+ TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES = new Set(["w:del", "w:ins"]);
132320
132345
  SKIP_FIELD_PROCESSING_NODE_NAMES$1 = new Set(["w:drawing", "w:pict"]);
132321
132346
  FIELD_CONTROL_ELEMENT_NAMES = new Set(["w:fldChar"]);
132322
132347
  INSTRUCTION_ELEMENT_NAMES = new Set(["w:instrText", "w:tab"]);
@@ -142008,7 +142033,7 @@ var init_SuperConverter_ing_1fvK_es = __esm(() => {
142008
142033
  };
142009
142034
  });
142010
142035
 
142011
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B_1fvPL0.es.js
142036
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-D7n_Okb2.es.js
142012
142037
  function parseSizeUnit(val = "0") {
142013
142038
  const length = val.toString() || "0";
142014
142039
  const value = Number.parseFloat(length);
@@ -143718,10 +143743,12 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
143718
143743
  return null;
143719
143744
  superdoc.on("editorCreate", onChange);
143720
143745
  superdoc.on("document-mode-change", onChange);
143746
+ superdoc.on("formatting-marks-change", onChange);
143721
143747
  superdoc.on("zoomChange", onChange);
143722
143748
  return () => {
143723
143749
  superdoc.off?.("editorCreate", onChange);
143724
143750
  superdoc.off?.("document-mode-change", onChange);
143751
+ superdoc.off?.("formatting-marks-change", onChange);
143725
143752
  superdoc.off?.("zoomChange", onChange);
143726
143753
  };
143727
143754
  }, subscribeToEditorEvents = (editor, onChange) => {
@@ -143853,6 +143880,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
143853
143880
  active: Boolean(superdoc?.config?.rulers),
143854
143881
  disabled: isCommandDisabled(context)
143855
143882
  };
143883
+ }, createFormattingMarksStateDeriver = () => ({ superdoc }) => {
143884
+ return {
143885
+ active: Boolean(superdoc?.config?.layoutEngineOptions?.showFormattingMarks),
143886
+ disabled: typeof superdoc?.toggleFormattingMarks !== "function"
143887
+ };
143856
143888
  }, createZoomStateDeriver = () => ({ context, superdoc }) => {
143857
143889
  return {
143858
143890
  active: false,
@@ -143868,6 +143900,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
143868
143900
  }, createRulerExecute = () => ({ superdoc }) => {
143869
143901
  superdoc.toggleRuler?.();
143870
143902
  return true;
143903
+ }, createFormattingMarksExecute = () => ({ superdoc }) => {
143904
+ if (typeof superdoc?.toggleFormattingMarks !== "function")
143905
+ return false;
143906
+ superdoc.toggleFormattingMarks();
143907
+ return true;
143871
143908
  }, createZoomExecute = () => ({ superdoc, payload }) => {
143872
143909
  const normalizedPayload = Number.parseInt(String(payload), 10);
143873
143910
  if (!Number.isFinite(normalizedPayload) || normalizedPayload <= 0)
@@ -144467,6 +144504,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
144467
144504
  state: createRulerStateDeriver(),
144468
144505
  execute: createRulerExecute()
144469
144506
  },
144507
+ "formatting-marks": {
144508
+ id: "formatting-marks",
144509
+ state: createFormattingMarksStateDeriver(),
144510
+ execute: createFormattingMarksExecute()
144511
+ },
144470
144512
  zoom: {
144471
144513
  id: "zoom",
144472
144514
  state: createZoomStateDeriver(),
@@ -144644,8 +144686,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
144644
144686
  }
144645
144687
  };
144646
144688
  };
144647
- var init_create_headless_toolbar_B_1fvPL0_es = __esm(() => {
144648
- init_SuperConverter_ing_1fvK_es();
144689
+ var init_create_headless_toolbar_D7n_Okb2_es = __esm(() => {
144690
+ init_SuperConverter_BLL9JGke_es();
144649
144691
  init_constants_DrU4EASo_es();
144650
144692
  init_dist_B8HfvhaK_es();
144651
144693
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -198853,7 +198895,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
198853
198895
  init_remark_gfm_BhnWr3yf_es();
198854
198896
  });
198855
198897
 
198856
- // ../../packages/superdoc/dist/chunks/src-DKka36--.es.js
198898
+ // ../../packages/superdoc/dist/chunks/src-C4h4xIas.es.js
198857
198899
  function deleteProps(obj, propOrProps) {
198858
198900
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
198859
198901
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -202632,6 +202674,98 @@ function createDropcapPlugin(editor) {
202632
202674
  } }
202633
202675
  });
202634
202676
  }
202677
+ function isListParagraph(node2) {
202678
+ return node2?.type?.name === "paragraph" && node2.attrs?.paragraphProperties?.numberingProperties && node2.attrs?.listRendering;
202679
+ }
202680
+ function isRtlParagraph$1(node2) {
202681
+ return node2?.attrs?.paragraphProperties?.rightToLeft === true || node2?.attrs?.direction === "rtl" || node2?.attrs?.rtl === true;
202682
+ }
202683
+ function getParagraphContext$1($pos) {
202684
+ for (let depth = $pos.depth;depth >= 0; depth--) {
202685
+ const node2 = $pos.node(depth);
202686
+ if (node2.type.name !== "paragraph")
202687
+ continue;
202688
+ return {
202689
+ node: node2,
202690
+ pos: depth === 0 ? 0 : $pos.before(depth),
202691
+ start: $pos.start(depth),
202692
+ end: $pos.end(depth)
202693
+ };
202694
+ }
202695
+ return null;
202696
+ }
202697
+ function getParagraphTextBounds2(paragraph2, paragraphStart) {
202698
+ let first$1 = null;
202699
+ let last2 = null;
202700
+ paragraph2.descendants((node2, pos) => {
202701
+ if (!node2.isText || !node2.text?.length)
202702
+ return true;
202703
+ const from$1 = paragraphStart + pos;
202704
+ const to = from$1 + node2.text.length;
202705
+ if (first$1 == null || from$1 < first$1)
202706
+ first$1 = from$1;
202707
+ if (last2 == null || to > last2)
202708
+ last2 = to;
202709
+ return true;
202710
+ });
202711
+ return first$1 == null || last2 == null ? null : {
202712
+ first: first$1,
202713
+ last: last2
202714
+ };
202715
+ }
202716
+ function findAdjacentTextPosition(doc$12, boundary, direction) {
202717
+ let target = null;
202718
+ if (direction < 0) {
202719
+ doc$12.nodesBetween(0, boundary, (node2, pos) => {
202720
+ if (node2.isText && node2.text?.length)
202721
+ target = pos + node2.text.length;
202722
+ return true;
202723
+ });
202724
+ return target;
202725
+ }
202726
+ doc$12.nodesBetween(boundary, doc$12.content.size, (node2, pos) => {
202727
+ if (target != null)
202728
+ return false;
202729
+ if (node2.isText && node2.text?.length) {
202730
+ target = pos;
202731
+ return false;
202732
+ }
202733
+ return true;
202734
+ });
202735
+ return target;
202736
+ }
202737
+ function shouldHandlePlainHorizontalArrow(event) {
202738
+ return (event.key === "ArrowLeft" || event.key === "ArrowRight") && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
202739
+ }
202740
+ function createListBoundaryNavigationPlugin() {
202741
+ return new Plugin({ props: { handleKeyDown(view, event) {
202742
+ if (!shouldHandlePlainHorizontalArrow(event))
202743
+ return false;
202744
+ const { state } = view;
202745
+ const { selection } = state;
202746
+ if (!selection.empty)
202747
+ return false;
202748
+ const paragraph2 = getParagraphContext$1(selection.$from);
202749
+ if (!paragraph2 || !isListParagraph(paragraph2.node))
202750
+ return false;
202751
+ if (isRtlParagraph$1(paragraph2.node))
202752
+ return false;
202753
+ const bounds = getParagraphTextBounds2(paragraph2.node, paragraph2.start);
202754
+ if (!bounds)
202755
+ return false;
202756
+ const direction = event.key === "ArrowLeft" ? -1 : 1;
202757
+ const atLeftBoundary = direction < 0 && selection.from <= bounds.first;
202758
+ const atRightBoundary = direction > 0 && selection.from >= bounds.last;
202759
+ if (!atLeftBoundary && !atRightBoundary)
202760
+ return false;
202761
+ const target = findAdjacentTextPosition(state.doc, direction < 0 ? paragraph2.pos : paragraph2.end, direction);
202762
+ if (target == null || target === selection.from)
202763
+ return false;
202764
+ event.preventDefault();
202765
+ view.dispatch(state.tr.setSelection(TextSelection.create(state.doc, target)).scrollIntoView());
202766
+ return true;
202767
+ } } });
202768
+ }
202635
202769
  function parseCssLength(value) {
202636
202770
  if (!value)
202637
202771
  return null;
@@ -241921,15 +242055,19 @@ function renderListMarker(params$1) {
241921
242055
  const suffixType = markerLayout?.suffix ?? "tab";
241922
242056
  if (suffixType === "tab") {
241923
242057
  const tabEl = doc$12.createElement("span");
241924
- tabEl.className = "superdoc-tab";
242058
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
241925
242059
  tabEl.innerHTML = "&nbsp;";
241926
242060
  tabEl.style.display = "inline-block";
242061
+ if (markerLayout?.run?.fontSize != null)
242062
+ tabEl.style.fontSize = `${markerLayout.run.fontSize}px`;
241927
242063
  tabEl.style.wordSpacing = "0px";
241928
242064
  tabEl.style.width = `${listTabWidth}px`;
241929
242065
  lineEl.prepend(tabEl);
241930
242066
  } else if (suffixType === "space") {
241931
242067
  const spaceEl = doc$12.createElement("span");
241932
242068
  spaceEl.classList.add("superdoc-marker-suffix-space");
242069
+ if (markerLayout?.run?.fontSize != null)
242070
+ spaceEl.style.fontSize = `${markerLayout.run.fontSize}px`;
241933
242071
  spaceEl.style.wordSpacing = "0px";
241934
242072
  spaceEl.textContent = " ";
241935
242073
  lineEl.prepend(spaceEl);
@@ -242815,9 +242953,9 @@ function resolveParagraphContent(fragment, block, measure) {
242815
242953
  const paragraphLineIndex = fragment.fromLine + index2;
242816
242954
  const isFirstLineOfPara = paragraphLineIndex === 0;
242817
242955
  const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
242818
- const isListParagraph = Boolean(wordLayout?.marker);
242956
+ const isListParagraph$1 = Boolean(wordLayout?.marker);
242819
242957
  const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
242820
- const indentOffset = isListParagraph ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
242958
+ const indentOffset = isListParagraph$1 ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
242821
242959
  return {
242822
242960
  line,
242823
242961
  lineIndex: paragraphLineIndex,
@@ -251451,11 +251589,9 @@ function collectClientRectsByLine(doc$12, entries, sliceFrom, sliceTo) {
251451
251589
  function setDomRangeStart(range, entry, pos) {
251452
251590
  const el = entry.el;
251453
251591
  const pmStart = entry.pmStart;
251454
- const firstChild = el.firstChild;
251455
- if (firstChild && firstChild.nodeType === Node.TEXT_NODE) {
251456
- const textNode = firstChild;
251457
- const charIndex = mapPmPosToCharIndex(pos, pmStart, entry.pmEnd, textNode.length);
251458
- range.setStart(textNode, charIndex);
251592
+ const boundary = resolveTextBoundaryInElement(el, pos, pmStart, entry.pmEnd, "forward");
251593
+ if (boundary) {
251594
+ range.setStart(boundary.node, boundary.offset);
251459
251595
  return true;
251460
251596
  }
251461
251597
  if (!el.isConnected || !el.parentNode)
@@ -251470,11 +251606,9 @@ function setDomRangeStart(range, entry, pos) {
251470
251606
  function setDomRangeEnd(range, entry, pos) {
251471
251607
  const el = entry.el;
251472
251608
  const pmStart = entry.pmStart;
251473
- const firstChild = el.firstChild;
251474
- if (firstChild && firstChild.nodeType === Node.TEXT_NODE) {
251475
- const textNode = firstChild;
251476
- const charIndex = mapPmPosToCharIndex(pos, pmStart, entry.pmEnd, textNode.length);
251477
- range.setEnd(textNode, charIndex);
251609
+ const boundary = resolveTextBoundaryInElement(el, pos, pmStart, entry.pmEnd, "backward");
251610
+ if (boundary) {
251611
+ range.setEnd(boundary.node, boundary.offset);
251478
251612
  return true;
251479
251613
  }
251480
251614
  if (!el.isConnected || !el.parentNode)
@@ -251504,8 +251638,8 @@ function computeDomCaretPageLocal(options, pos) {
251504
251638
  return null;
251505
251639
  const pageRect = page.getBoundingClientRect();
251506
251640
  const zoom = options.zoom;
251507
- const textNode = targetEl.firstChild;
251508
- if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
251641
+ const boundary = resolveTextBoundaryInElement(targetEl, pos, entry.pmStart, entry.pmEnd, "forward");
251642
+ if (!boundary) {
251509
251643
  const elRect = targetEl.getBoundingClientRect();
251510
251644
  const atEnd = pos >= entry.pmEnd;
251511
251645
  return {
@@ -251514,10 +251648,9 @@ function computeDomCaretPageLocal(options, pos) {
251514
251648
  y: (elRect.top - pageRect.top) / zoom
251515
251649
  };
251516
251650
  }
251517
- const charIndex = mapPmPosToCharIndex(pos, entry.pmStart, entry.pmEnd, textNode.length);
251518
251651
  const range = document.createRange();
251519
- range.setStart(textNode, charIndex);
251520
- range.setEnd(textNode, charIndex);
251652
+ range.setStart(boundary.node, boundary.offset);
251653
+ range.setEnd(boundary.node, boundary.offset);
251521
251654
  const rangeRect = range.getBoundingClientRect();
251522
251655
  const lineRect = targetEl.closest(".superdoc-line")?.getBoundingClientRect() ?? rangeRect;
251523
251656
  return {
@@ -251526,6 +251659,53 @@ function computeDomCaretPageLocal(options, pos) {
251526
251659
  y: (lineRect.top - pageRect.top) / zoom
251527
251660
  };
251528
251661
  }
251662
+ function resolveTextBoundaryInElement(element3, pos, pmStart, pmEnd, affinity) {
251663
+ const textLength = element3.textContent?.length ?? 0;
251664
+ if (textLength <= 0)
251665
+ return null;
251666
+ return resolveDescendantTextBoundary(element3, mapPmPosToCharIndex(pos, pmStart, pmEnd, textLength), affinity);
251667
+ }
251668
+ function resolveDescendantTextBoundary(element3, targetOffset, affinity) {
251669
+ const walker = (element3.ownerDocument ?? document).createTreeWalker(element3, NodeFilter.SHOW_TEXT);
251670
+ let consumed = 0;
251671
+ let previous3 = null;
251672
+ let current = walker.nextNode();
251673
+ while (current) {
251674
+ const textNode = current;
251675
+ const textLength = textNode.textContent?.length ?? 0;
251676
+ if (textLength <= 0) {
251677
+ current = walker.nextNode();
251678
+ continue;
251679
+ }
251680
+ const segmentEnd = consumed + textLength;
251681
+ if (targetOffset < segmentEnd)
251682
+ return {
251683
+ node: textNode,
251684
+ offset: Math.max(0, targetOffset - consumed)
251685
+ };
251686
+ if (targetOffset === segmentEnd) {
251687
+ if (affinity === "backward")
251688
+ return {
251689
+ node: textNode,
251690
+ offset: textLength
251691
+ };
251692
+ previous3 = {
251693
+ node: textNode,
251694
+ offset: textLength
251695
+ };
251696
+ consumed = segmentEnd;
251697
+ current = walker.nextNode();
251698
+ continue;
251699
+ }
251700
+ previous3 = {
251701
+ node: textNode,
251702
+ offset: textLength
251703
+ };
251704
+ consumed = segmentEnd;
251705
+ current = walker.nextNode();
251706
+ }
251707
+ return previous3;
251708
+ }
251529
251709
  function mapPmPosToCharIndex(pos, pmStart, pmEnd, textLength) {
251530
251710
  if (!Number.isFinite(pos) || !Number.isFinite(pmStart) || !Number.isFinite(pmEnd))
251531
251711
  return 0;
@@ -253464,6 +253644,30 @@ function handleDocumentPartObjectNode(node2, context) {
253464
253644
  }
253465
253645
  if (sectionState)
253466
253646
  sectionState.currentParagraphIndex++;
253647
+ } else if (child.type === "tableOfContents" && Array.isArray(child.content)) {
253648
+ const metadata = {
253649
+ docPartGallery: docPartGallery ?? "",
253650
+ docPartObjectId,
253651
+ tocInstruction: getNodeInstruction(child) ?? tocInstruction,
253652
+ sdtMetadata: docPartSdtMetadata
253653
+ };
253654
+ const tocContext = {
253655
+ nextBlockId,
253656
+ positions,
253657
+ bookmarks,
253658
+ hyperlinkConfig,
253659
+ enableComments,
253660
+ trackedChangesConfig,
253661
+ themeColors,
253662
+ converters: converters$1,
253663
+ converterContext,
253664
+ sectionState
253665
+ };
253666
+ const output = {
253667
+ blocks: blocks2,
253668
+ recordBlockKind
253669
+ };
253670
+ processTocChildren(child.content, metadata, tocContext, output);
253467
253671
  }
253468
253672
  }
253469
253673
  }
@@ -273025,6 +273229,16 @@ var Node$13 = class Node$14 {
273025
273229
  tooltip: toolbarTexts$1.ruler,
273026
273230
  attributes: { ariaLabel: "Ruler" }
273027
273231
  });
273232
+ const formattingMarks = useToolbarItem({
273233
+ type: "button",
273234
+ name: "formattingMarks",
273235
+ command: "toggleFormattingMarks",
273236
+ allowWithoutEditor: true,
273237
+ icon: toolbarIcons$1.formattingMarks,
273238
+ active: false,
273239
+ tooltip: toolbarTexts$1.formattingMarks,
273240
+ attributes: { ariaLabel: "Formatting marks" }
273241
+ });
273028
273242
  const selectedLinkedStyle = exports_vue.ref(null);
273029
273243
  const linkedStyles = useToolbarItem({
273030
273244
  type: "dropdown",
@@ -273122,7 +273336,8 @@ var Node$13 = class Node$14 {
273122
273336
  "linkedStyles",
273123
273337
  "clearFormatting",
273124
273338
  "copyFormat",
273125
- "ruler"
273339
+ "ruler",
273340
+ "formattingMarks"
273126
273341
  ];
273127
273342
  const itemsToHideSM = [
273128
273343
  "zoom",
@@ -273173,6 +273388,7 @@ var Node$13 = class Node$14 {
273173
273388
  linkedStyles,
273174
273389
  separator,
273175
273390
  ruler,
273391
+ formattingMarks,
273176
273392
  copyFormat,
273177
273393
  clearFormatting,
273178
273394
  aiButton,
@@ -273188,6 +273404,7 @@ var Node$13 = class Node$14 {
273188
273404
  toolbarItems.splice(getLinkedStylesIndex - 1, 2);
273189
273405
  const filterItems = [
273190
273406
  "ruler",
273407
+ "formattingMarks",
273191
273408
  "zoom",
273192
273409
  "undo",
273193
273410
  "redo"
@@ -276778,6 +276995,82 @@ var Node$13 = class Node$14 {
276778
276995
  .superdoc-layout .track-format-dec.highlighted.track-change-focused {
276779
276996
  background-color: var(--sd-tracked-changes-format-background-focused, #ffd70033);
276780
276997
  }
276998
+ `, FORMATTING_MARKS_STYLES = `
276999
+ .superdoc-formatting-space-mark,
277000
+ .superdoc-marker-suffix-space {
277001
+ position: relative;
277002
+ }
277003
+
277004
+ .superdoc-formatting-space-mark {
277005
+ white-space: pre;
277006
+ }
277007
+
277008
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab {
277009
+ position: relative;
277010
+ visibility: visible !important;
277011
+ }
277012
+
277013
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab::after {
277014
+ content: "→";
277015
+ position: absolute;
277016
+ left: 50%;
277017
+ top: 50%;
277018
+ transform: translate(-50%, -50%);
277019
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
277020
+ font-size: 0.75em;
277021
+ line-height: 1;
277022
+ pointer-events: none;
277023
+ }
277024
+
277025
+ .superdoc-layout.superdoc-show-formatting-marks [dir="rtl"] .superdoc-tab::after {
277026
+ content: "←";
277027
+ }
277028
+
277029
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-space-mark::after,
277030
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-marker-suffix-space::after {
277031
+ content: "·";
277032
+ position: absolute;
277033
+ left: 50%;
277034
+ top: 50%;
277035
+ transform: translate(-50%, -50%);
277036
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
277037
+ font-size: 0.75em;
277038
+ line-height: 1;
277039
+ pointer-events: none;
277040
+ }
277041
+
277042
+ .superdoc-formatting-paragraph-mark {
277043
+ display: none;
277044
+ position: absolute;
277045
+ top: 0;
277046
+ transform: translateX(var(--sd-formatting-paragraph-mark-gap, 0.2em));
277047
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
277048
+ pointer-events: none;
277049
+ user-select: none;
277050
+ white-space: pre;
277051
+ z-index: 2;
277052
+ }
277053
+
277054
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-paragraph-mark {
277055
+ display: inline;
277056
+ }
277057
+
277058
+ .superdoc-layout.superdoc-show-formatting-marks [dir="rtl"] .superdoc-formatting-paragraph-mark {
277059
+ transform: translateX(calc(-100% - var(--sd-formatting-paragraph-mark-gap, 0.2em)));
277060
+ }
277061
+
277062
+ @media print {
277063
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab::after,
277064
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-space-mark::after,
277065
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-marker-suffix-space::after {
277066
+ content: "";
277067
+ display: none;
277068
+ }
277069
+
277070
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-paragraph-mark {
277071
+ display: none;
277072
+ }
277073
+ }
276781
277074
  `, SDT_CONTAINER_STYLES = `
276782
277075
  /* Document Section - Block-level container with gray border and hover tooltip */
276783
277076
  .superdoc-document-section {
@@ -277149,7 +277442,7 @@ menclose::after {
277149
277442
  pointer-events: none;
277150
277443
  background: var(--sd-menclose-h), var(--sd-menclose-v), var(--sd-menclose-up), var(--sd-menclose-down);
277151
277444
  }
277152
- `, printStylesInjected = false, linkStylesInjected = false, trackChangeStylesInjected = false, sdtContainerStylesInjected = false, fieldAnnotationStylesInjected = false, imageSelectionStylesInjected = false, mathMencloseStylesInjected = false, ensurePrintStyles = (doc$12) => {
277445
+ `, printStylesInjected = false, linkStylesInjected = false, trackChangeStylesInjected = false, formattingMarksStylesInjected = false, sdtContainerStylesInjected = false, fieldAnnotationStylesInjected = false, imageSelectionStylesInjected = false, mathMencloseStylesInjected = false, ensurePrintStyles = (doc$12) => {
277153
277446
  if (printStylesInjected || !doc$12)
277154
277447
  return;
277155
277448
  const styleEl = doc$12.createElement("style");
@@ -277173,6 +277466,14 @@ menclose::after {
277173
277466
  styleEl.textContent = TRACK_CHANGE_STYLES;
277174
277467
  doc$12.head?.appendChild(styleEl);
277175
277468
  trackChangeStylesInjected = true;
277469
+ }, ensureFormattingMarksStyles = (doc$12) => {
277470
+ if (formattingMarksStylesInjected || !doc$12)
277471
+ return;
277472
+ const styleEl = doc$12.createElement("style");
277473
+ styleEl.setAttribute("data-superdoc-formatting-marks-styles", "true");
277474
+ styleEl.textContent = FORMATTING_MARKS_STYLES;
277475
+ doc$12.head?.appendChild(styleEl);
277476
+ formattingMarksStylesInjected = true;
277176
277477
  }, ensureSdtContainerStyles = (doc$12) => {
277177
277478
  if (sdtContainerStylesInjected || !doc$12)
277178
277479
  return;
@@ -277661,6 +277962,12 @@ menclose::after {
277661
277962
  if (value != null && value !== "" && key2 in el.style)
277662
277963
  el.style[key2] = String(value);
277663
277964
  });
277965
+ }, convertParagraphMarkToCellMark = (lineEl) => {
277966
+ const mark2 = lineEl.querySelector(".superdoc-formatting-paragraph-mark");
277967
+ if (!mark2)
277968
+ return;
277969
+ mark2.classList.add("superdoc-formatting-cell-mark");
277970
+ mark2.textContent = "¤";
277664
277971
  }, renderEmbeddedTable = (params$1) => {
277665
277972
  const { doc: doc$12, table: table2, measure, availableWidth, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, fromRow: paramFromRow, toRow: paramToRow, partialRow: paramPartialRow } = params$1;
277666
277973
  const effectiveFromRow = paramFromRow ?? 0;
@@ -277935,6 +278242,7 @@ menclose::after {
277935
278242
  const paragraphMeasure = blockMeasure;
277936
278243
  const lines = paragraphMeasure.lines;
277937
278244
  const blockLineCount = lines?.length || 0;
278245
+ const isLastBlockInCell = i4 === Math.min(blockMeasures.length, cellBlocks.length) - 1;
277938
278246
  const wordLayout = block.attrs?.wordLayout ?? null;
277939
278247
  const markerLayout = wordLayout?.marker;
277940
278248
  const markerMeasure = paragraphMeasure.marker;
@@ -277989,6 +278297,8 @@ menclose::after {
277989
278297
  ...context,
277990
278298
  section: "body"
277991
278299
  }, lineIdx, isLastLine, lineIdx === 0 && localStartLine === 0 ? listFirstLineTextStartPx : undefined);
278300
+ if (isLastBlockInCell && isLastLine)
278301
+ convertParagraphMarkToCellMark(lineEl);
277992
278302
  lineEl.style.paddingLeft = "";
277993
278303
  lineEl.style.paddingRight = "";
277994
278304
  lineEl.style.textIndent = "";
@@ -279408,6 +279718,9 @@ menclose::after {
279408
279718
  },
279409
279719
  setScrollContainer(el) {
279410
279720
  painter.setScrollContainer(el);
279721
+ },
279722
+ setShowFormattingMarks(showFormattingMarks) {
279723
+ painter.setShowFormattingMarks(showFormattingMarks);
279411
279724
  }
279412
279725
  };
279413
279726
  }, PresentationPaintIndex = class {
@@ -279491,13 +279804,16 @@ menclose::after {
279491
279804
  #zoom = 1;
279492
279805
  #scrollContainer = null;
279493
279806
  #virtualizationPins = [];
279807
+ #showFormattingMarks = false;
279494
279808
  get hasPainter() {
279495
279809
  return this.#painter !== null;
279496
279810
  }
279497
279811
  ensurePainter(options) {
279498
279812
  if (!this.#painter) {
279813
+ this.#showFormattingMarks = Boolean(options.showFormattingMarks ?? this.#showFormattingMarks);
279499
279814
  this.#painter = createDomPainter({
279500
279815
  ...options,
279816
+ showFormattingMarks: this.#showFormattingMarks,
279501
279817
  onPaintSnapshot: (snapshot2) => {
279502
279818
  this.#lastPaintSnapshot = snapshot2;
279503
279819
  this.#paintIndex.update(snapshot2);
@@ -279521,6 +279837,13 @@ menclose::after {
279521
279837
  this.#footerProvider = footer;
279522
279838
  this.#applyProviders();
279523
279839
  }
279840
+ setShowFormattingMarks(showFormattingMarks) {
279841
+ const next2 = Boolean(showFormattingMarks);
279842
+ if (this.#showFormattingMarks === next2)
279843
+ return;
279844
+ this.#showFormattingMarks = next2;
279845
+ this.#applyShowFormattingMarks();
279846
+ }
279524
279847
  setZoom(zoom) {
279525
279848
  if (this.#zoom === zoom)
279526
279849
  return;
@@ -279575,6 +279898,7 @@ menclose::after {
279575
279898
  this.#applyZoom();
279576
279899
  this.#applyScrollContainer();
279577
279900
  this.#applyVirtualizationPins();
279901
+ this.#applyShowFormattingMarks();
279578
279902
  }
279579
279903
  #applyProviders() {
279580
279904
  this.#painter?.setProviders(this.#headerProvider, this.#footerProvider);
@@ -279588,6 +279912,9 @@ menclose::after {
279588
279912
  #applyVirtualizationPins() {
279589
279913
  this.#painter?.setVirtualizationPins(this.#virtualizationPins);
279590
279914
  }
279915
+ #applyShowFormattingMarks() {
279916
+ this.#painter?.setShowFormattingMarks(this.#showFormattingMarks);
279917
+ }
279591
279918
  }, hashParagraphBorder$1 = (border) => {
279592
279919
  const parts = [];
279593
279920
  if (border.style !== undefined)
@@ -282739,7 +283066,7 @@ menclose::after {
282739
283066
  let paraIndentLeft = 0;
282740
283067
  let paraIndentRight = 0;
282741
283068
  let effectiveLeft = 0;
282742
- let isListParagraph = false;
283069
+ let isListParagraph$1 = false;
282743
283070
  let wl;
282744
283071
  if (block.kind === "paragraph") {
282745
283072
  const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
@@ -282748,8 +283075,8 @@ menclose::after {
282748
283075
  paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
282749
283076
  effectiveLeft = paraIndentLeft;
282750
283077
  wl = getWordLayoutConfig(block);
282751
- isListParagraph = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
282752
- if (isListParagraph) {
283078
+ isListParagraph$1 = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
283079
+ if (isListParagraph$1) {
282753
283080
  const explicitTextStart = typeof wl?.marker?.textStartX === "number" && Number.isFinite(wl.marker.textStartX) ? wl.marker.textStartX : typeof wl?.textStartPx === "number" && Number.isFinite(wl.textStartPx) ? wl.textStartPx : undefined;
282754
283081
  if (typeof explicitTextStart === "number" && explicitTextStart > paraIndentLeft)
282755
283082
  effectiveLeft = explicitTextStart;
@@ -282759,7 +283086,7 @@ menclose::after {
282759
283086
  let availableWidth = Math.max(0, fragmentWidth - totalIndent);
282760
283087
  if (totalIndent > fragmentWidth)
282761
283088
  console.warn(`[mapPmToX] Paragraph indents (${totalIndent}px) exceed fragment width (${fragmentWidth}px) for block ${block.id}. This may indicate a layout miscalculation. Available width clamped to 0.`);
282762
- const hasRenderedMarkerText = isListParagraph && (markerTextWidth ?? 0) > 0;
283089
+ const hasRenderedMarkerText = isListParagraph$1 && (markerTextWidth ?? 0) > 0;
282763
283090
  if (isFirstLine && block.kind === "paragraph" && !hasRenderedMarkerText) {
282764
283091
  const suppressFLI = block.attrs?.suppressFirstLineIndent === true;
282765
283092
  const firstLineOffset = getFirstLineIndentOffset(block.attrs?.indent, suppressFLI);
@@ -290466,12 +290793,12 @@ menclose::after {
290466
290793
  return;
290467
290794
  console.log(...args$1);
290468
290795
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
290469
- var init_src_DKka36_es = __esm(() => {
290796
+ var init_src_C4h4xIas_es = __esm(() => {
290470
290797
  init_rolldown_runtime_Bg48TavK_es();
290471
- init_SuperConverter_ing_1fvK_es();
290798
+ init_SuperConverter_BLL9JGke_es();
290472
290799
  init_jszip_C49i9kUs_es();
290473
290800
  init_uuid_qzgm05fK_es();
290474
- init_create_headless_toolbar_B_1fvPL0_es();
290801
+ init_create_headless_toolbar_D7n_Okb2_es();
290475
290802
  init_constants_DrU4EASo_es();
290476
290803
  init_dist_B8HfvhaK_es();
290477
290804
  init_unified_Dsuw2be5_es();
@@ -293516,7 +293843,8 @@ ${err.toString()}`);
293516
293843
  event.preventDefault();
293517
293844
  return true;
293518
293845
  } } } }),
293519
- createLeadingCaretPlugin()
293846
+ createLeadingCaretPlugin(),
293847
+ createListBoundaryNavigationPlugin()
293520
293848
  ];
293521
293849
  }
293522
293850
  });
@@ -309266,7 +309594,9 @@ function print() { __p += __j.call(arguments, '') }
309266
309594
  cut: scissors_solid_default,
309267
309595
  copy: copy_solid_default,
309268
309596
  paste: paste_solid_default,
309269
- strikethrough: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>\n'
309597
+ strikethrough: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M161.3 144c3.2-17.2 14-30.1 33.7-38.6c21.1-9 51.8-12.3 88.6-6.5c11.9 1.9 48.8 9.1 60.1 12c17.1 4.5 34.6-5.6 39.2-22.7s-5.6-34.6-22.7-39.2c-14.3-3.8-53.6-11.4-66.6-13.4c-44.7-7-88.3-4.2-123.7 10.9c-36.5 15.6-64.4 44.8-71.8 87.3c-.1 .6-.2 1.1-.2 1.7c-2.8 23.9 .5 45.6 10.1 64.6c4.5 9 10.2 16.9 16.7 23.9L32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l448 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-209.9 0-.4-.1-1.1-.3c-36-10.8-65.2-19.6-85.2-33.1c-9.3-6.3-15-12.6-18.2-19.1c-3.1-6.1-5.2-14.6-3.8-27.4zM348.9 337.2c2.7 6.5 4.4 15.8 1.9 30.1c-3 17.6-13.8 30.8-33.9 39.4c-21.1 9-51.7 12.3-88.5 6.5c-18-2.9-49.1-13.5-74.4-22.1c-5.6-1.9-11-3.7-15.9-5.4c-16.8-5.6-34.9 3.5-40.5 20.3s3.5 34.9 20.3 40.5c3.6 1.2 7.9 2.7 12.7 4.3c0 0 0 0 0 0s0 0 0 0c24.9 8.5 63.6 21.7 87.6 25.6c0 0 0 0 0 0l.2 0c44.7 7 88.3 4.2 123.7-10.9c36.5-15.6 64.4-44.8 71.8-87.3c3.6-21 2.7-40.4-3.1-58.1l-75.7 0c7 5.6 11.4 11.2 13.9 17.2z"/></svg>\n',
309598
+ formattingMarks: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true"><text x="12" y="18" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="20" font-weight="700" fill="currentColor">¶</text></svg>
309599
+ `
309270
309600
  };
309271
309601
  _hoisted_1$20 = [
309272
309602
  "onClick",
@@ -310443,6 +310773,7 @@ function print() { __p += __j.call(arguments, '') }
310443
310773
  acceptTrackedChangeBySelection: "track-changes-accept-selection",
310444
310774
  rejectTrackedChangeOnSelection: "track-changes-reject-selection",
310445
310775
  ruler: "ruler",
310776
+ formattingMarks: "formatting-marks",
310446
310777
  zoom: "zoom",
310447
310778
  documentMode: "document-mode",
310448
310779
  link: "link",
@@ -311930,6 +312261,7 @@ function print() { __p += __j.call(arguments, '') }
311930
312261
  lineHeight: "Line height",
311931
312262
  formatText: "Format text",
311932
312263
  ruler: "Show or hide ruler",
312264
+ formattingMarks: "Show or hide formatting marks",
311933
312265
  pageBreak: "Insert page break",
311934
312266
  documentEditingMode: "Editing",
311935
312267
  documentSuggestingMode: "Suggesting",
@@ -312309,6 +312641,10 @@ function print() { __p += __j.call(arguments, '') }
312309
312641
  const currentMode = this.snapshot?.commands?.["document-mode"]?.value || "editing";
312310
312642
  if (!this.activeEditor || currentMode === "viewing") {
312311
312643
  this.#deactivateAll();
312644
+ this.toolbarItems.forEach((item) => {
312645
+ if (item.allowWithoutEditor?.value)
312646
+ this.#applyHeadlessState(item);
312647
+ });
312312
312648
  return;
312313
312649
  }
312314
312650
  const { state } = this.activeEditor;
@@ -316904,11 +317240,13 @@ function print() { __p += __j.call(arguments, '') }
316904
317240
  this.onPaintSnapshotCallback = null;
316905
317241
  this.mountedPageIndices = [];
316906
317242
  this.resolvedLayout = null;
317243
+ this.showFormattingMarks = false;
316907
317244
  this.options = options;
316908
317245
  this.layoutMode = options.layoutMode ?? "vertical";
316909
317246
  this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
316910
317247
  this.headerProvider = options.headerProvider;
316911
317248
  this.footerProvider = options.footerProvider;
317249
+ this.showFormattingMarks = options.showFormattingMarks === true;
316912
317250
  const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
316913
317251
  this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
316914
317252
  if (!this.isSemanticFlow && this.layoutMode === "vertical" && options.virtualization?.enabled) {
@@ -316925,10 +317263,33 @@ function print() { __p += __j.call(arguments, '') }
316925
317263
  }
316926
317264
  this.onPaintSnapshotCallback = options.onPaintSnapshot ?? null;
316927
317265
  }
317266
+ setShowFormattingMarks(showFormattingMarks) {
317267
+ const next2 = showFormattingMarks === true;
317268
+ if (this.showFormattingMarks === next2)
317269
+ return;
317270
+ this.showFormattingMarks = next2;
317271
+ this.applyFormattingMarksClass();
317272
+ this.invalidateRenderedContent();
317273
+ }
316928
317274
  setProviders(header, footer) {
316929
317275
  this.headerProvider = header;
316930
317276
  this.footerProvider = footer;
316931
317277
  }
317278
+ applyFormattingMarksClass(mount = this.mount) {
317279
+ mount?.classList.toggle("superdoc-show-formatting-marks", this.showFormattingMarks);
317280
+ }
317281
+ invalidateRenderedContent() {
317282
+ this.pageStates = [];
317283
+ this.currentLayout = null;
317284
+ this.pageIndexToState.clear();
317285
+ this.virtualMountedKey = "";
317286
+ this.clearGapSpacers();
317287
+ this.topSpacerEl = null;
317288
+ this.bottomSpacerEl = null;
317289
+ this.virtualPagesEl = null;
317290
+ this.processedLayoutVersion = -1;
317291
+ this.layoutVersion += 1;
317292
+ }
316932
317293
  setVirtualizationPins(pageIndices) {
316933
317294
  this.virtualPinnedPages = Array.from(new Set((pageIndices ?? []).filter((n) => Number.isInteger(n)))).sort((a2, b$1) => a2 - b$1);
316934
317295
  if (this.virtualEnabled && this.mount)
@@ -317111,6 +317472,7 @@ function print() { __p += __j.call(arguments, '') }
317111
317472
  ensurePrintStyles(doc$12);
317112
317473
  ensureLinkStyles(doc$12);
317113
317474
  ensureTrackChangeStyles(doc$12);
317475
+ ensureFormattingMarksStyles(doc$12);
317114
317476
  ensureFieldAnnotationStyles(doc$12);
317115
317477
  ensureSdtContainerStyles(doc$12);
317116
317478
  ensureImageSelectionStyles(doc$12);
@@ -317118,8 +317480,11 @@ function print() { __p += __j.call(arguments, '') }
317118
317480
  if (!this.isSemanticFlow && this.options.ruler?.enabled)
317119
317481
  ensureRulerStyles(doc$12);
317120
317482
  mount.classList.add(CLASS_NAMES$1.container);
317121
- if (this.mount && this.mount !== mount)
317483
+ this.applyFormattingMarksClass(mount);
317484
+ if (this.mount && this.mount !== mount) {
317122
317485
  this.resetState();
317486
+ this.applyFormattingMarksClass(mount);
317487
+ }
317123
317488
  this.layoutVersion += 1;
317124
317489
  this.layoutEpoch = resolvedLayout.layoutEpoch ?? 0;
317125
317490
  this.mount = mount;
@@ -318110,7 +318475,8 @@ function print() { __p += __j.call(arguments, '') }
318110
318475
  const resolvedMarker = content3.marker;
318111
318476
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
318112
318477
  content3.lines.forEach((resolvedLine) => {
318113
- const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset);
318478
+ const paragraphMarkLeftOffset = this.resolveResolvedListParagraphMarkOffset(resolvedLine.isListFirstLine ? resolvedMarker : undefined, fragment.markerTextWidth, resolvedLine.indentOffset);
318479
+ const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset, paragraphMarkLeftOffset);
318114
318480
  if (!resolvedLine.isListFirstLine) {
318115
318481
  if (resolvedLine.paddingLeftPx > 0)
318116
318482
  lineEl.style.paddingLeft = `${resolvedLine.paddingLeftPx}px`;
@@ -318155,15 +318521,17 @@ function print() { __p += __j.call(arguments, '') }
318155
318521
  markerContainer.appendChild(markerEl);
318156
318522
  if (resolvedMarker.suffix === "tab") {
318157
318523
  const tabEl = this.doc.createElement("span");
318158
- tabEl.className = "superdoc-tab";
318524
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
318159
318525
  tabEl.innerHTML = "&nbsp;";
318160
318526
  tabEl.style.display = "inline-block";
318527
+ tabEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
318161
318528
  tabEl.style.wordSpacing = "0px";
318162
318529
  tabEl.style.width = `${resolvedMarker.suffixWidthPx}px`;
318163
318530
  lineEl.prepend(tabEl);
318164
318531
  } else if (resolvedMarker.suffix === "space") {
318165
318532
  const spaceEl = this.doc.createElement("span");
318166
318533
  spaceEl.classList.add("superdoc-marker-suffix-space");
318534
+ spaceEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
318167
318535
  spaceEl.style.wordSpacing = "0px";
318168
318536
  spaceEl.textContent = " ";
318169
318537
  lineEl.prepend(spaceEl);
@@ -318294,15 +318662,17 @@ function print() { __p += __j.call(arguments, '') }
318294
318662
  const suffix = marker.suffix ?? "tab";
318295
318663
  if (suffix === "tab") {
318296
318664
  const tabEl = this.doc.createElement("span");
318297
- tabEl.className = "superdoc-tab";
318665
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
318298
318666
  tabEl.innerHTML = "&nbsp;";
318299
318667
  tabEl.style.display = "inline-block";
318668
+ tabEl.style.fontSize = `${marker.run.fontSize}px`;
318300
318669
  tabEl.style.wordSpacing = "0px";
318301
318670
  tabEl.style.width = `${listTabWidth}px`;
318302
318671
  lineEl.prepend(tabEl);
318303
318672
  } else if (suffix === "space") {
318304
318673
  const spaceEl = this.doc.createElement("span");
318305
318674
  spaceEl.classList.add("superdoc-marker-suffix-space");
318675
+ spaceEl.style.fontSize = `${marker.run.fontSize}px`;
318306
318676
  spaceEl.style.wordSpacing = "0px";
318307
318677
  spaceEl.textContent = " ";
318308
318678
  lineEl.prepend(spaceEl);
@@ -319514,6 +319884,87 @@ function print() { __p += __j.call(arguments, '') }
319514
319884
  wrapper.dataset.pmEnd = String(run2.pmEnd);
319515
319885
  return wrapper;
319516
319886
  }
319887
+ setTextContentWithFormattingSpaceMarks(element3, text5) {
319888
+ if (!this.showFormattingMarks || !text5.includes(" ") || !this.doc) {
319889
+ element3.textContent = text5;
319890
+ return;
319891
+ }
319892
+ element3.textContent = "";
319893
+ let chunkStart = 0;
319894
+ for (let index2 = 0;index2 < text5.length; index2 += 1) {
319895
+ if (text5[index2] !== " ")
319896
+ continue;
319897
+ if (index2 > chunkStart)
319898
+ element3.appendChild(this.doc.createTextNode(text5.slice(chunkStart, index2)));
319899
+ const space = this.doc.createElement("span");
319900
+ space.classList.add("superdoc-formatting-space-mark");
319901
+ space.textContent = " ";
319902
+ element3.appendChild(space);
319903
+ chunkStart = index2 + 1;
319904
+ }
319905
+ if (chunkStart < text5.length)
319906
+ element3.appendChild(this.doc.createTextNode(text5.slice(chunkStart)));
319907
+ }
319908
+ findLastTextRun(runs2) {
319909
+ for (let index2 = runs2.length - 1;index2 >= 0; index2 -= 1) {
319910
+ const run2 = runs2[index2];
319911
+ if (run2 && (run2.kind === "text" || run2.kind === undefined) && "text" in run2)
319912
+ return {
319913
+ run: run2,
319914
+ index: index2
319915
+ };
319916
+ }
319917
+ return null;
319918
+ }
319919
+ appendFormattingParagraphMark(lineEl, line, runs2, leftOffsetPx, availableWidth, hasExplicitPositioning) {
319920
+ if (!this.showFormattingMarks || !this.doc)
319921
+ return;
319922
+ const lastRun = runs2.length > 0 ? runs2[runs2.length - 1] : null;
319923
+ if (lastRun) {
319924
+ const lastRunIndex = runs2.length - 1;
319925
+ if (line.toRun < lastRunIndex)
319926
+ return;
319927
+ if (line.toRun === lastRunIndex && (lastRun.kind === "text" || lastRun.kind === undefined) && "text" in lastRun && line.toChar < lastRun.text.length)
319928
+ return;
319929
+ }
319930
+ const lastTextRun = this.findLastTextRun(runs2);
319931
+ const mark2 = this.doc.createElement("span");
319932
+ mark2.classList.add("superdoc-formatting-paragraph-mark");
319933
+ mark2.setAttribute("aria-hidden", "true");
319934
+ mark2.textContent = "¶";
319935
+ const run2 = lastTextRun?.run;
319936
+ if (run2) {
319937
+ if (run2.fontFamily)
319938
+ mark2.style.fontFamily = toCssFontFamily(run2.fontFamily) ?? run2.fontFamily;
319939
+ if (typeof run2.fontSize === "number")
319940
+ mark2.style.fontSize = `${run2.fontSize}px`;
319941
+ if (run2.bold)
319942
+ mark2.style.fontWeight = "bold";
319943
+ if (run2.italic)
319944
+ mark2.style.fontStyle = "italic";
319945
+ if (run2.letterSpacing != null)
319946
+ mark2.style.letterSpacing = `${run2.letterSpacing}px`;
319947
+ }
319948
+ mark2.style.lineHeight = `${line.lineHeight}px`;
319949
+ const lineWidth = line.naturalWidth ?? line.width ?? 0;
319950
+ const alignmentSlack = Math.max(0, availableWidth - lineWidth);
319951
+ const textAlign = lineEl.style.textAlign;
319952
+ const alignmentOffset = !hasExplicitPositioning && textAlign === "center" ? alignmentSlack / 2 : !hasExplicitPositioning && textAlign === "right" ? alignmentSlack : 0;
319953
+ const visualTextEndOffset = lineEl.dir === "rtl" || lineEl.style.direction === "rtl" ? alignmentOffset : alignmentOffset + lineWidth;
319954
+ mark2.style.left = `${Math.max(0, leftOffsetPx + visualTextEndOffset)}px`;
319955
+ lineEl.appendChild(mark2);
319956
+ }
319957
+ resolveResolvedListParagraphMarkOffset(marker, markerTextWidth, fallbackOffset) {
319958
+ if (typeof fallbackOffset === "number" && Number.isFinite(fallbackOffset) && fallbackOffset > 0)
319959
+ return fallbackOffset;
319960
+ if (!marker || marker.vanish)
319961
+ return fallbackOffset;
319962
+ const paddingLeft = Number.isFinite(marker.firstLinePaddingLeftPx) ? marker.firstLinePaddingLeftPx : 0;
319963
+ const suffixWidth = marker.suffix !== "nothing" && Number.isFinite(marker.suffixWidthPx) ? marker.suffixWidthPx : 0;
319964
+ if (marker.justification === "left")
319965
+ return paddingLeft + (typeof markerTextWidth === "number" && Number.isFinite(markerTextWidth) && markerTextWidth > 0 ? markerTextWidth : 0) + suffixWidth;
319966
+ return paddingLeft + (marker.justification === "center" && Number.isFinite(marker.centerPaddingAdjustPx) ? marker.centerPaddingAdjustPx ?? 0 : 0) + suffixWidth;
319967
+ }
319517
319968
  renderRun(run2, context, trackedConfig) {
319518
319969
  if (this.isImageRun(run2))
319519
319970
  return this.renderImageRun(run2);
@@ -319531,7 +319982,7 @@ function print() { __p += __j.call(arguments, '') }
319531
319982
  const isActiveLink = !!(linkData && !linkData.blocked && linkData.href);
319532
319983
  const elem = isActiveLink ? this.doc.createElement("a") : this.doc.createElement("span");
319533
319984
  const text5 = resolveRunText(run2, context);
319534
- elem.textContent = text5;
319985
+ this.setTextContentWithFormattingSpaceMarks(elem, text5);
319535
319986
  if (linkData?.dataset)
319536
319987
  applyLinkDataset(elem, linkData.dataset);
319537
319988
  if (linkData?.blocked) {
@@ -319890,7 +320341,7 @@ function print() { __p += __j.call(arguments, '') }
319890
320341
  this.applySdtDataset(annotation, run2.sdt);
319891
320342
  return annotation;
319892
320343
  }
319893
- renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride) {
320344
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride, paragraphMarkLeftOffsetOverride) {
319894
320345
  if (!this.doc)
319895
320346
  throw new Error("DomPainter: document is not available");
319896
320347
  const expandedBlock = {
@@ -320105,25 +320556,27 @@ function print() { __p += __j.call(arguments, '') }
320105
320556
  spaceCount,
320106
320557
  shouldJustify: justifyShouldApply
320107
320558
  });
320559
+ const resolveLineIndentOffset = () => {
320560
+ if (indentOffsetOverride != null)
320561
+ return indentOffsetOverride;
320562
+ const paraIndent = block.attrs?.indent;
320563
+ const indentLeft = paraIndent?.left ?? 0;
320564
+ const firstLine = paraIndent?.firstLine ?? 0;
320565
+ const hanging = paraIndent?.hanging ?? 0;
320566
+ const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
320567
+ const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
320568
+ const wordLayoutValue = block.attrs?.wordLayout;
320569
+ const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
320570
+ const isListParagraph$1 = Boolean(wordLayout?.marker);
320571
+ const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
320572
+ return isListParagraph$1 ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
320573
+ };
320574
+ const lineTextStartOffsetPx = paragraphMarkLeftOffsetOverride != null ? paragraphMarkLeftOffsetOverride : resolveLineIndentOffset();
320575
+ const paragraphMarkLeftOffsetPx = lineTextStartOffsetPx;
320108
320576
  if (spacingPerSpace !== 0)
320109
320577
  el.style.wordSpacing = `${spacingPerSpace}px`;
320110
320578
  if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
320111
- let indentOffset;
320112
- if (indentOffsetOverride != null)
320113
- indentOffset = indentOffsetOverride;
320114
- else {
320115
- const paraIndent = block.attrs?.indent;
320116
- const indentLeft = paraIndent?.left ?? 0;
320117
- const firstLine = paraIndent?.firstLine ?? 0;
320118
- const hanging = paraIndent?.hanging ?? 0;
320119
- const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
320120
- const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
320121
- const wordLayoutValue = block.attrs?.wordLayout;
320122
- const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
320123
- const isListParagraph = Boolean(wordLayout?.marker);
320124
- const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
320125
- indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
320126
- }
320579
+ const indentOffset = lineTextStartOffsetPx;
320127
320580
  let cumulativeX = 0;
320128
320581
  const segments = line.segments;
320129
320582
  const segmentsByRun = /* @__PURE__ */ new Map;
@@ -320369,6 +320822,7 @@ function print() { __p += __j.call(arguments, '') }
320369
320822
  });
320370
320823
  closeCurrentWrapper();
320371
320824
  }
320825
+ this.appendFormattingParagraphMark(el, line, expandedBlock.runs, paragraphMarkLeftOffsetPx, availableWidth, hasExplicitPositioning ?? false);
320372
320826
  el.querySelectorAll("a[href]").forEach((anchor) => {
320373
320827
  const pendingTooltip = this.pendingTooltips.get(anchor);
320374
320828
  if (pendingTooltip) {
@@ -322000,7 +322454,8 @@ function print() { __p += __j.call(arguments, '') }
322000
322454
  emitCommentPositionsInViewing: options.layoutEngineOptions?.emitCommentPositionsInViewing,
322001
322455
  enableCommentsInViewing: options.layoutEngineOptions?.enableCommentsInViewing,
322002
322456
  presence: validatedPresence,
322003
- showBookmarks: options.layoutEngineOptions?.showBookmarks ?? false
322457
+ showBookmarks: options.layoutEngineOptions?.showBookmarks ?? false,
322458
+ showFormattingMarks: options.layoutEngineOptions?.showFormattingMarks ?? false
322004
322459
  };
322005
322460
  this.#trackedChangesOverrides = options.layoutEngineOptions?.trackedChanges;
322006
322461
  this.#viewportHost = doc$12.createElement("div");
@@ -323222,6 +323677,47 @@ function print() { __p += __j.call(arguments, '') }
323222
323677
  this.#pendingDocChange = true;
323223
323678
  this.#scheduleRerender();
323224
323679
  }
323680
+ setShowFormattingMarks(showFormattingMarks) {
323681
+ const next2 = !!showFormattingMarks;
323682
+ if (this.#layoutOptions.showFormattingMarks === next2)
323683
+ return;
323684
+ this.#layoutOptions.showFormattingMarks = next2;
323685
+ this.#painterAdapter.setShowFormattingMarks(next2);
323686
+ if (!this.#repaintCurrentLayout()) {
323687
+ this.#pendingDocChange = true;
323688
+ this.#scheduleRerender();
323689
+ }
323690
+ }
323691
+ #repaintCurrentLayout() {
323692
+ const layout = this.#layoutState.layout;
323693
+ if (!layout)
323694
+ return false;
323695
+ const blocks2 = this.#layoutLookupBlocks.length > 0 ? this.#layoutLookupBlocks : this.#layoutState.blocks;
323696
+ const measures = this.#layoutLookupMeasures.length > 0 ? this.#layoutLookupMeasures : this.#layoutState.measures;
323697
+ if (blocks2.length === 0 || blocks2.length !== measures.length)
323698
+ return false;
323699
+ const resolvedLayout = resolveLayout({
323700
+ layout,
323701
+ flowMode: this.#layoutOptions.flowMode ?? "paginated",
323702
+ blocks: blocks2,
323703
+ measures
323704
+ });
323705
+ const isSemanticFlow = this.#layoutOptions.flowMode === "semantic";
323706
+ this.#ensurePainter();
323707
+ if (!isSemanticFlow)
323708
+ this.#painterAdapter.setProviders(this.#headerFooterSession?.headerDecorationProvider, this.#headerFooterSession?.footerDecorationProvider);
323709
+ this.#domIndexObserverManager?.pause();
323710
+ try {
323711
+ this.#painterAdapter.paint({ resolvedLayout }, this.#painterHost);
323712
+ this.#refreshEditorDomAugmentations();
323713
+ } finally {
323714
+ this.#domIndexObserverManager?.resume();
323715
+ }
323716
+ this.#revalidateScrollContainer();
323717
+ this.#updatePermissionOverlay();
323718
+ this.#applyZoom();
323719
+ return true;
323720
+ }
323225
323721
  hitTest(clientX, clientY) {
323226
323722
  const normalized = this.#normalizeClientPoint(clientX, clientY);
323227
323723
  if (!normalized)
@@ -325357,7 +325853,8 @@ function print() { __p += __j.call(arguments, '') }
325357
325853
  headerProvider: this.#headerFooterSession?.headerDecorationProvider,
325358
325854
  footerProvider: this.#headerFooterSession?.footerDecorationProvider,
325359
325855
  ruler: this.#layoutOptions.ruler,
325360
- pageGap: this.#layoutState.layout?.pageGap ?? effectiveGap
325856
+ pageGap: this.#layoutState.layout?.pageGap ?? effectiveGap,
325857
+ showFormattingMarks: this.#layoutOptions.showFormattingMarks ?? false
325361
325858
  });
325362
325859
  const currentZoom = this.#layoutOptions.zoom ?? 1;
325363
325860
  if (currentZoom !== 1)
@@ -327839,11 +328336,11 @@ function print() { __p += __j.call(arguments, '') }
327839
328336
  ];
327840
328337
  });
327841
328338
 
327842
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D34Mg4v-.es.js
328339
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BTCvkLyW.es.js
327843
328340
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
327844
- var init_create_super_doc_ui_D34Mg4v_es = __esm(() => {
327845
- init_SuperConverter_ing_1fvK_es();
327846
- init_create_headless_toolbar_B_1fvPL0_es();
328341
+ var init_create_super_doc_ui_BTCvkLyW_es = __esm(() => {
328342
+ init_SuperConverter_BLL9JGke_es();
328343
+ init_create_headless_toolbar_D7n_Okb2_es();
327847
328344
  MOD_ALIASES = new Set([
327848
328345
  "Mod",
327849
328346
  "Meta",
@@ -327885,16 +328382,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
327885
328382
 
327886
328383
  // ../../packages/superdoc/dist/super-editor.es.js
327887
328384
  var init_super_editor_es = __esm(() => {
327888
- init_src_DKka36_es();
327889
- init_SuperConverter_ing_1fvK_es();
328385
+ init_src_C4h4xIas_es();
328386
+ init_SuperConverter_BLL9JGke_es();
327890
328387
  init_jszip_C49i9kUs_es();
327891
328388
  init_xml_js_CqGKpaft_es();
327892
- init_create_headless_toolbar_B_1fvPL0_es();
328389
+ init_create_headless_toolbar_D7n_Okb2_es();
327893
328390
  init_constants_DrU4EASo_es();
327894
328391
  init_dist_B8HfvhaK_es();
327895
328392
  init_unified_Dsuw2be5_es();
327896
328393
  init_DocxZipper_CUX64E5K_es();
327897
- init_create_super_doc_ui_D34Mg4v_es();
328394
+ init_create_super_doc_ui_BTCvkLyW_es();
327898
328395
  init_ui_CGB3qmy3_es();
327899
328396
  init_eventemitter3_UwU_CLPU_es();
327900
328397
  init_errors_C_DoKMoN_es();
@@ -406469,6 +406966,13 @@ var init_fld_preprocessors = __esm(() => {
406469
406966
  init_hyperlink_preprocessor();
406470
406967
  });
406471
406968
 
406969
+ // ../../packages/super-editor/src/editors/v1/core/super-converter/v2/importer/trackChangeElements.js
406970
+ var TRACK_CHANGE_ELEMENT_NAMES2, TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES2, isTrackChangeElement2 = (node4) => TRACK_CHANGE_ELEMENT_NAMES2.has(node4?.name), isTranslatedTrackChangeElement2 = (node4) => TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES2.has(node4?.name);
406971
+ var init_trackChangeElements = __esm(() => {
406972
+ TRACK_CHANGE_ELEMENT_NAMES2 = new Set(["w:del", "w:ins", "w:moveFrom", "w:moveTo"]);
406973
+ TRANSLATED_TRACK_CHANGE_ELEMENT_NAMES2 = new Set(["w:del", "w:ins"]);
406974
+ });
406975
+
406472
406976
  // ../../packages/super-editor/src/editors/v1/core/super-converter/field-references/preProcessNodesForFldChar.js
406473
406977
  var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => SKIP_FIELD_PROCESSING_NODE_NAMES2.has(node4?.name), preProcessNodesForFldChar2 = (nodes = [], docx) => {
406474
406978
  const processedNodes = [];
@@ -406477,6 +406981,7 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406477
406981
  let fieldRunRPrStack = [];
406478
406982
  let currentFieldStack = [];
406479
406983
  let unpairedEnd = null;
406984
+ let unpairedEndPreserveRaw = null;
406480
406985
  let collecting = false;
406481
406986
  const rawNodeSourceTokens = new WeakMap;
406482
406987
  const finalizeField = () => {
@@ -406485,8 +406990,11 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406485
406990
  const rawCollectedNodes = rawCollectedNodesStack.pop().filter((n) => n !== null);
406486
406991
  const fieldRunRPr = fieldRunRPrStack.pop() ?? null;
406487
406992
  const currentField = currentFieldStack.pop();
406488
- const combinedResult = _processCombinedNodesForFldChar2(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
406489
- const outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
406993
+ let outputNodes = rawCollectedNodes;
406994
+ if (!currentField.preserveRaw) {
406995
+ const combinedResult = _processCombinedNodesForFldChar2(collectedNodes, currentField.instrText.trim(), docx, currentField.instructionTokens, fieldRunRPr);
406996
+ outputNodes = combinedResult.handled ? combinedResult.nodes : rawCollectedNodes;
406997
+ }
406490
406998
  if (collectedNodesStack.length === 0) {
406491
406999
  processedNodes.push(...outputNodes);
406492
407000
  } else {
@@ -406601,7 +407109,11 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406601
407109
  node4.elements = childResult.processedNodes;
406602
407110
  if (childResult.unpairedBegin) {
406603
407111
  childResult.unpairedBegin.forEach((pendingField) => {
406604
- currentFieldStack.push(pendingField.fieldInfo);
407112
+ const fieldInfo = { ...pendingField.fieldInfo };
407113
+ if (fieldInfo.preserveRaw || isTrackChangeElement2(node4)) {
407114
+ fieldInfo.preserveRaw = true;
407115
+ }
407116
+ currentFieldStack.push(fieldInfo);
406605
407117
  collectedNodesStack.push([node4]);
406606
407118
  const rawStack = [rawNode];
406607
407119
  rawCollectedNodesStack.push(rawStack);
@@ -406609,6 +407121,17 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406609
407121
  capturedRawNodes.add(rawNode);
406610
407122
  });
406611
407123
  } else if (childResult.unpairedEnd) {
407124
+ const shouldPreserveRaw = childResult.unpairedEndPreserveRaw || isTrackChangeElement2(node4);
407125
+ if (collectedNodesStack.length === 0) {
407126
+ processedNodes.push(shouldPreserveRaw ? rawNode : node4);
407127
+ unpairedEnd = true;
407128
+ if (shouldPreserveRaw)
407129
+ unpairedEndPreserveRaw = true;
407130
+ return;
407131
+ }
407132
+ if (shouldPreserveRaw) {
407133
+ currentFieldStack[currentFieldStack.length - 1].preserveRaw = true;
407134
+ }
406612
407135
  collectedNodesStack[collectedNodesStack.length - 1].push(node4);
406613
407136
  captureRawNodeForCurrentField(rawNode, capturedRawNodes, rawSourceToken);
406614
407137
  finalizeField();
@@ -406646,7 +407169,7 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406646
407169
  });
406647
407170
  }
406648
407171
  }
406649
- return { processedNodes, unpairedBegin, unpairedEnd };
407172
+ return { processedNodes, unpairedBegin, unpairedEnd, unpairedEndPreserveRaw };
406650
407173
  }, _processCombinedNodesForFldChar2 = (nodesToCombine = [], instrText, docx, instructionTokens, fieldRunRPr) => {
406651
407174
  const instructionType = instrText.trim().split(" ")[0];
406652
407175
  const instructionPreProcessor = getInstructionPreProcessor2(instructionType);
@@ -406729,6 +407252,7 @@ var SKIP_FIELD_PROCESSING_NODE_NAMES2, shouldSkipFieldProcessing2 = (node4) => S
406729
407252
  };
406730
407253
  var init_preProcessNodesForFldChar = __esm(() => {
406731
407254
  init_fld_preprocessors();
407255
+ init_trackChangeElements();
406732
407256
  SKIP_FIELD_PROCESSING_NODE_NAMES2 = new Set(["w:drawing", "w:pict"]);
406733
407257
  FIELD_CONTROL_ELEMENT_NAMES2 = new Set(["w:fldChar"]);
406734
407258
  INSTRUCTION_ELEMENT_NAMES2 = new Set(["w:instrText", "w:tab"]);
@@ -414033,11 +414557,11 @@ var init_ins = __esm(() => {
414033
414557
  });
414034
414558
 
414035
414559
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v2/importer/trackChangesImporter.js
414036
- var isTrackChangeElement2 = (node4) => node4?.name === "w:del" || node4?.name === "w:ins", unwrapTrackChangeNode2 = (node4) => {
414560
+ var unwrapTrackChangeNode2 = (node4) => {
414037
414561
  if (!node4) {
414038
414562
  return null;
414039
414563
  }
414040
- if (isTrackChangeElement2(node4)) {
414564
+ if (isTranslatedTrackChangeElement2(node4)) {
414041
414565
  return node4;
414042
414566
  }
414043
414567
  if (node4.name === "w:sdt") {
@@ -414092,6 +414616,7 @@ var isTrackChangeElement2 = (node4) => node4?.name === "w:del" || node4?.name ==
414092
414616
  var init_trackChangesImporter = __esm(() => {
414093
414617
  init_del();
414094
414618
  init_ins();
414619
+ init_trackChangeElements();
414095
414620
  trackChangeNodeHandlerEntity2 = {
414096
414621
  handlerName: "trackChangeNodeHandler",
414097
414622
  handler: handleTrackChangeNode2
@@ -417947,12 +418472,12 @@ var detectDocumentOrigin2 = (docx) => {
417947
418472
  return nodeListHandlerFn;
417948
418473
  }, DEFAULT_SECTION_PROPS2, importHeadersFooters2 = (docx, converter, mainEditor, numbering, translatedNumbering, translatedLinkedStyles) => {
417949
418474
  const rels = docx["word/_rels/document.xml.rels"];
417950
- const relationships = rels?.elements.find((el) => el.name === "Relationships");
417951
- const { elements } = relationships || { elements: [] };
418475
+ const relationships = rels?.elements?.find((el) => el.name === "Relationships");
418476
+ const elements = relationships?.elements ?? [];
417952
418477
  const headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
417953
418478
  const footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
417954
- const headers = elements.filter((el) => el.attributes["Type"] === headerType);
417955
- const footers = elements.filter((el) => el.attributes["Type"] === footerType);
418479
+ const headers = elements.filter((el) => el.attributes?.["Type"] === headerType);
418480
+ const footers = elements.filter((el) => el.attributes?.["Type"] === footerType);
417956
418481
  const sectPr = findSectPr2(docx["word/document.xml"]) || [];
417957
418482
  const allSectPrElements = sectPr.flatMap((el) => el.elements);
417958
418483
  if (!mainEditor)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/mcp",
3
- "version": "0.3.0-next.60",
3
+ "version": "0.3.0-next.62",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20"
@@ -19,8 +19,8 @@
19
19
  "@types/bun": "^1.3.8",
20
20
  "@types/node": "22.19.2",
21
21
  "typescript": "^5.9.2",
22
- "@superdoc/super-editor": "0.0.1",
23
22
  "@superdoc/document-api": "0.0.1",
23
+ "@superdoc/super-editor": "0.0.1",
24
24
  "superdoc": "1.31.0"
25
25
  },
26
26
  "publishConfig": {