@jvs-milkdown/crepe 1.2.34 → 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/esm/index.js CHANGED
@@ -5,7 +5,7 @@ import { languages } from '@codemirror/language-data';
5
5
  import { oneDark } from '@codemirror/theme-one-dark';
6
6
  import { createSlice } from '@jvs-milkdown/kit/ctx';
7
7
  import { $ctx, $nodeSchema, $view, $remark, $markAttr, $markSchema, $command, $prose, $useKeymap, getMarkdown, $inputRule } from '@jvs-milkdown/kit/utils';
8
- import { defineComponent, shallowRef, ref, computed, h, createApp, watchEffect, watch, onUnmounted, Fragment, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
8
+ import { defineComponent, shallowRef, ref, computed, h, createApp, watchEffect, watch, onUnmounted, Fragment as Fragment$1, reactive, onMounted, onBeforeUnmount, nextTick } from 'vue';
9
9
  import { Icon } from '@jvs-milkdown/kit/component';
10
10
  import { blockConfig, block, BlockProvider } from '@jvs-milkdown/kit/plugin/block';
11
11
  import { commandsCtx, editorViewCtx, schemaCtx, editorCtx, EditorStatus, rootCtx, parserCtx, editorViewOptionsCtx, Editor, defaultValueCtx } from '@jvs-milkdown/kit/core';
@@ -3898,7 +3898,7 @@ function getBlockKey(node) {
3898
3898
  }
3899
3899
  }
3900
3900
 
3901
- keepAlive(h, Fragment);
3901
+ keepAlive(h, Fragment$1);
3902
3902
  const BlockHandle = defineComponent({
3903
3903
  props: {
3904
3904
  onAdd: {
@@ -3946,7 +3946,7 @@ const BlockHandle = defineComponent({
3946
3946
  const addButton = ref();
3947
3947
  const menuButton = ref();
3948
3948
  return () => {
3949
- return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
3949
+ return /* @__PURE__ */ h(Fragment$1, null, /* @__PURE__ */ h(
3950
3950
  "div",
3951
3951
  {
3952
3952
  ref: addButton,
@@ -5509,7 +5509,7 @@ const activeIconMap = {
5509
5509
  [dividerIcon]: dividerIconActive
5510
5510
  // [highLineCodeIcon]: highLineCodeIconActive,
5511
5511
  };
5512
- keepAlive(h, Fragment);
5512
+ keepAlive(h, Fragment$1);
5513
5513
  const formatPainterStates = /* @__PURE__ */ new WeakMap();
5514
5514
  const formatPainterHandlers = /* @__PURE__ */ new WeakMap();
5515
5515
  const formatPainterIgnoreNext = /* @__PURE__ */ new WeakMap();
@@ -6862,7 +6862,7 @@ const Toolbar = defineComponent({
6862
6862
  if (groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0) {
6863
6863
  sectionIdx++;
6864
6864
  }
6865
- return /* @__PURE__ */ h(Fragment, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
6865
+ return /* @__PURE__ */ h(Fragment$1, { key: group.key }, items, groupIndex < nonHeadingGroups.length - 1 && group.items.length > 0 ? /* @__PURE__ */ h(
6866
6866
  "div",
6867
6867
  {
6868
6868
  class: "divider",
@@ -7067,7 +7067,7 @@ const Toolbar = defineComponent({
7067
7067
  () => setIndent(-1),
7068
7068
  currentAlignIndent.value.indent <= 0
7069
7069
  ),
7070
- canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
7070
+ canMerge.value || canSplit.value ? /* @__PURE__ */ h(Fragment$1, null, /* @__PURE__ */ h(
7071
7071
  "div",
7072
7072
  {
7073
7073
  style: {
@@ -8634,241 +8634,214 @@ const FixedToolbarComponent = defineComponent({
8634
8634
  const isFull = computed(() => maxWidth.value === "none");
8635
8635
  if (!viewState.fixedToolbarVisible) {
8636
8636
  return /* @__PURE__ */ h(
8637
- "div",
8637
+ "button",
8638
8638
  {
8639
+ type: "button",
8640
+ class: "fixed-toolbar-expand-btn",
8641
+ title: "\u5C55\u5F00\u5DE5\u5177\u680F",
8642
+ onClick: (e) => {
8643
+ e.preventDefault();
8644
+ e.stopPropagation();
8645
+ viewState.fixedToolbarVisible = true;
8646
+ },
8639
8647
  style: {
8640
- position: "relative",
8641
- width: "100%",
8642
- height: "100%",
8648
+ position: "absolute",
8649
+ top: "0",
8650
+ right: "40px",
8643
8651
  display: "flex",
8644
8652
  alignItems: "center",
8645
- justifyContent: "center"
8653
+ justifyContent: "center",
8654
+ width: "28px",
8655
+ height: "24px",
8656
+ border: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))",
8657
+ borderTop: "none",
8658
+ background: "var(--crepe-color-surface, #ffffff)",
8659
+ cursor: "pointer",
8660
+ borderRadius: "0 0 6px 6px",
8661
+ boxShadow: "0 4px 8px rgba(0, 0, 0, 0.06)",
8662
+ color: "var(--crepe-color-on-surface, #363b4c)",
8663
+ pointerEvents: "auto",
8664
+ zIndex: 200
8646
8665
  }
8647
8666
  },
8667
+ /* @__PURE__ */ h(
8668
+ "span",
8669
+ {
8670
+ style: { display: "inline-flex", alignItems: "center" },
8671
+ innerHTML: chevronDownIcon
8672
+ }
8673
+ )
8674
+ );
8675
+ }
8676
+ return /* @__PURE__ */ h(Fragment, null, /* @__PURE__ */ h(
8677
+ "div",
8678
+ {
8679
+ style: {
8680
+ position: "relative",
8681
+ display: "flex",
8682
+ alignItems: "center",
8683
+ justifyContent: "flex-start",
8684
+ width: "100%",
8685
+ maxWidth: isFull.value ? "100%" : maxWidth.value,
8686
+ margin: isFull.value ? "0" : "0 auto",
8687
+ padding: "0px 10px",
8688
+ gap: "0px",
8689
+ minWidth: "0",
8690
+ overflow: "hidden"
8691
+ }
8692
+ },
8693
+ ((_d = props.config) == null ? void 0 : _d.showMenuBar) !== false && [
8694
+ /* @__PURE__ */ h(MenuBar, { ctx: props.ctx, config: props.config }),
8695
+ /* @__PURE__ */ h(
8696
+ "div",
8697
+ {
8698
+ style: {
8699
+ width: "1px",
8700
+ minWidth: "1px",
8701
+ height: "20px",
8702
+ backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8703
+ }
8704
+ }
8705
+ )
8706
+ ],
8707
+ ((_e = props.config) == null ? void 0 : _e.showHistory) !== false && [
8648
8708
  /* @__PURE__ */ h(
8649
8709
  "button",
8650
8710
  {
8651
8711
  type: "button",
8652
- class: "fixed-toolbar-expand-btn",
8653
- title: "\u5C55\u5F00\u5DE5\u5177\u680F",
8712
+ class: ["toolbar-item", !canUndo && "disabled"],
8713
+ disabled: !canUndo,
8714
+ title: "\u64A4\u9500",
8715
+ onPointerdown: (e) => {
8716
+ e.preventDefault();
8717
+ e.stopPropagation();
8718
+ },
8654
8719
  onClick: (e) => {
8655
8720
  e.preventDefault();
8656
8721
  e.stopPropagation();
8657
- viewState.fixedToolbarVisible = true;
8722
+ if (canUndo) {
8723
+ props.ctx.get(commandsCtx).call("Undo");
8724
+ }
8658
8725
  },
8659
8726
  style: {
8660
- position: "absolute",
8661
- top: "0",
8662
- right: "40px",
8663
8727
  display: "flex",
8664
8728
  alignItems: "center",
8665
8729
  justifyContent: "center",
8666
- width: "28px",
8667
- height: "24px",
8668
- border: "1px solid var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 85%))",
8669
- borderTop: "none",
8670
- background: "var(--crepe-color-surface, #ffffff)",
8671
- cursor: "pointer",
8672
- borderRadius: "0 0 6px 6px",
8673
- boxShadow: "0 4px 8px rgba(0, 0, 0, 0.06)",
8674
- color: "var(--crepe-color-on-surface, #363b4c)",
8675
- pointerEvents: "auto",
8676
- zIndex: 200
8730
+ border: "none",
8731
+ background: "transparent",
8732
+ cursor: canUndo ? "pointer" : "default",
8733
+ padding: "6px",
8734
+ borderRadius: "4px",
8735
+ color: canUndo ? "#363b4c" : "#c0c4cc",
8736
+ "--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
8677
8737
  }
8678
8738
  },
8679
8739
  /* @__PURE__ */ h(
8680
8740
  "span",
8681
8741
  {
8682
8742
  style: { display: "inline-flex", alignItems: "center" },
8683
- innerHTML: chevronDownIcon
8684
- }
8685
- )
8686
- )
8687
- );
8688
- }
8689
- return /* @__PURE__ */ h(
8690
- "div",
8691
- {
8692
- style: {
8693
- position: "relative",
8694
- width: "100%",
8695
- height: "100%",
8696
- display: "flex",
8697
- alignItems: "center",
8698
- justifyContent: "center"
8699
- }
8700
- },
8701
- /* @__PURE__ */ h(
8702
- "div",
8703
- {
8704
- style: {
8705
- position: "relative",
8706
- display: "flex",
8707
- alignItems: "center",
8708
- justifyContent: "flex-start",
8709
- width: "100%",
8710
- maxWidth: isFull.value ? "100%" : maxWidth.value,
8711
- margin: isFull.value ? "0" : "0 auto",
8712
- padding: "0px 10px",
8713
- gap: "0px",
8714
- minWidth: "0",
8715
- overflow: "hidden"
8716
- }
8717
- },
8718
- ((_d = props.config) == null ? void 0 : _d.showMenuBar) !== false && [
8719
- /* @__PURE__ */ h(MenuBar, { ctx: props.ctx, config: props.config }),
8720
- /* @__PURE__ */ h(
8721
- "div",
8722
- {
8723
- style: {
8724
- width: "1px",
8725
- minWidth: "1px",
8726
- height: "20px",
8727
- backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8728
- }
8743
+ innerHTML: undoIcon
8729
8744
  }
8730
8745
  )
8731
- ],
8732
- ((_e = props.config) == null ? void 0 : _e.showHistory) !== false && [
8733
- /* @__PURE__ */ h(
8734
- "button",
8735
- {
8736
- type: "button",
8737
- class: ["toolbar-item", !canUndo && "disabled"],
8738
- disabled: !canUndo,
8739
- title: "\u64A4\u9500",
8740
- onPointerdown: (e) => {
8741
- e.preventDefault();
8742
- e.stopPropagation();
8743
- },
8744
- onClick: (e) => {
8745
- e.preventDefault();
8746
- e.stopPropagation();
8747
- if (canUndo) {
8748
- props.ctx.get(commandsCtx).call("Undo");
8749
- }
8750
- },
8751
- style: {
8752
- display: "flex",
8753
- alignItems: "center",
8754
- justifyContent: "center",
8755
- border: "none",
8756
- background: "transparent",
8757
- cursor: canUndo ? "pointer" : "default",
8758
- padding: "6px",
8759
- borderRadius: "4px",
8760
- color: canUndo ? "#363b4c" : "#c0c4cc",
8761
- "--toolbar-icon-color": canUndo ? "#363b4c" : "#c0c4cc"
8762
- }
8746
+ ),
8747
+ /* @__PURE__ */ h(
8748
+ "button",
8749
+ {
8750
+ type: "button",
8751
+ class: ["toolbar-item", !canRedo && "disabled"],
8752
+ disabled: !canRedo,
8753
+ title: "\u6062\u590D",
8754
+ onPointerdown: (e) => {
8755
+ e.preventDefault();
8756
+ e.stopPropagation();
8763
8757
  },
8764
- /* @__PURE__ */ h(
8765
- "span",
8766
- {
8767
- style: { display: "inline-flex", alignItems: "center" },
8768
- innerHTML: undoIcon
8769
- }
8770
- )
8771
- ),
8772
- /* @__PURE__ */ h(
8773
- "button",
8774
- {
8775
- type: "button",
8776
- class: ["toolbar-item", !canRedo && "disabled"],
8777
- disabled: !canRedo,
8778
- title: "\u6062\u590D",
8779
- onPointerdown: (e) => {
8780
- e.preventDefault();
8781
- e.stopPropagation();
8782
- },
8783
- onClick: (e) => {
8784
- e.preventDefault();
8785
- e.stopPropagation();
8786
- if (canRedo) {
8787
- props.ctx.get(commandsCtx).call("Redo");
8788
- }
8789
- },
8790
- style: {
8791
- display: "flex",
8792
- alignItems: "center",
8793
- justifyContent: "center",
8794
- border: "none",
8795
- background: "transparent",
8796
- cursor: canRedo ? "pointer" : "default",
8797
- padding: "6px",
8798
- borderRadius: "4px",
8799
- color: canRedo ? "#363b4c" : "#c0c4cc",
8800
- "--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
8758
+ onClick: (e) => {
8759
+ e.preventDefault();
8760
+ e.stopPropagation();
8761
+ if (canRedo) {
8762
+ props.ctx.get(commandsCtx).call("Redo");
8801
8763
  }
8802
8764
  },
8803
- /* @__PURE__ */ h(
8804
- "span",
8805
- {
8806
- style: { display: "inline-flex", alignItems: "center" },
8807
- innerHTML: redoIcon
8808
- }
8809
- )
8810
- ),
8765
+ style: {
8766
+ display: "flex",
8767
+ alignItems: "center",
8768
+ justifyContent: "center",
8769
+ border: "none",
8770
+ background: "transparent",
8771
+ cursor: canRedo ? "pointer" : "default",
8772
+ padding: "6px",
8773
+ borderRadius: "4px",
8774
+ color: canRedo ? "#363b4c" : "#c0c4cc",
8775
+ "--toolbar-icon-color": canRedo ? "#363b4c" : "#c0c4cc"
8776
+ }
8777
+ },
8811
8778
  /* @__PURE__ */ h(
8812
- "div",
8779
+ "span",
8813
8780
  {
8814
- style: {
8815
- width: "1px",
8816
- minWidth: "1px",
8817
- height: "20px",
8818
- backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8819
- }
8781
+ style: { display: "inline-flex", alignItems: "center" },
8782
+ innerHTML: redoIcon
8820
8783
  }
8821
8784
  )
8822
- ],
8785
+ ),
8823
8786
  /* @__PURE__ */ h(
8824
- Toolbar,
8787
+ "div",
8825
8788
  {
8826
- ctx: props.ctx,
8827
- hide: props.hide,
8828
- show: props.show,
8829
- state: props.state,
8830
- config: props.config,
8831
- isFixed: true
8789
+ style: {
8790
+ width: "1px",
8791
+ minWidth: "1px",
8792
+ height: "20px",
8793
+ backgroundColor: "var(--crepe-color-outline-variant, color-mix(in srgb, var(--crepe-color-outline), transparent 80%))"
8794
+ }
8832
8795
  }
8833
- ),
8834
- showShortcuts.value && /* @__PURE__ */ h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8796
+ )
8797
+ ],
8798
+ /* @__PURE__ */ h(
8799
+ Toolbar,
8800
+ {
8801
+ ctx: props.ctx,
8802
+ hide: props.hide,
8803
+ show: props.show,
8804
+ state: props.state,
8805
+ config: props.config,
8806
+ isFixed: true
8807
+ }
8835
8808
  ),
8809
+ showShortcuts.value && /* @__PURE__ */ h(ShortcutHelpModal, { ctx: props.ctx, visible: showShortcuts })
8810
+ ), /* @__PURE__ */ h(
8811
+ "button",
8812
+ {
8813
+ type: "button",
8814
+ class: "toolbar-item collapse-btn",
8815
+ title: "\u6298\u53E0\u5DE5\u5177\u680F",
8816
+ onClick: (e) => {
8817
+ e.preventDefault();
8818
+ e.stopPropagation();
8819
+ viewState.fixedToolbarVisible = false;
8820
+ },
8821
+ style: {
8822
+ position: "absolute",
8823
+ top: "6px",
8824
+ right: "40px",
8825
+ margin: "0",
8826
+ display: "flex",
8827
+ alignItems: "center",
8828
+ justifyContent: "center",
8829
+ pointerEvents: "auto",
8830
+ zIndex: 200
8831
+ }
8832
+ },
8836
8833
  /* @__PURE__ */ h(
8837
- "button",
8834
+ "span",
8838
8835
  {
8839
- type: "button",
8840
- class: "toolbar-item collapse-btn",
8841
- title: "\u6298\u53E0\u5DE5\u5177\u680F",
8842
- onClick: (e) => {
8843
- e.preventDefault();
8844
- e.stopPropagation();
8845
- viewState.fixedToolbarVisible = false;
8846
- },
8847
8836
  style: {
8848
- position: "absolute",
8849
- top: "6px",
8850
- right: "40px",
8851
- margin: "0",
8852
- display: "flex",
8837
+ display: "inline-flex",
8853
8838
  alignItems: "center",
8854
- justifyContent: "center",
8855
- pointerEvents: "auto",
8856
- zIndex: 200
8857
- }
8858
- },
8859
- /* @__PURE__ */ h(
8860
- "span",
8861
- {
8862
- style: {
8863
- display: "inline-flex",
8864
- alignItems: "center",
8865
- transform: "rotate(180deg)"
8866
- },
8867
- innerHTML: chevronDownIcon
8868
- }
8869
- )
8839
+ transform: "rotate(180deg)"
8840
+ },
8841
+ innerHTML: chevronDownIcon
8842
+ }
8870
8843
  )
8871
- );
8844
+ ));
8872
8845
  };
8873
8846
  }
8874
8847
  });