@superdoc-dev/cli 0.5.0-next.78 → 0.5.0-next.79

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 +145 -3
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -204688,7 +204688,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
204688
204688
  init_remark_gfm_BhnWr3yf_es();
204689
204689
  });
204690
204690
 
204691
- // ../../packages/superdoc/dist/chunks/src-yBJbeHWu.es.js
204691
+ // ../../packages/superdoc/dist/chunks/src-CQtFp08c.es.js
204692
204692
  function deleteProps(obj, propOrProps) {
204693
204693
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
204694
204694
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -287746,7 +287746,7 @@ var Node$13 = class Node$14 {
287746
287746
  return;
287747
287747
  console.log(...args$1);
287748
287748
  }, 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;
287749
- var init_src_yBJbeHWu_es = __esm(() => {
287749
+ var init_src_CQtFp08c_es = __esm(() => {
287750
287750
  init_rolldown_runtime_Bg48TavK_es();
287751
287751
  init_SuperConverter_C87tnocN_es();
287752
287752
  init_jszip_C49i9kUs_es();
@@ -321681,6 +321681,148 @@ function print() { __p += __j.call(arguments, '') }
321681
321681
  static {
321682
321682
  this.ANCHOR_NAV_TIMEOUT_MS = 2000;
321683
321683
  }
321684
+ async scrollToElement(elementId) {
321685
+ if (!elementId)
321686
+ return false;
321687
+ if (await this.navigateTo({
321688
+ kind: "block",
321689
+ nodeId: elementId
321690
+ }))
321691
+ return true;
321692
+ if (await this.navigateTo({
321693
+ kind: "entity",
321694
+ entityType: "comment",
321695
+ entityId: elementId
321696
+ }))
321697
+ return true;
321698
+ if (await this.navigateTo({
321699
+ kind: "entity",
321700
+ entityType: "trackedChange",
321701
+ entityId: elementId
321702
+ }))
321703
+ return true;
321704
+ return false;
321705
+ }
321706
+ async navigateTo(target) {
321707
+ if (!target)
321708
+ return false;
321709
+ try {
321710
+ if (target.kind === "block")
321711
+ return await this.#navigateToBlock(target);
321712
+ if (target.kind === "entity") {
321713
+ if (target.entityType === "comment")
321714
+ return await this.#navigateToComment(target.entityId);
321715
+ if (target.entityType === "trackedChange")
321716
+ return await this.#navigateToTrackedChange(target.entityId);
321717
+ }
321718
+ return false;
321719
+ } catch (error3) {
321720
+ console.error("[PresentationEditor] navigateTo failed:", error3);
321721
+ this.emit("error", {
321722
+ error: error3,
321723
+ context: "navigateTo"
321724
+ });
321725
+ return false;
321726
+ }
321727
+ }
321728
+ async#navigateToBlock(target) {
321729
+ const editor = this.#editor;
321730
+ if (!editor)
321731
+ return false;
321732
+ const index2 = getBlockIndex(editor);
321733
+ let candidate;
321734
+ try {
321735
+ if (target.nodeType)
321736
+ candidate = findBlockById(index2, {
321737
+ kind: "block",
321738
+ nodeType: target.nodeType,
321739
+ nodeId: target.nodeId
321740
+ });
321741
+ else
321742
+ candidate = findBlockByNodeIdOnly(index2, target.nodeId);
321743
+ } catch {
321744
+ return false;
321745
+ }
321746
+ if (!candidate)
321747
+ return false;
321748
+ return this.#scrollToBlockCandidate(editor, candidate);
321749
+ }
321750
+ async#scrollToBlockCandidate(editor, candidate) {
321751
+ const blockNode = editor.state.doc.nodeAt(candidate.pos);
321752
+ let contentPos = candidate.pos + 1;
321753
+ if (blockNode)
321754
+ blockNode.forEach((child, offset$1) => {
321755
+ if (contentPos !== candidate.pos + 1)
321756
+ return;
321757
+ if (child.textContent.length > 0)
321758
+ contentPos = candidate.pos + 1 + offset$1 + (child.isText ? 0 : 1);
321759
+ });
321760
+ if (!await this.scrollToPositionAsync(contentPos, {
321761
+ behavior: "auto",
321762
+ block: "center"
321763
+ }))
321764
+ return false;
321765
+ editor.commands?.setTextSelection?.({
321766
+ from: contentPos,
321767
+ to: contentPos
321768
+ });
321769
+ editor.view?.focus?.();
321770
+ return true;
321771
+ }
321772
+ async#navigateToComment(entityId) {
321773
+ const editor = this.#editor;
321774
+ if (!editor)
321775
+ return false;
321776
+ const setCursorById = editor.commands?.setCursorById;
321777
+ if (typeof setCursorById !== "function")
321778
+ return false;
321779
+ if (!setCursorById(entityId, {
321780
+ preferredActiveThreadId: entityId,
321781
+ activeCommentId: entityId
321782
+ }))
321783
+ return false;
321784
+ await this.scrollToPositionAsync(editor.state.selection.from, {
321785
+ behavior: "auto",
321786
+ block: "center"
321787
+ });
321788
+ return true;
321789
+ }
321790
+ async#navigateToTrackedChange(entityId) {
321791
+ const editor = this.#editor;
321792
+ if (!editor)
321793
+ return false;
321794
+ const setCursorById = editor.commands?.setCursorById;
321795
+ if (typeof setCursorById === "function" && setCursorById(entityId, { preferredActiveThreadId: entityId })) {
321796
+ await this.scrollToPositionAsync(editor.state.selection.from, {
321797
+ behavior: "auto",
321798
+ block: "center"
321799
+ });
321800
+ return true;
321801
+ }
321802
+ const resolved = resolveTrackedChange(editor, entityId);
321803
+ if (!resolved)
321804
+ return false;
321805
+ if (typeof setCursorById === "function" && resolved.rawId !== entityId) {
321806
+ if (setCursorById(resolved.rawId, { preferredActiveThreadId: resolved.rawId })) {
321807
+ await this.scrollToPositionAsync(editor.state.selection.from, {
321808
+ behavior: "auto",
321809
+ block: "center"
321810
+ });
321811
+ return true;
321812
+ }
321813
+ }
321814
+ if (!await this.scrollToPositionAsync(resolved.from, {
321815
+ behavior: "auto",
321816
+ block: "center"
321817
+ }))
321818
+ return false;
321819
+ editor.commands?.setTextSelection?.({
321820
+ from: resolved.from,
321821
+ to: resolved.from
321822
+ });
321823
+ editor.view?.focus?.();
321824
+ return true;
321825
+ }
321684
321826
  async goToAnchor(anchor) {
321685
321827
  try {
321686
321828
  return await goToAnchor({
@@ -322331,7 +322473,7 @@ var init_zipper_DbkgrypV_es = __esm(() => {
322331
322473
 
322332
322474
  // ../../packages/superdoc/dist/super-editor.es.js
322333
322475
  var init_super_editor_es = __esm(() => {
322334
- init_src_yBJbeHWu_es();
322476
+ init_src_CQtFp08c_es();
322335
322477
  init_SuperConverter_C87tnocN_es();
322336
322478
  init_jszip_C49i9kUs_es();
322337
322479
  init_xml_js_CqGKpaft_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.5.0-next.78",
3
+ "version": "0.5.0-next.79",
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": "1.25.0",
27
+ "@superdoc/pm-adapter": "0.0.0",
28
28
  "@superdoc/document-api": "0.0.1",
29
29
  "@superdoc/super-editor": "0.0.1",
30
- "@superdoc/pm-adapter": "0.0.0"
30
+ "superdoc": "1.25.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.5.0-next.78",
38
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.78",
39
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.78",
40
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.78",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.78"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.79",
38
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.79",
39
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.79",
40
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.79",
41
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.79"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",