@superdoc-dev/cli 0.8.0-next.75 → 0.8.0-next.77

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 +509 -61
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -155994,7 +155994,7 @@ var init_SuperConverter_ing_1fvK_es = __esm(() => {
155994
155994
  };
155995
155995
  });
155996
155996
 
155997
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B_1fvPL0.es.js
155997
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CUl2z6Fd.es.js
155998
155998
  function parseSizeUnit(val = "0") {
155999
155999
  const length3 = val.toString() || "0";
156000
156000
  const value = Number.parseFloat(length3);
@@ -157704,10 +157704,12 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157704
157704
  return null;
157705
157705
  superdoc.on("editorCreate", onChange3);
157706
157706
  superdoc.on("document-mode-change", onChange3);
157707
+ superdoc.on("formatting-marks-change", onChange3);
157707
157708
  superdoc.on("zoomChange", onChange3);
157708
157709
  return () => {
157709
157710
  superdoc.off?.("editorCreate", onChange3);
157710
157711
  superdoc.off?.("document-mode-change", onChange3);
157712
+ superdoc.off?.("formatting-marks-change", onChange3);
157711
157713
  superdoc.off?.("zoomChange", onChange3);
157712
157714
  };
157713
157715
  }, subscribeToEditorEvents = (editor, onChange3) => {
@@ -157839,6 +157841,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157839
157841
  active: Boolean(superdoc?.config?.rulers),
157840
157842
  disabled: isCommandDisabled(context)
157841
157843
  };
157844
+ }, createFormattingMarksStateDeriver = () => ({ superdoc }) => {
157845
+ return {
157846
+ active: Boolean(superdoc?.config?.layoutEngineOptions?.showFormattingMarks),
157847
+ disabled: typeof superdoc?.toggleFormattingMarks !== "function"
157848
+ };
157842
157849
  }, createZoomStateDeriver = () => ({ context, superdoc }) => {
157843
157850
  return {
157844
157851
  active: false,
@@ -157854,6 +157861,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157854
157861
  }, createRulerExecute = () => ({ superdoc }) => {
157855
157862
  superdoc.toggleRuler?.();
157856
157863
  return true;
157864
+ }, createFormattingMarksExecute = () => ({ superdoc }) => {
157865
+ if (typeof superdoc?.toggleFormattingMarks !== "function")
157866
+ return false;
157867
+ superdoc.toggleFormattingMarks();
157868
+ return true;
157857
157869
  }, createZoomExecute = () => ({ superdoc, payload }) => {
157858
157870
  const normalizedPayload = Number.parseInt(String(payload), 10);
157859
157871
  if (!Number.isFinite(normalizedPayload) || normalizedPayload <= 0)
@@ -158453,6 +158465,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
158453
158465
  state: createRulerStateDeriver(),
158454
158466
  execute: createRulerExecute()
158455
158467
  },
158468
+ "formatting-marks": {
158469
+ id: "formatting-marks",
158470
+ state: createFormattingMarksStateDeriver(),
158471
+ execute: createFormattingMarksExecute()
158472
+ },
158456
158473
  zoom: {
158457
158474
  id: "zoom",
158458
158475
  state: createZoomStateDeriver(),
@@ -158630,7 +158647,7 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
158630
158647
  }
158631
158648
  };
158632
158649
  };
158633
- var init_create_headless_toolbar_B_1fvPL0_es = __esm(() => {
158650
+ var init_create_headless_toolbar_CUl2z6Fd_es = __esm(() => {
158634
158651
  init_SuperConverter_ing_1fvK_es();
158635
158652
  init_constants_DrU4EASo_es();
158636
158653
  init_dist_B8HfvhaK_es();
@@ -207317,7 +207334,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207317
207334
  init_remark_gfm_BhnWr3yf_es();
207318
207335
  });
207319
207336
 
207320
- // ../../packages/superdoc/dist/chunks/src-DKka36--.es.js
207337
+ // ../../packages/superdoc/dist/chunks/src-deKdT-sq.es.js
207321
207338
  function deleteProps(obj, propOrProps) {
207322
207339
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207323
207340
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -211096,6 +211113,98 @@ function createDropcapPlugin(editor) {
211096
211113
  } }
211097
211114
  });
211098
211115
  }
211116
+ function isListParagraph(node3) {
211117
+ return node3?.type?.name === "paragraph" && node3.attrs?.paragraphProperties?.numberingProperties && node3.attrs?.listRendering;
211118
+ }
211119
+ function isRtlParagraph$1(node3) {
211120
+ return node3?.attrs?.paragraphProperties?.rightToLeft === true || node3?.attrs?.direction === "rtl" || node3?.attrs?.rtl === true;
211121
+ }
211122
+ function getParagraphContext$1($pos) {
211123
+ for (let depth = $pos.depth;depth >= 0; depth--) {
211124
+ const node3 = $pos.node(depth);
211125
+ if (node3.type.name !== "paragraph")
211126
+ continue;
211127
+ return {
211128
+ node: node3,
211129
+ pos: depth === 0 ? 0 : $pos.before(depth),
211130
+ start: $pos.start(depth),
211131
+ end: $pos.end(depth)
211132
+ };
211133
+ }
211134
+ return null;
211135
+ }
211136
+ function getParagraphTextBounds2(paragraph2, paragraphStart) {
211137
+ let first$1 = null;
211138
+ let last2 = null;
211139
+ paragraph2.descendants((node3, pos) => {
211140
+ if (!node3.isText || !node3.text?.length)
211141
+ return true;
211142
+ const from$1 = paragraphStart + pos;
211143
+ const to = from$1 + node3.text.length;
211144
+ if (first$1 == null || from$1 < first$1)
211145
+ first$1 = from$1;
211146
+ if (last2 == null || to > last2)
211147
+ last2 = to;
211148
+ return true;
211149
+ });
211150
+ return first$1 == null || last2 == null ? null : {
211151
+ first: first$1,
211152
+ last: last2
211153
+ };
211154
+ }
211155
+ function findAdjacentTextPosition(doc$12, boundary, direction) {
211156
+ let target = null;
211157
+ if (direction < 0) {
211158
+ doc$12.nodesBetween(0, boundary, (node3, pos) => {
211159
+ if (node3.isText && node3.text?.length)
211160
+ target = pos + node3.text.length;
211161
+ return true;
211162
+ });
211163
+ return target;
211164
+ }
211165
+ doc$12.nodesBetween(boundary, doc$12.content.size, (node3, pos) => {
211166
+ if (target != null)
211167
+ return false;
211168
+ if (node3.isText && node3.text?.length) {
211169
+ target = pos;
211170
+ return false;
211171
+ }
211172
+ return true;
211173
+ });
211174
+ return target;
211175
+ }
211176
+ function shouldHandlePlainHorizontalArrow(event) {
211177
+ return (event.key === "ArrowLeft" || event.key === "ArrowRight") && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey;
211178
+ }
211179
+ function createListBoundaryNavigationPlugin() {
211180
+ return new Plugin({ props: { handleKeyDown(view, event) {
211181
+ if (!shouldHandlePlainHorizontalArrow(event))
211182
+ return false;
211183
+ const { state } = view;
211184
+ const { selection } = state;
211185
+ if (!selection.empty)
211186
+ return false;
211187
+ const paragraph2 = getParagraphContext$1(selection.$from);
211188
+ if (!paragraph2 || !isListParagraph(paragraph2.node))
211189
+ return false;
211190
+ if (isRtlParagraph$1(paragraph2.node))
211191
+ return false;
211192
+ const bounds = getParagraphTextBounds2(paragraph2.node, paragraph2.start);
211193
+ if (!bounds)
211194
+ return false;
211195
+ const direction = event.key === "ArrowLeft" ? -1 : 1;
211196
+ const atLeftBoundary = direction < 0 && selection.from <= bounds.first;
211197
+ const atRightBoundary = direction > 0 && selection.from >= bounds.last;
211198
+ if (!atLeftBoundary && !atRightBoundary)
211199
+ return false;
211200
+ const target = findAdjacentTextPosition(state.doc, direction < 0 ? paragraph2.pos : paragraph2.end, direction);
211201
+ if (target == null || target === selection.from)
211202
+ return false;
211203
+ event.preventDefault();
211204
+ view.dispatch(state.tr.setSelection(TextSelection.create(state.doc, target)).scrollIntoView());
211205
+ return true;
211206
+ } } });
211207
+ }
211099
211208
  function parseCssLength(value) {
211100
211209
  if (!value)
211101
211210
  return null;
@@ -250385,15 +250494,19 @@ function renderListMarker(params$1) {
250385
250494
  const suffixType = markerLayout?.suffix ?? "tab";
250386
250495
  if (suffixType === "tab") {
250387
250496
  const tabEl = doc$12.createElement("span");
250388
- tabEl.className = "superdoc-tab";
250497
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
250389
250498
  tabEl.innerHTML = "&nbsp;";
250390
250499
  tabEl.style.display = "inline-block";
250500
+ if (markerLayout?.run?.fontSize != null)
250501
+ tabEl.style.fontSize = `${markerLayout.run.fontSize}px`;
250391
250502
  tabEl.style.wordSpacing = "0px";
250392
250503
  tabEl.style.width = `${listTabWidth}px`;
250393
250504
  lineEl.prepend(tabEl);
250394
250505
  } else if (suffixType === "space") {
250395
250506
  const spaceEl = doc$12.createElement("span");
250396
250507
  spaceEl.classList.add("superdoc-marker-suffix-space");
250508
+ if (markerLayout?.run?.fontSize != null)
250509
+ spaceEl.style.fontSize = `${markerLayout.run.fontSize}px`;
250397
250510
  spaceEl.style.wordSpacing = "0px";
250398
250511
  spaceEl.textContent = " ";
250399
250512
  lineEl.prepend(spaceEl);
@@ -251279,9 +251392,9 @@ function resolveParagraphContent(fragment2, block, measure) {
251279
251392
  const paragraphLineIndex = fragment2.fromLine + index2;
251280
251393
  const isFirstLineOfPara = paragraphLineIndex === 0;
251281
251394
  const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
251282
- const isListParagraph = Boolean(wordLayout?.marker);
251395
+ const isListParagraph$1 = Boolean(wordLayout?.marker);
251283
251396
  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;
251284
- const indentOffset = isListParagraph ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
251397
+ const indentOffset = isListParagraph$1 ? isFirstLineOfPara ? (shouldUseResolvedListTextStart ? listFirstLineTextStartPx : undefined) ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
251285
251398
  return {
251286
251399
  line,
251287
251400
  lineIndex: paragraphLineIndex,
@@ -259915,11 +260028,9 @@ function collectClientRectsByLine(doc$12, entries2, sliceFrom, sliceTo) {
259915
260028
  function setDomRangeStart(range, entry, pos) {
259916
260029
  const el = entry.el;
259917
260030
  const pmStart = entry.pmStart;
259918
- const firstChild = el.firstChild;
259919
- if (firstChild && firstChild.nodeType === Node.TEXT_NODE) {
259920
- const textNode = firstChild;
259921
- const charIndex = mapPmPosToCharIndex(pos, pmStart, entry.pmEnd, textNode.length);
259922
- range.setStart(textNode, charIndex);
260031
+ const boundary = resolveTextBoundaryInElement(el, pos, pmStart, entry.pmEnd, "forward");
260032
+ if (boundary) {
260033
+ range.setStart(boundary.node, boundary.offset);
259923
260034
  return true;
259924
260035
  }
259925
260036
  if (!el.isConnected || !el.parentNode)
@@ -259934,11 +260045,9 @@ function setDomRangeStart(range, entry, pos) {
259934
260045
  function setDomRangeEnd(range, entry, pos) {
259935
260046
  const el = entry.el;
259936
260047
  const pmStart = entry.pmStart;
259937
- const firstChild = el.firstChild;
259938
- if (firstChild && firstChild.nodeType === Node.TEXT_NODE) {
259939
- const textNode = firstChild;
259940
- const charIndex = mapPmPosToCharIndex(pos, pmStart, entry.pmEnd, textNode.length);
259941
- range.setEnd(textNode, charIndex);
260048
+ const boundary = resolveTextBoundaryInElement(el, pos, pmStart, entry.pmEnd, "backward");
260049
+ if (boundary) {
260050
+ range.setEnd(boundary.node, boundary.offset);
259942
260051
  return true;
259943
260052
  }
259944
260053
  if (!el.isConnected || !el.parentNode)
@@ -259968,8 +260077,8 @@ function computeDomCaretPageLocal(options, pos) {
259968
260077
  return null;
259969
260078
  const pageRect = page.getBoundingClientRect();
259970
260079
  const zoom = options.zoom;
259971
- const textNode = targetEl.firstChild;
259972
- if (!textNode || textNode.nodeType !== Node.TEXT_NODE) {
260080
+ const boundary = resolveTextBoundaryInElement(targetEl, pos, entry.pmStart, entry.pmEnd, "forward");
260081
+ if (!boundary) {
259973
260082
  const elRect = targetEl.getBoundingClientRect();
259974
260083
  const atEnd = pos >= entry.pmEnd;
259975
260084
  return {
@@ -259978,10 +260087,9 @@ function computeDomCaretPageLocal(options, pos) {
259978
260087
  y: (elRect.top - pageRect.top) / zoom
259979
260088
  };
259980
260089
  }
259981
- const charIndex = mapPmPosToCharIndex(pos, entry.pmStart, entry.pmEnd, textNode.length);
259982
260090
  const range = document.createRange();
259983
- range.setStart(textNode, charIndex);
259984
- range.setEnd(textNode, charIndex);
260091
+ range.setStart(boundary.node, boundary.offset);
260092
+ range.setEnd(boundary.node, boundary.offset);
259985
260093
  const rangeRect = range.getBoundingClientRect();
259986
260094
  const lineRect = targetEl.closest(".superdoc-line")?.getBoundingClientRect() ?? rangeRect;
259987
260095
  return {
@@ -259990,6 +260098,53 @@ function computeDomCaretPageLocal(options, pos) {
259990
260098
  y: (lineRect.top - pageRect.top) / zoom
259991
260099
  };
259992
260100
  }
260101
+ function resolveTextBoundaryInElement(element3, pos, pmStart, pmEnd, affinity) {
260102
+ const textLength = element3.textContent?.length ?? 0;
260103
+ if (textLength <= 0)
260104
+ return null;
260105
+ return resolveDescendantTextBoundary(element3, mapPmPosToCharIndex(pos, pmStart, pmEnd, textLength), affinity);
260106
+ }
260107
+ function resolveDescendantTextBoundary(element3, targetOffset, affinity) {
260108
+ const walker = (element3.ownerDocument ?? document).createTreeWalker(element3, NodeFilter.SHOW_TEXT);
260109
+ let consumed = 0;
260110
+ let previous3 = null;
260111
+ let current = walker.nextNode();
260112
+ while (current) {
260113
+ const textNode = current;
260114
+ const textLength = textNode.textContent?.length ?? 0;
260115
+ if (textLength <= 0) {
260116
+ current = walker.nextNode();
260117
+ continue;
260118
+ }
260119
+ const segmentEnd = consumed + textLength;
260120
+ if (targetOffset < segmentEnd)
260121
+ return {
260122
+ node: textNode,
260123
+ offset: Math.max(0, targetOffset - consumed)
260124
+ };
260125
+ if (targetOffset === segmentEnd) {
260126
+ if (affinity === "backward")
260127
+ return {
260128
+ node: textNode,
260129
+ offset: textLength
260130
+ };
260131
+ previous3 = {
260132
+ node: textNode,
260133
+ offset: textLength
260134
+ };
260135
+ consumed = segmentEnd;
260136
+ current = walker.nextNode();
260137
+ continue;
260138
+ }
260139
+ previous3 = {
260140
+ node: textNode,
260141
+ offset: textLength
260142
+ };
260143
+ consumed = segmentEnd;
260144
+ current = walker.nextNode();
260145
+ }
260146
+ return previous3;
260147
+ }
259993
260148
  function mapPmPosToCharIndex(pos, pmStart, pmEnd, textLength) {
259994
260149
  if (!Number.isFinite(pos) || !Number.isFinite(pmStart) || !Number.isFinite(pmEnd))
259995
260150
  return 0;
@@ -281489,6 +281644,16 @@ var Node$13 = class Node$14 {
281489
281644
  tooltip: toolbarTexts$1.ruler,
281490
281645
  attributes: { ariaLabel: "Ruler" }
281491
281646
  });
281647
+ const formattingMarks = useToolbarItem({
281648
+ type: "button",
281649
+ name: "formattingMarks",
281650
+ command: "toggleFormattingMarks",
281651
+ allowWithoutEditor: true,
281652
+ icon: toolbarIcons$1.formattingMarks,
281653
+ active: false,
281654
+ tooltip: toolbarTexts$1.formattingMarks,
281655
+ attributes: { ariaLabel: "Formatting marks" }
281656
+ });
281492
281657
  const selectedLinkedStyle = exports_vue.ref(null);
281493
281658
  const linkedStyles = useToolbarItem({
281494
281659
  type: "dropdown",
@@ -281586,7 +281751,8 @@ var Node$13 = class Node$14 {
281586
281751
  "linkedStyles",
281587
281752
  "clearFormatting",
281588
281753
  "copyFormat",
281589
- "ruler"
281754
+ "ruler",
281755
+ "formattingMarks"
281590
281756
  ];
281591
281757
  const itemsToHideSM = [
281592
281758
  "zoom",
@@ -281637,6 +281803,7 @@ var Node$13 = class Node$14 {
281637
281803
  linkedStyles,
281638
281804
  separator,
281639
281805
  ruler,
281806
+ formattingMarks,
281640
281807
  copyFormat,
281641
281808
  clearFormatting,
281642
281809
  aiButton,
@@ -281652,6 +281819,7 @@ var Node$13 = class Node$14 {
281652
281819
  toolbarItems.splice(getLinkedStylesIndex - 1, 2);
281653
281820
  const filterItems = [
281654
281821
  "ruler",
281822
+ "formattingMarks",
281655
281823
  "zoom",
281656
281824
  "undo",
281657
281825
  "redo"
@@ -285242,6 +285410,82 @@ var Node$13 = class Node$14 {
285242
285410
  .superdoc-layout .track-format-dec.highlighted.track-change-focused {
285243
285411
  background-color: var(--sd-tracked-changes-format-background-focused, #ffd70033);
285244
285412
  }
285413
+ `, FORMATTING_MARKS_STYLES = `
285414
+ .superdoc-formatting-space-mark,
285415
+ .superdoc-marker-suffix-space {
285416
+ position: relative;
285417
+ }
285418
+
285419
+ .superdoc-formatting-space-mark {
285420
+ white-space: pre;
285421
+ }
285422
+
285423
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab {
285424
+ position: relative;
285425
+ visibility: visible !important;
285426
+ }
285427
+
285428
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab::after {
285429
+ content: "→";
285430
+ position: absolute;
285431
+ left: 50%;
285432
+ top: 50%;
285433
+ transform: translate(-50%, -50%);
285434
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
285435
+ font-size: 0.75em;
285436
+ line-height: 1;
285437
+ pointer-events: none;
285438
+ }
285439
+
285440
+ .superdoc-layout.superdoc-show-formatting-marks [dir="rtl"] .superdoc-tab::after {
285441
+ content: "←";
285442
+ }
285443
+
285444
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-space-mark::after,
285445
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-marker-suffix-space::after {
285446
+ content: "·";
285447
+ position: absolute;
285448
+ left: 50%;
285449
+ top: 50%;
285450
+ transform: translate(-50%, -50%);
285451
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
285452
+ font-size: 0.75em;
285453
+ line-height: 1;
285454
+ pointer-events: none;
285455
+ }
285456
+
285457
+ .superdoc-formatting-paragraph-mark {
285458
+ display: none;
285459
+ position: absolute;
285460
+ top: 0;
285461
+ transform: translateX(var(--sd-formatting-paragraph-mark-gap, 0.2em));
285462
+ color: var(--sd-formatting-mark-color, var(--sd-ui-action, currentColor));
285463
+ pointer-events: none;
285464
+ user-select: none;
285465
+ white-space: pre;
285466
+ z-index: 2;
285467
+ }
285468
+
285469
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-paragraph-mark {
285470
+ display: inline;
285471
+ }
285472
+
285473
+ .superdoc-layout.superdoc-show-formatting-marks [dir="rtl"] .superdoc-formatting-paragraph-mark {
285474
+ transform: translateX(calc(-100% - var(--sd-formatting-paragraph-mark-gap, 0.2em)));
285475
+ }
285476
+
285477
+ @media print {
285478
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-tab::after,
285479
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-space-mark::after,
285480
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-marker-suffix-space::after {
285481
+ content: "";
285482
+ display: none;
285483
+ }
285484
+
285485
+ .superdoc-layout.superdoc-show-formatting-marks .superdoc-formatting-paragraph-mark {
285486
+ display: none;
285487
+ }
285488
+ }
285245
285489
  `, SDT_CONTAINER_STYLES = `
285246
285490
  /* Document Section - Block-level container with gray border and hover tooltip */
285247
285491
  .superdoc-document-section {
@@ -285613,7 +285857,7 @@ menclose::after {
285613
285857
  pointer-events: none;
285614
285858
  background: var(--sd-menclose-h), var(--sd-menclose-v), var(--sd-menclose-up), var(--sd-menclose-down);
285615
285859
  }
285616
- `, printStylesInjected = false, linkStylesInjected = false, trackChangeStylesInjected = false, sdtContainerStylesInjected = false, fieldAnnotationStylesInjected = false, imageSelectionStylesInjected = false, mathMencloseStylesInjected = false, ensurePrintStyles = (doc$12) => {
285860
+ `, printStylesInjected = false, linkStylesInjected = false, trackChangeStylesInjected = false, formattingMarksStylesInjected = false, sdtContainerStylesInjected = false, fieldAnnotationStylesInjected = false, imageSelectionStylesInjected = false, mathMencloseStylesInjected = false, ensurePrintStyles = (doc$12) => {
285617
285861
  if (printStylesInjected || !doc$12)
285618
285862
  return;
285619
285863
  const styleEl = doc$12.createElement("style");
@@ -285637,6 +285881,14 @@ menclose::after {
285637
285881
  styleEl.textContent = TRACK_CHANGE_STYLES;
285638
285882
  doc$12.head?.appendChild(styleEl);
285639
285883
  trackChangeStylesInjected = true;
285884
+ }, ensureFormattingMarksStyles = (doc$12) => {
285885
+ if (formattingMarksStylesInjected || !doc$12)
285886
+ return;
285887
+ const styleEl = doc$12.createElement("style");
285888
+ styleEl.setAttribute("data-superdoc-formatting-marks-styles", "true");
285889
+ styleEl.textContent = FORMATTING_MARKS_STYLES;
285890
+ doc$12.head?.appendChild(styleEl);
285891
+ formattingMarksStylesInjected = true;
285640
285892
  }, ensureSdtContainerStyles = (doc$12) => {
285641
285893
  if (sdtContainerStylesInjected || !doc$12)
285642
285894
  return;
@@ -286125,6 +286377,12 @@ menclose::after {
286125
286377
  if (value != null && value !== "" && key2 in el.style)
286126
286378
  el.style[key2] = String(value);
286127
286379
  });
286380
+ }, convertParagraphMarkToCellMark = (lineEl) => {
286381
+ const mark2 = lineEl.querySelector(".superdoc-formatting-paragraph-mark");
286382
+ if (!mark2)
286383
+ return;
286384
+ mark2.classList.add("superdoc-formatting-cell-mark");
286385
+ mark2.textContent = "¤";
286128
286386
  }, renderEmbeddedTable = (params$1) => {
286129
286387
  const { doc: doc$12, table: table2, measure, availableWidth, context, renderLine, captureLineSnapshot, renderDrawingContent, applySdtDataset, fromRow: paramFromRow, toRow: paramToRow, partialRow: paramPartialRow } = params$1;
286130
286388
  const effectiveFromRow = paramFromRow ?? 0;
@@ -286399,6 +286657,7 @@ menclose::after {
286399
286657
  const paragraphMeasure = blockMeasure;
286400
286658
  const lines = paragraphMeasure.lines;
286401
286659
  const blockLineCount = lines?.length || 0;
286660
+ const isLastBlockInCell = i4 === Math.min(blockMeasures.length, cellBlocks.length) - 1;
286402
286661
  const wordLayout = block.attrs?.wordLayout ?? null;
286403
286662
  const markerLayout = wordLayout?.marker;
286404
286663
  const markerMeasure = paragraphMeasure.marker;
@@ -286453,6 +286712,8 @@ menclose::after {
286453
286712
  ...context,
286454
286713
  section: "body"
286455
286714
  }, lineIdx, isLastLine, lineIdx === 0 && localStartLine === 0 ? listFirstLineTextStartPx : undefined);
286715
+ if (isLastBlockInCell && isLastLine)
286716
+ convertParagraphMarkToCellMark(lineEl);
286456
286717
  lineEl.style.paddingLeft = "";
286457
286718
  lineEl.style.paddingRight = "";
286458
286719
  lineEl.style.textIndent = "";
@@ -287872,6 +288133,9 @@ menclose::after {
287872
288133
  },
287873
288134
  setScrollContainer(el) {
287874
288135
  painter.setScrollContainer(el);
288136
+ },
288137
+ setShowFormattingMarks(showFormattingMarks) {
288138
+ painter.setShowFormattingMarks(showFormattingMarks);
287875
288139
  }
287876
288140
  };
287877
288141
  }, PresentationPaintIndex = class {
@@ -287955,13 +288219,16 @@ menclose::after {
287955
288219
  #zoom = 1;
287956
288220
  #scrollContainer = null;
287957
288221
  #virtualizationPins = [];
288222
+ #showFormattingMarks = false;
287958
288223
  get hasPainter() {
287959
288224
  return this.#painter !== null;
287960
288225
  }
287961
288226
  ensurePainter(options) {
287962
288227
  if (!this.#painter) {
288228
+ this.#showFormattingMarks = Boolean(options.showFormattingMarks ?? this.#showFormattingMarks);
287963
288229
  this.#painter = createDomPainter({
287964
288230
  ...options,
288231
+ showFormattingMarks: this.#showFormattingMarks,
287965
288232
  onPaintSnapshot: (snapshot2) => {
287966
288233
  this.#lastPaintSnapshot = snapshot2;
287967
288234
  this.#paintIndex.update(snapshot2);
@@ -287985,6 +288252,13 @@ menclose::after {
287985
288252
  this.#footerProvider = footer;
287986
288253
  this.#applyProviders();
287987
288254
  }
288255
+ setShowFormattingMarks(showFormattingMarks) {
288256
+ const next2 = Boolean(showFormattingMarks);
288257
+ if (this.#showFormattingMarks === next2)
288258
+ return;
288259
+ this.#showFormattingMarks = next2;
288260
+ this.#applyShowFormattingMarks();
288261
+ }
287988
288262
  setZoom(zoom) {
287989
288263
  if (this.#zoom === zoom)
287990
288264
  return;
@@ -288039,6 +288313,7 @@ menclose::after {
288039
288313
  this.#applyZoom();
288040
288314
  this.#applyScrollContainer();
288041
288315
  this.#applyVirtualizationPins();
288316
+ this.#applyShowFormattingMarks();
288042
288317
  }
288043
288318
  #applyProviders() {
288044
288319
  this.#painter?.setProviders(this.#headerProvider, this.#footerProvider);
@@ -288052,6 +288327,9 @@ menclose::after {
288052
288327
  #applyVirtualizationPins() {
288053
288328
  this.#painter?.setVirtualizationPins(this.#virtualizationPins);
288054
288329
  }
288330
+ #applyShowFormattingMarks() {
288331
+ this.#painter?.setShowFormattingMarks(this.#showFormattingMarks);
288332
+ }
288055
288333
  }, hashParagraphBorder$1 = (border) => {
288056
288334
  const parts = [];
288057
288335
  if (border.style !== undefined)
@@ -291203,7 +291481,7 @@ menclose::after {
291203
291481
  let paraIndentLeft = 0;
291204
291482
  let paraIndentRight = 0;
291205
291483
  let effectiveLeft = 0;
291206
- let isListParagraph = false;
291484
+ let isListParagraph$1 = false;
291207
291485
  let wl;
291208
291486
  if (block.kind === "paragraph") {
291209
291487
  const indentLeft = typeof block.attrs?.indent?.left === "number" ? block.attrs.indent.left : 0;
@@ -291212,8 +291490,8 @@ menclose::after {
291212
291490
  paraIndentRight = Number.isFinite(indentRight) ? indentRight : 0;
291213
291491
  effectiveLeft = paraIndentLeft;
291214
291492
  wl = getWordLayoutConfig(block);
291215
- isListParagraph = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
291216
- if (isListParagraph) {
291493
+ isListParagraph$1 = Boolean(block.attrs?.numberingProperties) || Boolean(wl?.marker);
291494
+ if (isListParagraph$1) {
291217
291495
  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;
291218
291496
  if (typeof explicitTextStart === "number" && explicitTextStart > paraIndentLeft)
291219
291497
  effectiveLeft = explicitTextStart;
@@ -291223,7 +291501,7 @@ menclose::after {
291223
291501
  let availableWidth = Math.max(0, fragmentWidth - totalIndent);
291224
291502
  if (totalIndent > fragmentWidth)
291225
291503
  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.`);
291226
- const hasRenderedMarkerText = isListParagraph && (markerTextWidth ?? 0) > 0;
291504
+ const hasRenderedMarkerText = isListParagraph$1 && (markerTextWidth ?? 0) > 0;
291227
291505
  if (isFirstLine && block.kind === "paragraph" && !hasRenderedMarkerText) {
291228
291506
  const suppressFLI = block.attrs?.suppressFirstLineIndent === true;
291229
291507
  const firstLineOffset = getFirstLineIndentOffset(block.attrs?.indent, suppressFLI);
@@ -298930,12 +299208,12 @@ menclose::after {
298930
299208
  return;
298931
299209
  console.log(...args$1);
298932
299210
  }, 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;
298933
- var init_src_DKka36_es = __esm(() => {
299211
+ var init_src_deKdT_sq_es = __esm(() => {
298934
299212
  init_rolldown_runtime_Bg48TavK_es();
298935
299213
  init_SuperConverter_ing_1fvK_es();
298936
299214
  init_jszip_C49i9kUs_es();
298937
299215
  init_uuid_qzgm05fK_es();
298938
- init_create_headless_toolbar_B_1fvPL0_es();
299216
+ init_create_headless_toolbar_CUl2z6Fd_es();
298939
299217
  init_constants_DrU4EASo_es();
298940
299218
  init_dist_B8HfvhaK_es();
298941
299219
  init_unified_Dsuw2be5_es();
@@ -301980,7 +302258,8 @@ ${err.toString()}`);
301980
302258
  event.preventDefault();
301981
302259
  return true;
301982
302260
  } } } }),
301983
- createLeadingCaretPlugin()
302261
+ createLeadingCaretPlugin(),
302262
+ createListBoundaryNavigationPlugin()
301984
302263
  ];
301985
302264
  }
301986
302265
  });
@@ -317730,7 +318009,9 @@ function print() { __p += __j.call(arguments, '') }
317730
318009
  cut: scissors_solid_default,
317731
318010
  copy: copy_solid_default,
317732
318011
  paste: paste_solid_default,
317733
- 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'
318012
+ 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',
318013
+ 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>
318014
+ `
317734
318015
  };
317735
318016
  _hoisted_1$20 = [
317736
318017
  "onClick",
@@ -318907,6 +319188,7 @@ function print() { __p += __j.call(arguments, '') }
318907
319188
  acceptTrackedChangeBySelection: "track-changes-accept-selection",
318908
319189
  rejectTrackedChangeOnSelection: "track-changes-reject-selection",
318909
319190
  ruler: "ruler",
319191
+ formattingMarks: "formatting-marks",
318910
319192
  zoom: "zoom",
318911
319193
  documentMode: "document-mode",
318912
319194
  link: "link",
@@ -320394,6 +320676,7 @@ function print() { __p += __j.call(arguments, '') }
320394
320676
  lineHeight: "Line height",
320395
320677
  formatText: "Format text",
320396
320678
  ruler: "Show or hide ruler",
320679
+ formattingMarks: "Show or hide formatting marks",
320397
320680
  pageBreak: "Insert page break",
320398
320681
  documentEditingMode: "Editing",
320399
320682
  documentSuggestingMode: "Suggesting",
@@ -320773,6 +321056,10 @@ function print() { __p += __j.call(arguments, '') }
320773
321056
  const currentMode = this.snapshot?.commands?.["document-mode"]?.value || "editing";
320774
321057
  if (!this.activeEditor || currentMode === "viewing") {
320775
321058
  this.#deactivateAll();
321059
+ this.toolbarItems.forEach((item) => {
321060
+ if (item.allowWithoutEditor?.value)
321061
+ this.#applyHeadlessState(item);
321062
+ });
320776
321063
  return;
320777
321064
  }
320778
321065
  const { state } = this.activeEditor;
@@ -325368,11 +325655,13 @@ function print() { __p += __j.call(arguments, '') }
325368
325655
  this.onPaintSnapshotCallback = null;
325369
325656
  this.mountedPageIndices = [];
325370
325657
  this.resolvedLayout = null;
325658
+ this.showFormattingMarks = false;
325371
325659
  this.options = options;
325372
325660
  this.layoutMode = options.layoutMode ?? "vertical";
325373
325661
  this.isSemanticFlow = (options.flowMode ?? "paginated") === "semantic";
325374
325662
  this.headerProvider = options.headerProvider;
325375
325663
  this.footerProvider = options.footerProvider;
325664
+ this.showFormattingMarks = options.showFormattingMarks === true;
325376
325665
  const defaultGap = this.layoutMode === "horizontal" ? 20 : 24;
325377
325666
  this.pageGap = typeof options.pageGap === "number" && Number.isFinite(options.pageGap) ? Math.max(0, options.pageGap) : defaultGap;
325378
325667
  if (!this.isSemanticFlow && this.layoutMode === "vertical" && options.virtualization?.enabled) {
@@ -325389,10 +325678,33 @@ function print() { __p += __j.call(arguments, '') }
325389
325678
  }
325390
325679
  this.onPaintSnapshotCallback = options.onPaintSnapshot ?? null;
325391
325680
  }
325681
+ setShowFormattingMarks(showFormattingMarks) {
325682
+ const next2 = showFormattingMarks === true;
325683
+ if (this.showFormattingMarks === next2)
325684
+ return;
325685
+ this.showFormattingMarks = next2;
325686
+ this.applyFormattingMarksClass();
325687
+ this.invalidateRenderedContent();
325688
+ }
325392
325689
  setProviders(header, footer) {
325393
325690
  this.headerProvider = header;
325394
325691
  this.footerProvider = footer;
325395
325692
  }
325693
+ applyFormattingMarksClass(mount = this.mount) {
325694
+ mount?.classList.toggle("superdoc-show-formatting-marks", this.showFormattingMarks);
325695
+ }
325696
+ invalidateRenderedContent() {
325697
+ this.pageStates = [];
325698
+ this.currentLayout = null;
325699
+ this.pageIndexToState.clear();
325700
+ this.virtualMountedKey = "";
325701
+ this.clearGapSpacers();
325702
+ this.topSpacerEl = null;
325703
+ this.bottomSpacerEl = null;
325704
+ this.virtualPagesEl = null;
325705
+ this.processedLayoutVersion = -1;
325706
+ this.layoutVersion += 1;
325707
+ }
325396
325708
  setVirtualizationPins(pageIndices) {
325397
325709
  this.virtualPinnedPages = Array.from(new Set((pageIndices ?? []).filter((n) => Number.isInteger(n)))).sort((a2, b$1) => a2 - b$1);
325398
325710
  if (this.virtualEnabled && this.mount)
@@ -325575,6 +325887,7 @@ function print() { __p += __j.call(arguments, '') }
325575
325887
  ensurePrintStyles(doc$12);
325576
325888
  ensureLinkStyles(doc$12);
325577
325889
  ensureTrackChangeStyles(doc$12);
325890
+ ensureFormattingMarksStyles(doc$12);
325578
325891
  ensureFieldAnnotationStyles(doc$12);
325579
325892
  ensureSdtContainerStyles(doc$12);
325580
325893
  ensureImageSelectionStyles(doc$12);
@@ -325582,8 +325895,11 @@ function print() { __p += __j.call(arguments, '') }
325582
325895
  if (!this.isSemanticFlow && this.options.ruler?.enabled)
325583
325896
  ensureRulerStyles(doc$12);
325584
325897
  mount.classList.add(CLASS_NAMES$1.container);
325585
- if (this.mount && this.mount !== mount)
325898
+ this.applyFormattingMarksClass(mount);
325899
+ if (this.mount && this.mount !== mount) {
325586
325900
  this.resetState();
325901
+ this.applyFormattingMarksClass(mount);
325902
+ }
325587
325903
  this.layoutVersion += 1;
325588
325904
  this.layoutEpoch = resolvedLayout.layoutEpoch ?? 0;
325589
325905
  this.mount = mount;
@@ -326574,7 +326890,8 @@ function print() { __p += __j.call(arguments, '') }
326574
326890
  const resolvedMarker = content3.marker;
326575
326891
  const expandedRunsForBlock = expandRunsForInlineNewlines(block.runs);
326576
326892
  content3.lines.forEach((resolvedLine) => {
326577
- const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset);
326893
+ const paragraphMarkLeftOffset = this.resolveResolvedListParagraphMarkOffset(resolvedLine.isListFirstLine ? resolvedMarker : undefined, fragment2.markerTextWidth, resolvedLine.indentOffset);
326894
+ const lineEl = this.renderLine(block, resolvedLine.line, context, resolvedLine.availableWidth, resolvedLine.lineIndex, resolvedLine.skipJustify, expandedRunsForBlock, resolvedLine.resolvedListTextStartPx, resolvedLine.indentOffset, paragraphMarkLeftOffset);
326578
326895
  if (!resolvedLine.isListFirstLine) {
326579
326896
  if (resolvedLine.paddingLeftPx > 0)
326580
326897
  lineEl.style.paddingLeft = `${resolvedLine.paddingLeftPx}px`;
@@ -326619,15 +326936,17 @@ function print() { __p += __j.call(arguments, '') }
326619
326936
  markerContainer.appendChild(markerEl);
326620
326937
  if (resolvedMarker.suffix === "tab") {
326621
326938
  const tabEl = this.doc.createElement("span");
326622
- tabEl.className = "superdoc-tab";
326939
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
326623
326940
  tabEl.innerHTML = "&nbsp;";
326624
326941
  tabEl.style.display = "inline-block";
326942
+ tabEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
326625
326943
  tabEl.style.wordSpacing = "0px";
326626
326944
  tabEl.style.width = `${resolvedMarker.suffixWidthPx}px`;
326627
326945
  lineEl.prepend(tabEl);
326628
326946
  } else if (resolvedMarker.suffix === "space") {
326629
326947
  const spaceEl = this.doc.createElement("span");
326630
326948
  spaceEl.classList.add("superdoc-marker-suffix-space");
326949
+ spaceEl.style.fontSize = `${resolvedMarker.run.fontSize}px`;
326631
326950
  spaceEl.style.wordSpacing = "0px";
326632
326951
  spaceEl.textContent = " ";
326633
326952
  lineEl.prepend(spaceEl);
@@ -326758,15 +327077,17 @@ function print() { __p += __j.call(arguments, '') }
326758
327077
  const suffix = marker.suffix ?? "tab";
326759
327078
  if (suffix === "tab") {
326760
327079
  const tabEl = this.doc.createElement("span");
326761
- tabEl.className = "superdoc-tab";
327080
+ tabEl.classList.add("superdoc-tab", "superdoc-marker-suffix-tab");
326762
327081
  tabEl.innerHTML = "&nbsp;";
326763
327082
  tabEl.style.display = "inline-block";
327083
+ tabEl.style.fontSize = `${marker.run.fontSize}px`;
326764
327084
  tabEl.style.wordSpacing = "0px";
326765
327085
  tabEl.style.width = `${listTabWidth}px`;
326766
327086
  lineEl.prepend(tabEl);
326767
327087
  } else if (suffix === "space") {
326768
327088
  const spaceEl = this.doc.createElement("span");
326769
327089
  spaceEl.classList.add("superdoc-marker-suffix-space");
327090
+ spaceEl.style.fontSize = `${marker.run.fontSize}px`;
326770
327091
  spaceEl.style.wordSpacing = "0px";
326771
327092
  spaceEl.textContent = " ";
326772
327093
  lineEl.prepend(spaceEl);
@@ -327978,6 +328299,87 @@ function print() { __p += __j.call(arguments, '') }
327978
328299
  wrapper.dataset.pmEnd = String(run2.pmEnd);
327979
328300
  return wrapper;
327980
328301
  }
328302
+ setTextContentWithFormattingSpaceMarks(element3, text5) {
328303
+ if (!this.showFormattingMarks || !text5.includes(" ") || !this.doc) {
328304
+ element3.textContent = text5;
328305
+ return;
328306
+ }
328307
+ element3.textContent = "";
328308
+ let chunkStart = 0;
328309
+ for (let index2 = 0;index2 < text5.length; index2 += 1) {
328310
+ if (text5[index2] !== " ")
328311
+ continue;
328312
+ if (index2 > chunkStart)
328313
+ element3.appendChild(this.doc.createTextNode(text5.slice(chunkStart, index2)));
328314
+ const space = this.doc.createElement("span");
328315
+ space.classList.add("superdoc-formatting-space-mark");
328316
+ space.textContent = " ";
328317
+ element3.appendChild(space);
328318
+ chunkStart = index2 + 1;
328319
+ }
328320
+ if (chunkStart < text5.length)
328321
+ element3.appendChild(this.doc.createTextNode(text5.slice(chunkStart)));
328322
+ }
328323
+ findLastTextRun(runs2) {
328324
+ for (let index2 = runs2.length - 1;index2 >= 0; index2 -= 1) {
328325
+ const run2 = runs2[index2];
328326
+ if (run2 && (run2.kind === "text" || run2.kind === undefined) && "text" in run2)
328327
+ return {
328328
+ run: run2,
328329
+ index: index2
328330
+ };
328331
+ }
328332
+ return null;
328333
+ }
328334
+ appendFormattingParagraphMark(lineEl, line, runs2, leftOffsetPx, availableWidth, hasExplicitPositioning) {
328335
+ if (!this.showFormattingMarks || !this.doc)
328336
+ return;
328337
+ const lastRun = runs2.length > 0 ? runs2[runs2.length - 1] : null;
328338
+ if (lastRun) {
328339
+ const lastRunIndex = runs2.length - 1;
328340
+ if (line.toRun < lastRunIndex)
328341
+ return;
328342
+ if (line.toRun === lastRunIndex && (lastRun.kind === "text" || lastRun.kind === undefined) && "text" in lastRun && line.toChar < lastRun.text.length)
328343
+ return;
328344
+ }
328345
+ const lastTextRun = this.findLastTextRun(runs2);
328346
+ const mark2 = this.doc.createElement("span");
328347
+ mark2.classList.add("superdoc-formatting-paragraph-mark");
328348
+ mark2.setAttribute("aria-hidden", "true");
328349
+ mark2.textContent = "¶";
328350
+ const run2 = lastTextRun?.run;
328351
+ if (run2) {
328352
+ if (run2.fontFamily)
328353
+ mark2.style.fontFamily = toCssFontFamily(run2.fontFamily) ?? run2.fontFamily;
328354
+ if (typeof run2.fontSize === "number")
328355
+ mark2.style.fontSize = `${run2.fontSize}px`;
328356
+ if (run2.bold)
328357
+ mark2.style.fontWeight = "bold";
328358
+ if (run2.italic)
328359
+ mark2.style.fontStyle = "italic";
328360
+ if (run2.letterSpacing != null)
328361
+ mark2.style.letterSpacing = `${run2.letterSpacing}px`;
328362
+ }
328363
+ mark2.style.lineHeight = `${line.lineHeight}px`;
328364
+ const lineWidth = line.naturalWidth ?? line.width ?? 0;
328365
+ const alignmentSlack = Math.max(0, availableWidth - lineWidth);
328366
+ const textAlign = lineEl.style.textAlign;
328367
+ const alignmentOffset = !hasExplicitPositioning && textAlign === "center" ? alignmentSlack / 2 : !hasExplicitPositioning && textAlign === "right" ? alignmentSlack : 0;
328368
+ const visualTextEndOffset = lineEl.dir === "rtl" || lineEl.style.direction === "rtl" ? alignmentOffset : alignmentOffset + lineWidth;
328369
+ mark2.style.left = `${Math.max(0, leftOffsetPx + visualTextEndOffset)}px`;
328370
+ lineEl.appendChild(mark2);
328371
+ }
328372
+ resolveResolvedListParagraphMarkOffset(marker, markerTextWidth, fallbackOffset) {
328373
+ if (typeof fallbackOffset === "number" && Number.isFinite(fallbackOffset) && fallbackOffset > 0)
328374
+ return fallbackOffset;
328375
+ if (!marker || marker.vanish)
328376
+ return fallbackOffset;
328377
+ const paddingLeft = Number.isFinite(marker.firstLinePaddingLeftPx) ? marker.firstLinePaddingLeftPx : 0;
328378
+ const suffixWidth = marker.suffix !== "nothing" && Number.isFinite(marker.suffixWidthPx) ? marker.suffixWidthPx : 0;
328379
+ if (marker.justification === "left")
328380
+ return paddingLeft + (typeof markerTextWidth === "number" && Number.isFinite(markerTextWidth) && markerTextWidth > 0 ? markerTextWidth : 0) + suffixWidth;
328381
+ return paddingLeft + (marker.justification === "center" && Number.isFinite(marker.centerPaddingAdjustPx) ? marker.centerPaddingAdjustPx ?? 0 : 0) + suffixWidth;
328382
+ }
327981
328383
  renderRun(run2, context, trackedConfig) {
327982
328384
  if (this.isImageRun(run2))
327983
328385
  return this.renderImageRun(run2);
@@ -327995,7 +328397,7 @@ function print() { __p += __j.call(arguments, '') }
327995
328397
  const isActiveLink = !!(linkData && !linkData.blocked && linkData.href);
327996
328398
  const elem = isActiveLink ? this.doc.createElement("a") : this.doc.createElement("span");
327997
328399
  const text5 = resolveRunText(run2, context);
327998
- elem.textContent = text5;
328400
+ this.setTextContentWithFormattingSpaceMarks(elem, text5);
327999
328401
  if (linkData?.dataset)
328000
328402
  applyLinkDataset(elem, linkData.dataset);
328001
328403
  if (linkData?.blocked) {
@@ -328354,7 +328756,7 @@ function print() { __p += __j.call(arguments, '') }
328354
328756
  this.applySdtDataset(annotation, run2.sdt);
328355
328757
  return annotation;
328356
328758
  }
328357
- renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride) {
328759
+ renderLine(block, line, context, availableWidthOverride, lineIndex, skipJustify, preExpandedRuns, resolvedListTextStartPx, indentOffsetOverride, paragraphMarkLeftOffsetOverride) {
328358
328760
  if (!this.doc)
328359
328761
  throw new Error("DomPainter: document is not available");
328360
328762
  const expandedBlock = {
@@ -328569,25 +328971,27 @@ function print() { __p += __j.call(arguments, '') }
328569
328971
  spaceCount,
328570
328972
  shouldJustify: justifyShouldApply
328571
328973
  });
328974
+ const resolveLineIndentOffset = () => {
328975
+ if (indentOffsetOverride != null)
328976
+ return indentOffsetOverride;
328977
+ const paraIndent = block.attrs?.indent;
328978
+ const indentLeft = paraIndent?.left ?? 0;
328979
+ const firstLine = paraIndent?.firstLine ?? 0;
328980
+ const hanging = paraIndent?.hanging ?? 0;
328981
+ const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
328982
+ const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
328983
+ const wordLayoutValue = block.attrs?.wordLayout;
328984
+ const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
328985
+ const isListParagraph$1 = Boolean(wordLayout?.marker);
328986
+ 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;
328987
+ return isListParagraph$1 ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
328988
+ };
328989
+ const lineTextStartOffsetPx = paragraphMarkLeftOffsetOverride != null ? paragraphMarkLeftOffsetOverride : resolveLineIndentOffset();
328990
+ const paragraphMarkLeftOffsetPx = lineTextStartOffsetPx;
328572
328991
  if (spacingPerSpace !== 0)
328573
328992
  el.style.wordSpacing = `${spacingPerSpace}px`;
328574
328993
  if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
328575
- let indentOffset;
328576
- if (indentOffsetOverride != null)
328577
- indentOffset = indentOffsetOverride;
328578
- else {
328579
- const paraIndent = block.attrs?.indent;
328580
- const indentLeft = paraIndent?.left ?? 0;
328581
- const firstLine = paraIndent?.firstLine ?? 0;
328582
- const hanging = paraIndent?.hanging ?? 0;
328583
- const isFirstLineOfPara = lineIndex === 0 || lineIndex === undefined;
328584
- const firstLineOffsetForCumX = isFirstLineOfPara ? firstLine - hanging : 0;
328585
- const wordLayoutValue = block.attrs?.wordLayout;
328586
- const wordLayout = isMinimalWordLayout$1(wordLayoutValue) ? wordLayoutValue : undefined;
328587
- const isListParagraph = Boolean(wordLayout?.marker);
328588
- 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;
328589
- indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
328590
- }
328994
+ const indentOffset = lineTextStartOffsetPx;
328591
328995
  let cumulativeX = 0;
328592
328996
  const segments = line.segments;
328593
328997
  const segmentsByRun = /* @__PURE__ */ new Map;
@@ -328833,6 +329237,7 @@ function print() { __p += __j.call(arguments, '') }
328833
329237
  });
328834
329238
  closeCurrentWrapper();
328835
329239
  }
329240
+ this.appendFormattingParagraphMark(el, line, expandedBlock.runs, paragraphMarkLeftOffsetPx, availableWidth, hasExplicitPositioning ?? false);
328836
329241
  el.querySelectorAll("a[href]").forEach((anchor) => {
328837
329242
  const pendingTooltip = this.pendingTooltips.get(anchor);
328838
329243
  if (pendingTooltip) {
@@ -330464,7 +330869,8 @@ function print() { __p += __j.call(arguments, '') }
330464
330869
  emitCommentPositionsInViewing: options.layoutEngineOptions?.emitCommentPositionsInViewing,
330465
330870
  enableCommentsInViewing: options.layoutEngineOptions?.enableCommentsInViewing,
330466
330871
  presence: validatedPresence,
330467
- showBookmarks: options.layoutEngineOptions?.showBookmarks ?? false
330872
+ showBookmarks: options.layoutEngineOptions?.showBookmarks ?? false,
330873
+ showFormattingMarks: options.layoutEngineOptions?.showFormattingMarks ?? false
330468
330874
  };
330469
330875
  this.#trackedChangesOverrides = options.layoutEngineOptions?.trackedChanges;
330470
330876
  this.#viewportHost = doc$12.createElement("div");
@@ -331686,6 +332092,47 @@ function print() { __p += __j.call(arguments, '') }
331686
332092
  this.#pendingDocChange = true;
331687
332093
  this.#scheduleRerender();
331688
332094
  }
332095
+ setShowFormattingMarks(showFormattingMarks) {
332096
+ const next2 = !!showFormattingMarks;
332097
+ if (this.#layoutOptions.showFormattingMarks === next2)
332098
+ return;
332099
+ this.#layoutOptions.showFormattingMarks = next2;
332100
+ this.#painterAdapter.setShowFormattingMarks(next2);
332101
+ if (!this.#repaintCurrentLayout()) {
332102
+ this.#pendingDocChange = true;
332103
+ this.#scheduleRerender();
332104
+ }
332105
+ }
332106
+ #repaintCurrentLayout() {
332107
+ const layout = this.#layoutState.layout;
332108
+ if (!layout)
332109
+ return false;
332110
+ const blocks2 = this.#layoutLookupBlocks.length > 0 ? this.#layoutLookupBlocks : this.#layoutState.blocks;
332111
+ const measures = this.#layoutLookupMeasures.length > 0 ? this.#layoutLookupMeasures : this.#layoutState.measures;
332112
+ if (blocks2.length === 0 || blocks2.length !== measures.length)
332113
+ return false;
332114
+ const resolvedLayout = resolveLayout({
332115
+ layout,
332116
+ flowMode: this.#layoutOptions.flowMode ?? "paginated",
332117
+ blocks: blocks2,
332118
+ measures
332119
+ });
332120
+ const isSemanticFlow = this.#layoutOptions.flowMode === "semantic";
332121
+ this.#ensurePainter();
332122
+ if (!isSemanticFlow)
332123
+ this.#painterAdapter.setProviders(this.#headerFooterSession?.headerDecorationProvider, this.#headerFooterSession?.footerDecorationProvider);
332124
+ this.#domIndexObserverManager?.pause();
332125
+ try {
332126
+ this.#painterAdapter.paint({ resolvedLayout }, this.#painterHost);
332127
+ this.#refreshEditorDomAugmentations();
332128
+ } finally {
332129
+ this.#domIndexObserverManager?.resume();
332130
+ }
332131
+ this.#revalidateScrollContainer();
332132
+ this.#updatePermissionOverlay();
332133
+ this.#applyZoom();
332134
+ return true;
332135
+ }
331689
332136
  hitTest(clientX, clientY) {
331690
332137
  const normalized = this.#normalizeClientPoint(clientX, clientY);
331691
332138
  if (!normalized)
@@ -333821,7 +334268,8 @@ function print() { __p += __j.call(arguments, '') }
333821
334268
  headerProvider: this.#headerFooterSession?.headerDecorationProvider,
333822
334269
  footerProvider: this.#headerFooterSession?.footerDecorationProvider,
333823
334270
  ruler: this.#layoutOptions.ruler,
333824
- pageGap: this.#layoutState.layout?.pageGap ?? effectiveGap
334271
+ pageGap: this.#layoutState.layout?.pageGap ?? effectiveGap,
334272
+ showFormattingMarks: this.#layoutOptions.showFormattingMarks ?? false
333825
334273
  });
333826
334274
  const currentZoom = this.#layoutOptions.zoom ?? 1;
333827
334275
  if (currentZoom !== 1)
@@ -336303,11 +336751,11 @@ function print() { __p += __j.call(arguments, '') }
336303
336751
  ];
336304
336752
  });
336305
336753
 
336306
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D34Mg4v-.es.js
336754
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-C-wMmL5m.es.js
336307
336755
  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;
336308
- var init_create_super_doc_ui_D34Mg4v_es = __esm(() => {
336756
+ var init_create_super_doc_ui_C_wMmL5m_es = __esm(() => {
336309
336757
  init_SuperConverter_ing_1fvK_es();
336310
- init_create_headless_toolbar_B_1fvPL0_es();
336758
+ init_create_headless_toolbar_CUl2z6Fd_es();
336311
336759
  MOD_ALIASES = new Set([
336312
336760
  "Mod",
336313
336761
  "Meta",
@@ -336349,16 +336797,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
336349
336797
 
336350
336798
  // ../../packages/superdoc/dist/super-editor.es.js
336351
336799
  var init_super_editor_es = __esm(() => {
336352
- init_src_DKka36_es();
336800
+ init_src_deKdT_sq_es();
336353
336801
  init_SuperConverter_ing_1fvK_es();
336354
336802
  init_jszip_C49i9kUs_es();
336355
336803
  init_xml_js_CqGKpaft_es();
336356
- init_create_headless_toolbar_B_1fvPL0_es();
336804
+ init_create_headless_toolbar_CUl2z6Fd_es();
336357
336805
  init_constants_DrU4EASo_es();
336358
336806
  init_dist_B8HfvhaK_es();
336359
336807
  init_unified_Dsuw2be5_es();
336360
336808
  init_DocxZipper_CUX64E5K_es();
336361
- init_create_super_doc_ui_D34Mg4v_es();
336809
+ init_create_super_doc_ui_C_wMmL5m_es();
336362
336810
  init_ui_CGB3qmy3_es();
336363
336811
  init_eventemitter3_UwU_CLPU_es();
336364
336812
  init_errors_C_DoKMoN_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.75",
3
+ "version": "0.8.0-next.77",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,21 +24,21 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/pm-adapter": "0.0.0",
27
+ "@superdoc/document-api": "0.0.1",
28
28
  "superdoc": "1.31.0",
29
29
  "@superdoc/super-editor": "0.0.1",
30
- "@superdoc/document-api": "0.0.1"
30
+ "@superdoc/pm-adapter": "0.0.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.75",
38
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.75",
39
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.75",
40
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.75",
41
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.75"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.77",
38
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.77",
39
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.77",
40
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.77",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.77"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",