Skip to content

Commit 838681f

Browse files
authored
feat(editor-md): previewContentChange返回html字段 (#1789)
1 parent f85fd87 commit 838681f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function useEditorMd(props: EditorMdProps, ctx: SetupContext) {
8888
editorScroll();
8989
});
9090
nextTick(() => {
91-
ctx.emit('previewContentChange');
91+
ctx.emit('previewContentChange', html);
9292
});
9393
};
9494

packages/devui-vue/docs/components/editor-md/index.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
```vue
88
<template>
99
<input v-model="content" />
10-
<d-editor-md v-model="content" :md-rules="mdRules" base-url="https://test-base-url" @content-change="valueChange"></d-editor-md>
10+
<d-editor-md v-model="content" :md-rules="mdRules" base-url="https://test-base-url" @content-change="valueChange" @preview-content-change="previewChange"></d-editor-md>
1111
</template>
1212
1313
<script>
@@ -26,7 +26,11 @@ export default defineComponent({
2626
console.log(val);
2727
};
2828
29-
return { content, mdRules, valueChange };
29+
const previewChange = (val) => {
30+
console.log(val);
31+
};
32+
33+
return { content, mdRules, valueChange, previewChange };
3034
},
3135
});
3236
</script>
@@ -596,7 +600,7 @@ Bob-->>John: Jolly good!
596600
| :--------------------- | :--------------------------- | :----------------------------------------------------------------- | :-------- |
597601
| after-editor-init | `Function(instance: object)` | 编辑器初始化事件,返回编辑器对象 | |
598602
| content-change | `Function(content: string)` | 编辑器内容改变事件,返回当前内容 | |
599-
| preview-content-change | `Function()` | 预览内容改变时触发 | |
603+
| preview-content-change | `Function(string)` | 预览内容改变时触发,返回对应的html字段 | |
600604
| image-upload | `Function({file, callback})` | 打开图片上传开关后,图片上传事件回调,返回文件内容与 callback 函数 | |
601605
| checked-change | `Function(content: string)` | plugins添加checkbox后,预览checkbox checked状态改变回调 | |
602606

0 commit comments

Comments
 (0)