@jvs-milkdown/crepe 1.2.33 → 1.2.35

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.
package/lib/cjs/index.js CHANGED
@@ -5856,8 +5856,7 @@ const Toolbar = vue.defineComponent({
5856
5856
  siblingsWidth += s.offsetWidth;
5857
5857
  }
5858
5858
  }
5859
- const gapCount = Math.max(0, siblings.length);
5860
- containerWidth = parent.clientWidth - siblingsWidth - gapCount * 12;
5859
+ containerWidth = parent.clientWidth - siblingsWidth - 12;
5861
5860
  } else {
5862
5861
  containerWidth = container.clientWidth;
5863
5862
  }
@@ -8656,241 +8655,214 @@ const FixedToolbarComponent = vue.defineComponent({
8656
8655
  const isFull = vue.computed(() => maxWidth.value === "none");
8657
8656
  if (!viewState.fixedToolbarVisible) {
8658
8657
  return /* @__PURE__ */ vue.h(
8659
- "div",
8658
+ "button",
8660
8659
  {
8660
+ type: "button",
8661
+ class: "fixed-toolbar-expand-btn",
8662
+ title: "\u5C55\u5F00\u5DE5\u5177\u680F",
8663
+ onClick: (e) => {
8664
+ e.preventDefault();
8665
+ e.stopPropagation();
8666
+ viewState.fixedToolbarVisible = true;
8667
+ },
8661
8668
  style: {
8662
- position: "relative",
8663
- width: "100%",
8664
- height: "100%",
8669
+ position: "absolute",
8670
+ top: "0",
8671
+ right: "40px",
8665
8672
  display: "flex",
8666
8673
  alignItems: "center",
8667
- justifyContent: "center"
8674
+ justifyContent: "center",
8675
+ width: "28px",
8676
+ height: "24px",
8677
+ border: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))",
8678
+ borderTop: "none",
8679
+ background: "var(--crepe-color-surface, #ffffff)",
8680
+ cursor: "pointer",
8681
+ borderRadius: "0 0 6px 6px",
8682
+ boxShadow: "0 4px 8px rgba(0, 0, 0, 0.06)",
8683
+ color: "var(--crepe-color-on-surface, #363b4c)",
8684
+ pointerEvents: "auto",
8685
+ zIndex: 200
8668
8686
  }
8669
8687
  },
8688
+ /* @__PURE__ */ vue.h(
8689
+ "span",
8690
+ {
8691
+ style: { display: "inline-flex", alignItems: "center" },
8692
+ innerHTML: chevronDownIcon
8693
+ }
8694
+ )
8695
+ );
8696
+ }
8697
+ return /* @__PURE__ */ vue.h(Fragment, null, /* @__PURE__ */ vue.h(
8698
+ "div",
8699
+ {
8700
+ style: {
8701
+ position: "relative",
8702
+ display: "flex",
8703
+ alignItems: "center",
8704
+ justifyContent: "flex-start",
8705
+ width: "100%",
8706
+ maxWidth: isFull.value ? "100%" : maxWidth.value,
8707
+ margin: isFull.value ? "0" : "0 auto",
8708
+ padding: "0px 10px",
8709
+ gap: "0px",
8710
+ minWidth: "0",
8711
+ overflow: "hidden"
8712
+ }
8713
+ },
8714
+ ((_d = props.config) == null ? void 0 : _d.showMenuBar) !== false && [
8715
+ /* @__PURE__ */ vue.h(MenuBar, { ctx: props.ctx, config: props.config }),
8716
+ /* @__PURE__ */ vue.h(
8717
+ "div",
8718
+ {
8719
+ style: {
8720
+ width: "1px",
8721
+ minWidth: "1px",
8722
+ height: "20px",
8723
+ backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8724
+ }
8725
+ }
8726
+ )
8727
+ ],
8728
+ ((_e = props.config) == null ? void 0 : _e.showHistory) !== false && [
8670
8729
  /* @__PURE__ */ vue.h(
8671
8730
  "button",
8672
8731
  {
8673
8732
  type: "button",
8674
- class: "fixed-toolbar-expand-btn",
8675
- title: "\u5C55\u5F00\u5DE5\u5177\u680F",
8733
+ class: ["toolbar-item", !canUndo && "disabled"],
8734
+ disabled: !canUndo,
8735
+ title: "\u64A4\u9500",
8736
+ onPointerdown: (e) => {
8737
+ e.preventDefault();
8738
+ e.stopPropagation();
8739
+ },
8676
8740
  onClick: (e) => {
8677
8741
  e.preventDefault();
8678
8742
  e.stopPropagation();
8679
- viewState.fixedToolbarVisible = true;
8743
+ if (canUndo) {
8744
+ props.ctx.get(core.commandsCtx).call("Undo");
8745
+ }
8680
8746
  },
8681
8747
  style: {
8682
- position: "absolute",
8683
- top: "0",
8684
- right: "40px",
8685
8748
  display: "flex",
8686
8749
  alignItems: "center",
8687
8750
  justifyContent: "center",
8688
- width: "28px",
8689
- height: "24px",
8690
- border: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))",
8691
- borderTop: "none",
8692
- background: "var(--crepe-color-surface, #ffffff)",
8693
- cursor: "pointer",
8694
- borderRadius: "0 0 6px 6px",
8695
- boxShadow: "0 4px 8px rgba(0, 0, 0, 0.06)",
8696
- color: "var(--crepe-color-on-surface, #363b4c)",
8697
- pointerEvents: "auto",
8698
- zIndex: 200
8751
+ border: "none",
8752
+ background: "transparent",
8753
+ cursor: canUndo ? "pointer" : "default",
8754
+ padding: "6px",
8755
+ borderRadius: "4px",
8756
+ color: canUndo ? "#363b4c" : "#c0c4cc",
8757
+ "--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
8699
8758
  }
8700
8759
  },
8701
8760
  /* @__PURE__ */ vue.h(
8702
8761
  "span",
8703
8762
  {
8704
8763
  style: { display: "inline-flex", alignItems: "center" },
8705
- innerHTML: chevronDownIcon
8764
+ innerHTML: undoIcon
8706
8765
  }
8707
8766
  )
8708
- )
8709
- );
8710
- }
8711
- return /* @__PURE__ */ vue.h(
8712
- "div",
8713
- {
8714
- style: {
8715
- position: "relative",
8716
- width: "100%",
8717
- height: "100%",
8718
- display: "flex",
8719
- alignItems: "center",
8720
- justifyContent: "center"
8721
- }
8722
- },
8723
- /* @__PURE__ */ vue.h(
8724
- "div",
8725
- {
8726
- style: {
8727
- position: "relative",
8728
- display: "flex",
8729
- alignItems: "center",
8730
- justifyContent: "flex-start",
8731
- width: "100%",
8732
- maxWidth: isFull.value ? "100%" : maxWidth.value,
8733
- margin: isFull.value ? "0" : "0 auto",
8734
- // paddingRight: '40px',
8735
- gap: "0px",
8736
- minWidth: "0",
8737
- overflow: "hidden"
8738
- }
8739
- },
8740
- ((_d = props.config) == null ? void 0 : _d.showMenuBar) !== false && [
8741
- /* @__PURE__ */ vue.h(MenuBar, { ctx: props.ctx, config: props.config }),
8742
- /* @__PURE__ */ vue.h(
8743
- "div",
8744
- {
8745
- style: {
8746
- width: "1px",
8747
- minWidth: "1px",
8748
- height: "20px",
8749
- backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8750
- }
8751
- }
8752
- )
8753
- ],
8754
- ((_e = props.config) == null ? void 0 : _e.showHistory) !== false && [
8755
- /* @__PURE__ */ vue.h(
8756
- "button",
8757
- {
8758
- type: "button",
8759
- class: ["toolbar-item", !canUndo && "disabled"],
8760
- disabled: !canUndo,
8761
- title: "\u64A4\u9500",
8762
- onPointerdown: (e) => {
8763
- e.preventDefault();
8764
- e.stopPropagation();
8765
- },
8766
- onClick: (e) => {
8767
- e.preventDefault();
8768
- e.stopPropagation();
8769
- if (canUndo) {
8770
- props.ctx.get(core.commandsCtx).call("Undo");
8771
- }
8772
- },
8773
- style: {
8774
- display: "flex",
8775
- alignItems: "center",
8776
- justifyContent: "center",
8777
- border: "none",
8778
- background: "transparent",
8779
- cursor: canUndo ? "pointer" : "default",
8780
- padding: "6px",
8781
- borderRadius: "4px",
8782
- color: canUndo ? "#363b4c" : "#c0c4cc",
8783
- "--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
8784
- }
8767
+ ),
8768
+ /* @__PURE__ */ vue.h(
8769
+ "button",
8770
+ {
8771
+ type: "button",
8772
+ class: ["toolbar-item", !canRedo && "disabled"],
8773
+ disabled: !canRedo,
8774
+ title: "\u6062\u590D",
8775
+ onPointerdown: (e) => {
8776
+ e.preventDefault();
8777
+ e.stopPropagation();
8785
8778
  },
8786
- /* @__PURE__ */ vue.h(
8787
- "span",
8788
- {
8789
- style: { display: "inline-flex", alignItems: "center" },
8790
- innerHTML: undoIcon
8791
- }
8792
- )
8793
- ),
8794
- /* @__PURE__ */ vue.h(
8795
- "button",
8796
- {
8797
- type: "button",
8798
- class: ["toolbar-item", !canRedo && "disabled"],
8799
- disabled: !canRedo,
8800
- title: "\u6062\u590D",
8801
- onPointerdown: (e) => {
8802
- e.preventDefault();
8803
- e.stopPropagation();
8804
- },
8805
- onClick: (e) => {
8806
- e.preventDefault();
8807
- e.stopPropagation();
8808
- if (canRedo) {
8809
- props.ctx.get(core.commandsCtx).call("Redo");
8810
- }
8811
- },
8812
- style: {
8813
- display: "flex",
8814
- alignItems: "center",
8815
- justifyContent: "center",
8816
- border: "none",
8817
- background: "transparent",
8818
- cursor: canRedo ? "pointer" : "default",
8819
- padding: "6px",
8820
- borderRadius: "4px",
8821
- color: canRedo ? "#363b4c" : "#c0c4cc",
8822
- "--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
8779
+ onClick: (e) => {
8780
+ e.preventDefault();
8781
+ e.stopPropagation();
8782
+ if (canRedo) {
8783
+ props.ctx.get(core.commandsCtx).call("Redo");
8823
8784
  }
8824
8785
  },
8825
- /* @__PURE__ */ vue.h(
8826
- "span",
8827
- {
8828
- style: { display: "inline-flex", alignItems: "center" },
8829
- innerHTML: redoIcon
8830
- }
8831
- )
8832
- ),
8786
+ style: {
8787
+ display: "flex",
8788
+ alignItems: "center",
8789
+ justifyContent: "center",
8790
+ border: "none",
8791
+ background: "transparent",
8792
+ cursor: canRedo ? "pointer" : "default",
8793
+ padding: "6px",
8794
+ borderRadius: "4px",
8795
+ color: canRedo ? "#363b4c" : "#c0c4cc",
8796
+ "--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
8797
+ }
8798
+ },
8833
8799
  /* @__PURE__ */ vue.h(
8834
- "div",
8800
+ "span",
8835
8801
  {
8836
- style: {
8837
- width: "1px",
8838
- minWidth: "1px",
8839
- height: "20px",
8840
- backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8841
- }
8802
+ style: { display: "inline-flex", alignItems: "center" },
8803
+ innerHTML: redoIcon
8842
8804
  }
8843
8805
  )
8844
- ],
8806
+ ),
8845
8807
  /* @__PURE__ */ vue.h(
8846
- Toolbar,
8808
+ "div",
8847
8809
  {
8848
- ctx: props.ctx,
8849
- hide: props.hide,
8850
- show: props.show,
8851
- state: props.state,
8852
- config: props.config,
8853
- isFixed: true
8810
+ style: {
8811
+ width: "1px",
8812
+ minWidth: "1px",
8813
+ height: "20px",
8814
+ backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8815
+ }
8854
8816
  }
8855
- ),
8856
- showShortcuts.value && /* @__PURE__ */ vue.h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8817
+ )
8818
+ ],
8819
+ /* @__PURE__ */ vue.h(
8820
+ Toolbar,
8821
+ {
8822
+ ctx: props.ctx,
8823
+ hide: props.hide,
8824
+ show: props.show,
8825
+ state: props.state,
8826
+ config: props.config,
8827
+ isFixed: true
8828
+ }
8857
8829
  ),
8830
+ showShortcuts.value && /* @__PURE__ */ vue.h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8831
+ ), /* @__PURE__ */ vue.h(
8832
+ "button",
8833
+ {
8834
+ type: "button",
8835
+ class: "toolbar-item collapse-btn",
8836
+ title: "\u6298\u53E0\u5DE5\u5177\u680F",
8837
+ onClick: (e) => {
8838
+ e.preventDefault();
8839
+ e.stopPropagation();
8840
+ viewState.fixedToolbarVisible = false;
8841
+ },
8842
+ style: {
8843
+ position: "absolute",
8844
+ top: "6px",
8845
+ right: "40px",
8846
+ margin: "0",
8847
+ display: "flex",
8848
+ alignItems: "center",
8849
+ justifyContent: "center",
8850
+ pointerEvents: "auto",
8851
+ zIndex: 200
8852
+ }
8853
+ },
8858
8854
  /* @__PURE__ */ vue.h(
8859
- "button",
8855
+ "span",
8860
8856
  {
8861
- type: "button",
8862
- class: "toolbar-item collapse-btn",
8863
- title: "\u6298\u53E0\u5DE5\u5177\u680F",
8864
- onClick: (e) => {
8865
- e.preventDefault();
8866
- e.stopPropagation();
8867
- viewState.fixedToolbarVisible = false;
8868
- },
8869
8857
  style: {
8870
- position: "absolute",
8871
- top: "6px",
8872
- right: "40px",
8873
- margin: "0",
8874
- display: "flex",
8858
+ display: "inline-flex",
8875
8859
  alignItems: "center",
8876
- justifyContent: "center",
8877
- pointerEvents: "auto",
8878
- zIndex: 200
8879
- }
8880
- },
8881
- /* @__PURE__ */ vue.h(
8882
- "span",
8883
- {
8884
- style: {
8885
- display: "inline-flex",
8886
- alignItems: "center",
8887
- transform: "rotate(180deg)"
8888
- },
8889
- innerHTML: chevronDownIcon
8890
- }
8891
- )
8860
+ transform: "rotate(180deg)"
8861
+ },
8862
+ innerHTML: chevronDownIcon
8863
+ }
8892
8864
  )
8893
- );
8865
+ ));
8894
8866
  };
8895
8867
  }
8896
8868
  });