Commit 38221a3e2e3b178e54645d62ec3d2876559230d8
1 parent
490f907a
bpmnProcessDesigner 修改 xml、json 预览,使用老版本的 highlight
Showing
2 changed files
with
14 additions
and
5 deletions
yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue
| ... | ... | @@ -80,8 +80,8 @@ |
| 80 | 80 | <div class="my-process-designer__container"> |
| 81 | 81 | <div class="my-process-designer__canvas" ref="bpmn-canvas"></div> |
| 82 | 82 | </div> |
| 83 | - <el-dialog title="预览" width="60%" :visible.sync="previewModelVisible" append-to-body destroy-on-close> | |
| 84 | - <highlightjs :language="previewType" :code="previewResult" /> | |
| 83 | + <el-dialog title="预览" width="80%" :visible.sync="previewModelVisible" append-to-body destroy-on-close> | |
| 84 | + <pre><code class="hljs" v-html="highlightedCode(previewType, previewResult)"></code></pre> | |
| 85 | 85 | </el-dialog> |
| 86 | 86 | </div> |
| 87 | 87 | </template> |
| ... | ... | @@ -107,6 +107,12 @@ import flowableModdleExtension from "./plugins/extension-moddle/flowable"; |
| 107 | 107 | // 引入json转换与高亮 |
| 108 | 108 | import convert from "xml-js"; |
| 109 | 109 | |
| 110 | +// 代码高亮插件 | |
| 111 | +import hljs from "highlight.js/lib/highlight"; | |
| 112 | +import "highlight.js/styles/github-gist.css"; | |
| 113 | +hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); | |
| 114 | +hljs.registerLanguage("json", require("highlight.js/lib/languages/json")); | |
| 115 | + | |
| 110 | 116 | export default { |
| 111 | 117 | name: "MyProcessDesigner", |
| 112 | 118 | componentName: "MyProcessDesigner", |
| ... | ... | @@ -463,7 +469,12 @@ export default { |
| 463 | 469 | } |
| 464 | 470 | // 触发 save 事件 |
| 465 | 471 | this.$emit('save', xml) |
| 466 | - } | |
| 472 | + }, | |
| 473 | + /** 高亮显示 */ | |
| 474 | + highlightedCode(previewType, previewResult) { | |
| 475 | + const result = hljs.highlight(previewType, previewResult || "", true); | |
| 476 | + return result.value || ' '; | |
| 477 | + }, | |
| 467 | 478 | } |
| 468 | 479 | }; |
| 469 | 480 | </script> | ... | ... |
yudao-admin-ui/src/views/tool/codegen/index.vue
| ... | ... | @@ -125,8 +125,6 @@ import importTable from "./importTable"; |
| 125 | 125 | // 代码高亮插件 |
| 126 | 126 | import hljs from "highlight.js/lib/highlight"; |
| 127 | 127 | import "highlight.js/styles/github-gist.css"; |
| 128 | -import {SysCommonStatusEnum} from "@/utils/constants"; | |
| 129 | -import {createTestDemo, updateTestDemo} from "@/api/tool/testDemo"; | |
| 130 | 128 | hljs.registerLanguage("java", require("highlight.js/lib/languages/java")); |
| 131 | 129 | hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); |
| 132 | 130 | hljs.registerLanguage("html", require("highlight.js/lib/languages/xml")); | ... | ... |