@superdoc-dev/cli 0.2.0-next.126 → 0.2.0-next.128

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 +32 -7
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -135072,7 +135072,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
135072
135072
  init_remark_gfm_z_sDF4ss_es();
135073
135073
  });
135074
135074
 
135075
- // ../../packages/superdoc/dist/chunks/src-CfMc8y28.es.js
135075
+ // ../../packages/superdoc/dist/chunks/src-CBmd-TxZ.es.js
135076
135076
  function deleteProps(obj, propOrProps) {
135077
135077
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
135078
135078
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -184850,7 +184850,7 @@ function computeAnchorMap(bookmarks, layout, blocks2) {
184850
184850
  });
184851
184851
  return anchorMap;
184852
184852
  }
184853
- async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
184853
+ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollContainer, zoom, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
184854
184854
  if (!anchor)
184855
184855
  return false;
184856
184856
  if (!layout)
@@ -184862,9 +184862,11 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
184862
184862
  if (pmPos == null)
184863
184863
  return false;
184864
184864
  let pageIndex = (selectionToRects(layout, blocks2, measures, pmPos, pmPos + 1, pageGeometryHelper) ?? [])[0]?.pageIndex ?? null;
184865
+ let fragmentY = null;
184865
184866
  if (pageIndex == null) {
184866
184867
  let nextFragmentPage = null;
184867
184868
  let nextFragmentStart = null;
184869
+ let nextFragmentY = null;
184868
184870
  for (const page of layout.pages) {
184869
184871
  for (const fragment2 of page.fragments) {
184870
184872
  if (fragment2.kind !== "para")
@@ -184875,25 +184877,46 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
184875
184877
  continue;
184876
184878
  if (pmPos >= fragStart && pmPos < fragEnd) {
184877
184879
  pageIndex = page.number - 1;
184880
+ fragmentY = fragment2.y;
184878
184881
  break;
184879
184882
  }
184880
184883
  if (fragStart > pmPos && (nextFragmentStart === null || fragStart < nextFragmentStart)) {
184881
184884
  nextFragmentPage = page.number - 1;
184882
184885
  nextFragmentStart = fragStart;
184886
+ nextFragmentY = fragment2.y;
184883
184887
  }
184884
184888
  }
184885
184889
  if (pageIndex != null)
184886
184890
  break;
184887
184891
  }
184888
- if (pageIndex == null && nextFragmentPage != null)
184892
+ if (pageIndex == null && nextFragmentPage != null) {
184889
184893
  pageIndex = nextFragmentPage;
184894
+ fragmentY = nextFragmentY;
184895
+ }
184890
184896
  }
184891
184897
  if (pageIndex == null)
184892
184898
  return false;
184893
184899
  scrollPageIntoView(pageIndex);
184894
184900
  await waitForPageMount(pageIndex, timeoutMs);
184895
184901
  const pageEl = getPageElementByIndex(painterHost, pageIndex);
184896
- if (pageEl)
184902
+ if (pageEl && fragmentY != null) {
184903
+ const scaledY = fragmentY * zoom;
184904
+ if (scrollContainer instanceof Element) {
184905
+ const pageRect = pageEl.getBoundingClientRect();
184906
+ const containerRect = scrollContainer.getBoundingClientRect();
184907
+ const targetY = pageRect.top - containerRect.top + scrollContainer.scrollTop + scaledY;
184908
+ scrollContainer.scrollTo({
184909
+ top: targetY,
184910
+ behavior: "instant"
184911
+ });
184912
+ } else {
184913
+ const targetY = pageEl.getBoundingClientRect().top + scrollContainer.scrollY + scaledY;
184914
+ scrollContainer.scrollTo({
184915
+ top: targetY,
184916
+ behavior: "instant"
184917
+ });
184918
+ }
184919
+ } else if (pageEl)
184897
184920
  pageEl.scrollIntoView({
184898
184921
  behavior: "instant",
184899
184922
  block: "start"
@@ -217815,7 +217838,7 @@ var Node$13 = class Node$14 {
217815
217838
  return false;
217816
217839
  return Boolean(checker(attrs));
217817
217840
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
217818
- var init_src_CfMc8y28_es = __esm(() => {
217841
+ var init_src_CBmd_TxZ_es = __esm(() => {
217819
217842
  init_rolldown_runtime_B2q5OVn9_es();
217820
217843
  init_SuperConverter_Cw5CEerM_es();
217821
217844
  init_jszip_ChlR43oI_es();
@@ -234557,7 +234580,7 @@ function print() { __p += __j.call(arguments, '') }
234557
234580
  const commentAnnotations = textRun.comments;
234558
234581
  const hasAnyComment = !!commentAnnotations?.length;
234559
234582
  const commentHighlight = getCommentHighlight(textRun, this.activeCommentId);
234560
- if (commentHighlight.color && !textRun.highlight && hasAnyComment) {
234583
+ if (commentHighlight.color && hasAnyComment) {
234561
234584
  elem.style.backgroundColor = commentHighlight.color;
234562
234585
  if (commentHighlight.hasNestedComments && commentHighlight.baseColor) {
234563
234586
  const borderColor = `${commentHighlight.baseColor}99`;
@@ -239472,6 +239495,8 @@ function print() { __p += __j.call(arguments, '') }
239472
239495
  bookmarks: this.#layoutState.bookmarks,
239473
239496
  pageGeometryHelper: this.#pageGeometryHelper ?? undefined,
239474
239497
  painterHost: this.#painterHost,
239498
+ scrollContainer: this.#scrollContainer ?? this.#visibleHost,
239499
+ zoom: this.zoom,
239475
239500
  scrollPageIntoView: (pageIndex) => this.#scrollPageIntoView(pageIndex),
239476
239501
  waitForPageMount: (pageIndex, timeoutMs) => this.#waitForPageMount(pageIndex, { timeout: timeoutMs }),
239477
239502
  getActiveEditor: () => this.getActiveEditor(),
@@ -251421,7 +251446,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
251421
251446
 
251422
251447
  // ../../packages/superdoc/dist/super-editor.es.js
251423
251448
  var init_super_editor_es = __esm(() => {
251424
- init_src_CfMc8y28_es();
251449
+ init_src_CBmd_TxZ_es();
251425
251450
  init_SuperConverter_Cw5CEerM_es();
251426
251451
  init_jszip_ChlR43oI_es();
251427
251452
  init_xml_js_DLE8mr0n_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.126",
3
+ "version": "0.2.0-next.128",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,8 +21,8 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "@superdoc/super-editor": "0.0.1",
25
24
  "@superdoc/pm-adapter": "0.0.0",
25
+ "@superdoc/super-editor": "0.0.1",
26
26
  "superdoc": "1.18.0"
27
27
  },
28
28
  "module": "src/index.ts",
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.126",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.126",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.126",
36
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.126",
37
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.126"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.128",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.128",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.128",
36
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.128",
37
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.128"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",