From 38221a3e2e3b178e54645d62ec3d2876559230d8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 3 Jan 2022 01:36:39 +0800 Subject: [PATCH] =?UTF-8?q?bpmnProcessDesigner=20=E4=BF=AE=E6=94=B9=20xml?= =?UTF-8?q?=E3=80=81json=20=E9=A2=84=E8=A7=88=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=80=81=E7=89=88=E6=9C=AC=E7=9A=84=20highlight?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package/designer/ProcessDesigner.vue | 17 ++++++++++++++--- yudao-admin-ui/src/views/tool/codegen/index.vue | 2 -- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue index f45dc194c..ddd9a4da6 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue @@ -80,8 +80,8 @@
- - + +
@@ -107,6 +107,12 @@ import flowableModdleExtension from "./plugins/extension-moddle/flowable"; // 引入json转换与高亮 import convert from "xml-js"; +// 代码高亮插件 +import hljs from "highlight.js/lib/highlight"; +import "highlight.js/styles/github-gist.css"; +hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); +hljs.registerLanguage("json", require("highlight.js/lib/languages/json")); + export default { name: "MyProcessDesigner", componentName: "MyProcessDesigner", @@ -463,7 +469,12 @@ export default { } // 触发 save 事件 this.$emit('save', xml) - } + }, + /** 高亮显示 */ + highlightedCode(previewType, previewResult) { + const result = hljs.highlight(previewType, previewResult || "", true); + return result.value || ' '; + }, } }; diff --git a/yudao-admin-ui/src/views/tool/codegen/index.vue b/yudao-admin-ui/src/views/tool/codegen/index.vue index c2e1b439b..56ebeecf9 100644 --- a/yudao-admin-ui/src/views/tool/codegen/index.vue +++ b/yudao-admin-ui/src/views/tool/codegen/index.vue @@ -125,8 +125,6 @@ import importTable from "./importTable"; // 代码高亮插件 import hljs from "highlight.js/lib/highlight"; import "highlight.js/styles/github-gist.css"; -import {SysCommonStatusEnum} from "@/utils/constants"; -import {createTestDemo, updateTestDemo} from "@/api/tool/testDemo"; hljs.registerLanguage("java", require("highlight.js/lib/languages/java")); hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));