feat: 拉取更新 MarkdownEditor 组件代码

This commit is contained in:
Frankie Huang 2025-04-06 04:02:25 +08:00
parent d32e9a83f1
commit 13092e8814

View File

@ -3,7 +3,7 @@
<!-- rewrite Markdown CSS(Cmd Markdown Style) from https://github.com/wakaryry/editorMd --> <!-- rewrite Markdown CSS(Cmd Markdown Style) from https://github.com/wakaryry/editorMd -->
<link rel="stylesheet" href="/static/CmdMarkdown/custom.css"> <link rel="stylesheet" href="/static/CmdMarkdown/custom.css">
<div id="markdown-editor" /> <div id="markdown-editor"></div>
</template> </template>
<script> <script>
@ -44,6 +44,18 @@ export default {
type: Function, type: Function,
required: false, required: false,
default: () => { } default: () => { }
},
//
onfullscreen: {
type: Function,
required: false,
default: () => { }
},
// 退
onfullscreenExit: {
type: Function,
required: false,
default: () => { }
} }
}, },
data() { data() {
@ -106,18 +118,15 @@ export default {
// editorTheme: (localStorage.editorTheme) ? localStorage.editorThheme : "3024-night", // editorTheme: (localStorage.editorTheme) ? localStorage.editorThheme : "3024-night",
// previewTheme: (localStorage.previewTheme) ? localStorage.previewTheme : "default", // previewTheme: (localStorage.previewTheme) ? localStorage.previewTheme : "default",
// 退
// onfullscreen: function () {
// // JS
// var editor = document.getElementById('markdown-editor')
// editor.style['z-index'] = 13
// },
// //
// onfullscreenExit: function () { onfullscreen: function () {
// // JS vm.onfullscreen()
// var editor = document.getElementById('markdown-editor') },
// editor.style['z-index'] = 10
// }, // 退
onfullscreenExit: function () {
vm.onfullscreenExit()
},
// //
onchange: function () { onchange: function () {
@ -165,7 +174,11 @@ export default {
if (!this.isEditorLoadingCompleted()) { if (!this.isEditorLoadingCompleted()) {
return false return false
} }
if (newMarkdownCode.length == 0) {
editorClient.clear()
} else {
editorClient.setMarkdown(newMarkdownCode) editorClient.setMarkdown(newMarkdownCode)
}
return true return true
}, },
getMarkdownCode() { getMarkdownCode() {
@ -184,5 +197,4 @@ export default {
} }
</script> </script>
<style scoped> <style scoped></style>
</style>