|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
|
|
|
+import { SlateTransforms } from "@wangeditor/editor";
|
|
|
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
|
|
|
|
|
|
export default {
|
|
@@ -55,6 +56,16 @@ export default {
|
|
|
content(newVal, oldVal) {
|
|
|
if (newVal && newVal != oldVal) {
|
|
|
this.html = `<pre><code>${newVal}</code></pre>`;
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ SlateTransforms.setNodes(
|
|
|
+ this.editor,
|
|
|
+ { language: "python" },
|
|
|
+ {
|
|
|
+ type: "code",
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
},
|