md-editor-v3 5.0.2-0 → 5.0.2

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.
@@ -969,7 +969,6 @@ const useMarkdownIt = (props, previewOnly) => {
969
969
  });
970
970
  });
971
971
  };
972
- vue.onMounted(updatedTodo);
973
972
  const markHtml = () => {
974
973
  headsRef.value = [];
975
974
  html.value = props.sanitize(md.render(props.modelValue));
@@ -978,10 +977,15 @@ const useMarkdownIt = (props, previewOnly) => {
978
977
  const needReRender = vue.computed(() => {
979
978
  return (props.noKatex || katexRef.value) && (props.noHighlight || hljsRef.value);
980
979
  });
981
- vue.watch(
982
- [vue.toRef(props, "modelValue"), needReRender, reRenderRef, languageRef],
983
- util.debounce(markHtml, previewOnly ? 0 : editorConfig.renderDelay)
984
- );
980
+ let timer = -1;
981
+ vue.watch([vue.toRef(props, "modelValue"), needReRender, reRenderRef, languageRef], () => {
982
+ timer = window.setTimeout(
983
+ () => {
984
+ markHtml();
985
+ },
986
+ previewOnly ? 0 : editorConfig.renderDelay
987
+ );
988
+ });
985
989
  vue.watch(
986
990
  () => props.setting.preview,
987
991
  () => {
@@ -997,6 +1001,7 @@ const useMarkdownIt = (props, previewOnly) => {
997
1001
  }
998
1002
  }
999
1003
  );
1004
+ vue.onMounted(updatedTodo);
1000
1005
  vue.onMounted(() => {
1001
1006
  eventName.bus.on(editorId, {
1002
1007
  name: eventName.PUSH_CATALOG,
@@ -1012,6 +1017,9 @@ const useMarkdownIt = (props, previewOnly) => {
1012
1017
  }
1013
1018
  });
1014
1019
  });
1020
+ vue.onBeforeUnmount(() => {
1021
+ clearTimeout(timer);
1022
+ });
1015
1023
  return { html, key };
1016
1024
  };
1017
1025
  const template = {
@@ -968,7 +968,6 @@ const useMarkdownIt = (props, previewOnly) => {
968
968
  });
969
969
  });
970
970
  };
971
- onMounted(updatedTodo);
972
971
  const markHtml = () => {
973
972
  headsRef.value = [];
974
973
  html.value = props.sanitize(md.render(props.modelValue));
@@ -977,10 +976,15 @@ const useMarkdownIt = (props, previewOnly) => {
977
976
  const needReRender = computed(() => {
978
977
  return (props.noKatex || katexRef.value) && (props.noHighlight || hljsRef.value);
979
978
  });
980
- watch(
981
- [toRef(props, "modelValue"), needReRender, reRenderRef, languageRef],
982
- debounce(markHtml, previewOnly ? 0 : editorConfig.renderDelay)
983
- );
979
+ let timer = -1;
980
+ watch([toRef(props, "modelValue"), needReRender, reRenderRef, languageRef], () => {
981
+ timer = window.setTimeout(
982
+ () => {
983
+ markHtml();
984
+ },
985
+ previewOnly ? 0 : editorConfig.renderDelay
986
+ );
987
+ });
984
988
  watch(
985
989
  () => props.setting.preview,
986
990
  () => {
@@ -996,6 +1000,7 @@ const useMarkdownIt = (props, previewOnly) => {
996
1000
  }
997
1001
  }
998
1002
  );
1003
+ onMounted(updatedTodo);
999
1004
  onMounted(() => {
1000
1005
  bus.on(editorId, {
1001
1006
  name: PUSH_CATALOG,
@@ -1011,6 +1016,9 @@ const useMarkdownIt = (props, previewOnly) => {
1011
1016
  }
1012
1017
  });
1013
1018
  });
1019
+ onBeforeUnmount(() => {
1020
+ clearTimeout(timer);
1021
+ });
1014
1022
  return { html, key };
1015
1023
  };
1016
1024
  const template = {