@superdoc-dev/cli 0.3.0-next.4 → 0.3.0-next.6

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 +45 -6
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -131315,7 +131315,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
131315
131315
  init_remark_gfm_z_sDF4ss_es();
131316
131316
  });
131317
131317
 
131318
- // ../../packages/superdoc/dist/chunks/src-CcGVOrgc.es.js
131318
+ // ../../packages/superdoc/dist/chunks/src-CIT7og3M.es.js
131319
131319
  function deleteProps(obj, propOrProps) {
131320
131320
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
131321
131321
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -189822,6 +189822,13 @@ function scrollToElement(targetElement, options = {
189822
189822
  behavior: options.behavior
189823
189823
  });
189824
189824
  }
189825
+ function getParagraphFontFamilyFromProperties(paragraphProps, convertedXml = {}) {
189826
+ const fontFamilyProps = paragraphProps?.runProperties?.fontFamily;
189827
+ if (!fontFamilyProps)
189828
+ return null;
189829
+ const [markDef] = encodeMarksFromRPr({ fontFamily: fontFamilyProps }, convertedXml);
189830
+ return markDef?.attrs?.fontFamily ?? null;
189831
+ }
189825
189832
  var Node$13 = class Node$14 {
189826
189833
  constructor(config2) {
189827
189834
  this.type = "node";
@@ -217740,7 +217747,7 @@ var Node$13 = class Node$14 {
217740
217747
  return false;
217741
217748
  return Boolean(checker(attrs));
217742
217749
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
217743
- var init_src_CcGVOrgc_es = __esm(() => {
217750
+ var init_src_CIT7og3M_es = __esm(() => {
217744
217751
  init_rolldown_runtime_B2q5OVn9_es();
217745
217752
  init_SuperConverter_C2Sw7Q5Z_es();
217746
217753
  init_jszip_ChlR43oI_es();
@@ -236794,6 +236801,7 @@ function print() { __p += __j.call(arguments, '') }
236794
236801
  #errorBannerMessage = null;
236795
236802
  #renderScheduled = false;
236796
236803
  #pendingDocChange = false;
236804
+ #focusScrollRafId = null;
236797
236805
  #pendingMapping = null;
236798
236806
  #isRerendering = false;
236799
236807
  #selectionSync = new SelectionSyncCoordinator;
@@ -237117,6 +237125,13 @@ function print() { __p += __j.call(arguments, '') }
237117
237125
  }
237118
237126
  if (win.scrollX !== beforeX || win.scrollY !== beforeY)
237119
237127
  win.scrollTo(beforeX, beforeY);
237128
+ if (this.#focusScrollRafId != null)
237129
+ win.cancelAnimationFrame(this.#focusScrollRafId);
237130
+ this.#focusScrollRafId = win.requestAnimationFrame(() => {
237131
+ this.#focusScrollRafId = null;
237132
+ if (win.scrollX !== beforeX || win.scrollY !== beforeY)
237133
+ win.scrollTo(beforeX, beforeY);
237134
+ });
237120
237135
  };
237121
237136
  }
237122
237137
  get editor() {
@@ -237795,6 +237810,12 @@ function print() { __p += __j.call(arguments, '') }
237795
237810
  return null;
237796
237811
  }
237797
237812
  scrollToPosition(pos, options = {}) {
237813
+ if (this.#focusScrollRafId != null) {
237814
+ const win = this.#visibleHost.ownerDocument?.defaultView;
237815
+ if (win)
237816
+ win.cancelAnimationFrame(this.#focusScrollRafId);
237817
+ this.#focusScrollRafId = null;
237818
+ }
237798
237819
  const doc$2 = this.getActiveEditor()?.state?.doc;
237799
237820
  if (!doc$2)
237800
237821
  return false;
@@ -238012,6 +238033,11 @@ function print() { __p += __j.call(arguments, '') }
238012
238033
  (this.#visibleHost?.ownerDocument?.defaultView ?? window).cancelAnimationFrame(this.#rafHandle);
238013
238034
  this.#rafHandle = null;
238014
238035
  }, "Layout RAF");
238036
+ if (this.#focusScrollRafId != null)
238037
+ safeCleanup(() => {
238038
+ (this.#visibleHost?.ownerDocument?.defaultView ?? window).cancelAnimationFrame(this.#focusScrollRafId);
238039
+ this.#focusScrollRafId = null;
238040
+ }, "Focus scroll RAF");
238015
238041
  if (this.#decorationSyncRafHandle != null)
238016
238042
  safeCleanup(() => {
238017
238043
  (this.#visibleHost?.ownerDocument?.defaultView ?? window).cancelAnimationFrame(this.#decorationSyncRafHandle);
@@ -250784,13 +250810,19 @@ function print() { __p += __j.call(arguments, '') }
250784
250810
  const restoreSelection$1 = () => {
250785
250811
  proxy.$toolbar.activeEditor?.commands?.restoreSelection();
250786
250812
  };
250813
+ const handleToolbarMousedown = (e) => {
250814
+ if (e.target.closest('input, textarea, [contenteditable="true"]'))
250815
+ return;
250816
+ e.preventDefault();
250817
+ };
250787
250818
  return (_ctx, _cache) => {
250788
250819
  return openBlock(), createElementBlock("div", {
250789
250820
  class: "superdoc-toolbar",
250790
250821
  key: unref(toolbarKey),
250791
250822
  role: "toolbar",
250792
250823
  "aria-label": "Toolbar",
250793
- "data-editor-ui-surface": ""
250824
+ "data-editor-ui-surface": "",
250825
+ onMousedown: handleToolbarMousedown
250794
250826
  }, [
250795
250827
  unref(showLeftSide) ? (openBlock(), createBlock(ButtonGroup_default, {
250796
250828
  key: 0,
@@ -250825,10 +250857,10 @@ function print() { __p += __j.call(arguments, '') }
250825
250857
  onItemClicked: restoreSelection$1,
250826
250858
  class: "superdoc-toolbar-group-side"
250827
250859
  }, null, 8, ["toolbar-items", "ui-font-family"])) : createCommentVNode("", true)
250828
- ]);
250860
+ ], 32);
250829
250861
  };
250830
250862
  }
250831
- }, [["__scopeId", "data-v-6f41d6bf"]]);
250863
+ }, [["__scopeId", "data-v-e0242a18"]]);
250832
250864
  toolbarTexts = {
250833
250865
  bold: "Bold",
250834
250866
  fontFamily: "Font",
@@ -251352,8 +251384,12 @@ function print() { __p += __j.call(arguments, '') }
251352
251384
  const inTable = isInTable(this.activeEditor.state);
251353
251385
  const paragraphParent = findParentNode((n) => n.type.name === "paragraph")(selection);
251354
251386
  const paragraphProps = paragraphParent ? calculateResolvedParagraphProperties(this.activeEditor, paragraphParent.node, state.doc.resolve(paragraphParent.pos)) : null;
251387
+ const selectionIsCollapsed = selection.empty;
251388
+ const paragraphIsEmpty = paragraphParent?.node?.content?.size === 0;
251389
+ const paragraphFontFamily = getParagraphFontFamilyFromProperties(paragraphProps, this.activeEditor?.converter?.convertedXml ?? {});
251355
251390
  this.toolbarItems.forEach((item) => {
251356
251391
  item.resetDisabled();
251392
+ let activatedFromLinkedStyle = false;
251357
251393
  if (item.name.value === "undo")
251358
251394
  item.setDisabled(this.undoDepth === 0);
251359
251395
  if (item.name.value === "redo")
@@ -251390,10 +251426,13 @@ function print() { __p += __j.call(arguments, '') }
251390
251426
  const linkedStylesItem = linkedStyles.definition.styles[markToStyleMap[item.name.value]];
251391
251427
  const value = { [item.name.value]: linkedStylesItem };
251392
251428
  item.activate(value);
251429
+ activatedFromLinkedStyle = true;
251393
251430
  }
251394
251431
  }
251395
251432
  if (item.name.value === "textAlign" && paragraphProps?.justification)
251396
251433
  item.activate({ textAlign: paragraphProps.justification });
251434
+ if (item.name.value === "fontFamily" && selectionIsCollapsed && paragraphIsEmpty && !activeMark && !markNegated && !activatedFromLinkedStyle && paragraphFontFamily)
251435
+ item.activate({ fontFamily: paragraphFontFamily });
251397
251436
  if (item.name.value === "lineHeight")
251398
251437
  if (paragraphProps?.spacing)
251399
251438
  item.selectedValue.value = twipsToLines(paragraphProps.spacing.line);
@@ -251836,7 +251875,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
251836
251875
 
251837
251876
  // ../../packages/superdoc/dist/super-editor.es.js
251838
251877
  var init_super_editor_es = __esm(() => {
251839
- init_src_CcGVOrgc_es();
251878
+ init_src_CIT7og3M_es();
251840
251879
  init_SuperConverter_C2Sw7Q5Z_es();
251841
251880
  init_jszip_ChlR43oI_es();
251842
251881
  init_xml_js_BtmJ6bNs_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.4",
3
+ "version": "0.3.0-next.6",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,20 +21,20 @@
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",
26
- "superdoc": "1.19.0"
25
+ "superdoc": "1.19.0",
26
+ "@superdoc/super-editor": "0.0.1"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.4",
34
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.4",
35
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.4",
36
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.4",
37
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.4"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.6",
34
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.6",
35
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.6",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.6",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.6"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",