md-editor-v3 6.0.0-0 → 6.0.0-1

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.
@@ -2826,10 +2826,11 @@ const useCodeMirror = (props2) => {
2826
2826
  const catalogVisible = vue.inject("catalogVisible");
2827
2827
  const defToolbars = vue.inject("defToolbars");
2828
2828
  const floatingToolbars = vue.inject("floatingToolbars");
2829
+ const rootRef = vue.inject("rootRef");
2829
2830
  const inputWrapperRef = vue.ref();
2830
2831
  const codeMirrorUt = vue.shallowRef();
2831
2832
  const spelling = vue.ref(false);
2832
- const languageComp = new state.Compartment(), themeComp = new state.Compartment(), autocompletionComp = new state.Compartment(), historyComp = new state.Compartment(), eventComp = new state.Compartment();
2833
+ const languageComp = new state.Compartment(), themeComp = new state.Compartment(), autocompletionComp = new state.Compartment(), historyComp = new state.Compartment(), eventComp = new state.Compartment(), floatingToolbarComp = new state.Compartment();
2833
2834
  const mdEditorCommands = createCommands(editorId, {
2834
2835
  noPrettier
2835
2836
  });
@@ -2866,6 +2867,29 @@ const useCodeMirror = (props2) => {
2866
2867
  }
2867
2868
  }
2868
2869
  };
2870
+ const floatingToolbarPlugin = createFloatingToolbarPlugin({
2871
+ privide(app) {
2872
+ app.provide("editorId", editorId);
2873
+ app.provide("theme", theme);
2874
+ app.provide("previewTheme", previewTheme);
2875
+ app.provide("language", language2);
2876
+ app.provide("disabled", disabled);
2877
+ app.provide("noUploadImg", noUploadImg);
2878
+ app.provide("tableShape", tableShape);
2879
+ app.provide("noPrettier", noPrettier);
2880
+ app.provide("codeTheme", codeTheme);
2881
+ app.provide("showToolbarName", showToolbarName);
2882
+ app.provide("setting", setting);
2883
+ app.provide("updateSetting", updateSetting);
2884
+ app.provide("usedLanguageText", usedLanguageText);
2885
+ app.provide("catalogVisible", catalogVisible);
2886
+ app.provide("defToolbars", defToolbars);
2887
+ app.provide("tabWidth", tabWidth);
2888
+ app.provide("customIcon", customIcon);
2889
+ app.provide("floatingToolbars", floatingToolbars);
2890
+ app.provide("rootRef", rootRef);
2891
+ }
2892
+ });
2869
2893
  const defaultExtensions = [
2870
2894
  {
2871
2895
  type: "keymap",
@@ -2915,28 +2939,8 @@ const useCodeMirror = (props2) => {
2915
2939
  },
2916
2940
  {
2917
2941
  type: "floatingToolbar",
2918
- extension: createFloatingToolbarPlugin({
2919
- privide(app) {
2920
- app.provide("editorId", editorId);
2921
- app.provide("theme", theme);
2922
- app.provide("previewTheme", previewTheme);
2923
- app.provide("language", language2);
2924
- app.provide("disabled", disabled);
2925
- app.provide("noUploadImg", noUploadImg);
2926
- app.provide("tableShape", tableShape);
2927
- app.provide("noPrettier", noPrettier);
2928
- app.provide("codeTheme", codeTheme);
2929
- app.provide("showToolbarName", showToolbarName);
2930
- app.provide("setting", setting);
2931
- app.provide("updateSetting", updateSetting);
2932
- app.provide("usedLanguageText", usedLanguageText);
2933
- app.provide("catalogVisible", catalogVisible);
2934
- app.provide("defToolbars", defToolbars);
2935
- app.provide("tabWidth", tabWidth);
2936
- app.provide("customIcon", customIcon);
2937
- app.provide("floatingToolbars", floatingToolbars);
2938
- }
2939
- })
2942
+ extension: floatingToolbars.value.length > 0 ? floatingToolbarPlugin : [],
2943
+ compartment: floatingToolbarComp
2940
2944
  }
2941
2945
  ];
2942
2946
  const getExtensions = () => {
@@ -3123,6 +3127,15 @@ const useCodeMirror = (props2) => {
3123
3127
  }
3124
3128
  }
3125
3129
  );
3130
+ vue.watch([floatingToolbars], () => {
3131
+ var _a, _b;
3132
+ if (floatingToolbars.value.length > 0) {
3133
+ (_a = codeMirrorUt.value) == null ? void 0 : _a.view.dispatch({
3134
+ effects: floatingToolbarComp.reconfigure(floatingToolbarPlugin)
3135
+ });
3136
+ } else
3137
+ (_b = codeMirrorUt.value) == null ? void 0 : _b.view.dispatch({ effects: floatingToolbarComp.reconfigure([]) });
3138
+ });
3126
3139
  return {
3127
3140
  inputWrapperRef,
3128
3141
  codeMirrorUt,
@@ -2825,10 +2825,11 @@ const useCodeMirror = (props2) => {
2825
2825
  const catalogVisible = inject("catalogVisible");
2826
2826
  const defToolbars = inject("defToolbars");
2827
2827
  const floatingToolbars = inject("floatingToolbars");
2828
+ const rootRef = inject("rootRef");
2828
2829
  const inputWrapperRef = ref();
2829
2830
  const codeMirrorUt = shallowRef();
2830
2831
  const spelling = ref(false);
2831
- const languageComp = new Compartment(), themeComp = new Compartment(), autocompletionComp = new Compartment(), historyComp = new Compartment(), eventComp = new Compartment();
2832
+ const languageComp = new Compartment(), themeComp = new Compartment(), autocompletionComp = new Compartment(), historyComp = new Compartment(), eventComp = new Compartment(), floatingToolbarComp = new Compartment();
2832
2833
  const mdEditorCommands = createCommands(editorId, {
2833
2834
  noPrettier
2834
2835
  });
@@ -2865,6 +2866,29 @@ const useCodeMirror = (props2) => {
2865
2866
  }
2866
2867
  }
2867
2868
  };
2869
+ const floatingToolbarPlugin = createFloatingToolbarPlugin({
2870
+ privide(app) {
2871
+ app.provide("editorId", editorId);
2872
+ app.provide("theme", theme);
2873
+ app.provide("previewTheme", previewTheme);
2874
+ app.provide("language", language);
2875
+ app.provide("disabled", disabled);
2876
+ app.provide("noUploadImg", noUploadImg);
2877
+ app.provide("tableShape", tableShape);
2878
+ app.provide("noPrettier", noPrettier);
2879
+ app.provide("codeTheme", codeTheme);
2880
+ app.provide("showToolbarName", showToolbarName);
2881
+ app.provide("setting", setting);
2882
+ app.provide("updateSetting", updateSetting);
2883
+ app.provide("usedLanguageText", usedLanguageText);
2884
+ app.provide("catalogVisible", catalogVisible);
2885
+ app.provide("defToolbars", defToolbars);
2886
+ app.provide("tabWidth", tabWidth);
2887
+ app.provide("customIcon", customIcon);
2888
+ app.provide("floatingToolbars", floatingToolbars);
2889
+ app.provide("rootRef", rootRef);
2890
+ }
2891
+ });
2868
2892
  const defaultExtensions = [
2869
2893
  {
2870
2894
  type: "keymap",
@@ -2914,28 +2938,8 @@ const useCodeMirror = (props2) => {
2914
2938
  },
2915
2939
  {
2916
2940
  type: "floatingToolbar",
2917
- extension: createFloatingToolbarPlugin({
2918
- privide(app) {
2919
- app.provide("editorId", editorId);
2920
- app.provide("theme", theme);
2921
- app.provide("previewTheme", previewTheme);
2922
- app.provide("language", language);
2923
- app.provide("disabled", disabled);
2924
- app.provide("noUploadImg", noUploadImg);
2925
- app.provide("tableShape", tableShape);
2926
- app.provide("noPrettier", noPrettier);
2927
- app.provide("codeTheme", codeTheme);
2928
- app.provide("showToolbarName", showToolbarName);
2929
- app.provide("setting", setting);
2930
- app.provide("updateSetting", updateSetting);
2931
- app.provide("usedLanguageText", usedLanguageText);
2932
- app.provide("catalogVisible", catalogVisible);
2933
- app.provide("defToolbars", defToolbars);
2934
- app.provide("tabWidth", tabWidth);
2935
- app.provide("customIcon", customIcon);
2936
- app.provide("floatingToolbars", floatingToolbars);
2937
- }
2938
- })
2941
+ extension: floatingToolbars.value.length > 0 ? floatingToolbarPlugin : [],
2942
+ compartment: floatingToolbarComp
2939
2943
  }
2940
2944
  ];
2941
2945
  const getExtensions = () => {
@@ -3122,6 +3126,15 @@ const useCodeMirror = (props2) => {
3122
3126
  }
3123
3127
  }
3124
3128
  );
3129
+ watch([floatingToolbars], () => {
3130
+ var _a, _b;
3131
+ if (floatingToolbars.value.length > 0) {
3132
+ (_a = codeMirrorUt.value) == null ? void 0 : _a.view.dispatch({
3133
+ effects: floatingToolbarComp.reconfigure(floatingToolbarPlugin)
3134
+ });
3135
+ } else
3136
+ (_b = codeMirrorUt.value) == null ? void 0 : _b.view.dispatch({ effects: floatingToolbarComp.reconfigure([]) });
3137
+ });
3125
3138
  return {
3126
3139
  inputWrapperRef,
3127
3140
  codeMirrorUt,