瀏覽代碼

little update in wysiwyg

Ethosa 11 月之前
父節點
當前提交
7c7653396e
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 3 0
      components/Editor/MilkdownEditor.vue
  2. 8 0
      components/Editor/WysiWyg.vue

+ 3 - 0
components/Editor/MilkdownEditor.vue

@@ -74,6 +74,8 @@ const toggleLink = () => editor.action(callCommand(toggleLinkCommand.key));
 const toggleList = () => editor.action(callCommand(wrapInOrderedListCommand.key));
 const toggleQuote = () => editor.action(callCommand(wrapInBlockquoteCommand.key));
 
+const getMdText = () => editor.action(getMarkdown());
+
 
 defineExpose({
   content,
@@ -83,6 +85,7 @@ defineExpose({
   toggleList,
   toggleLink,
   toggleQuote,
+  getMdText,
 });
 </script>
 

+ 8 - 0
components/Editor/WysiWyg.vue

@@ -60,6 +60,7 @@ const editor = ref<{
   toggleLink?: () => void,
   toggleList?: () => void,
   toggleQuote?: () => void,
+  getMdText?: () => void,
 }>();
 
 
@@ -78,4 +79,11 @@ const applyLink = () => editor.value?.toggleLink!!();
 const applyList = () => editor.value?.toggleList!!();
 const applyQuote = () => editor.value?.toggleQuote!!();
 
+const getMdText = () => editor.value?.getMdText!!();
+
+
+defineExpose({
+  getMdText,
+})
+
 </script>