feat: 更新 vue-editormd 源码,以支持 PlantUML 解析
This commit is contained in:
parent
3f693be1bd
commit
cde8e73dd5
@ -631,6 +631,12 @@
|
||||
return ;
|
||||
}
|
||||
|
||||
if (settings.plantuml) {
|
||||
editormd.loadScript(loadPath + "plantuml-encoder.min", function() {
|
||||
editormd.$plantumlEncoder = plantumlEncoder;
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.flowChart || settings.sequenceDiagram)
|
||||
{
|
||||
editormd.loadScript(loadPath + "raphael.min", function() {
|
||||
@ -2121,6 +2127,7 @@
|
||||
tex : settings.tex,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
@ -3518,6 +3525,7 @@
|
||||
taskList : false, // Enable Github Flavored Markdown task lists
|
||||
emoji : false, // :emoji: , Support Twemoji, fontAwesome, Editor.md logo emojis.
|
||||
tex : false, // TeX(LaTeX), based on KaTeX
|
||||
plantuml : false,
|
||||
flowChart : false, // flowChart.js only support IE9+
|
||||
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
|
||||
};
|
||||
@ -3756,7 +3764,11 @@
|
||||
else if ( lang === "math" || lang === "latex" || lang === "katex")
|
||||
{
|
||||
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
||||
}
|
||||
}
|
||||
else if ( lang === "plantuml" && settings.plantuml ) {
|
||||
const encoded = editormd.$plantumlEncoder.encode(code);
|
||||
return `<img src="https://www.plantuml.com/plantuml/svg/${encoded}" />`;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -4072,6 +4084,7 @@
|
||||
pageBreak : settings.pageBreak,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
|
||||
2
public/static/editor.md/editormd.amd.min.js
vendored
2
public/static/editor.md/editormd.amd.min.js
vendored
File diff suppressed because one or more lines are too long
@ -561,6 +561,12 @@
|
||||
return ;
|
||||
}
|
||||
|
||||
if (settings.plantuml) {
|
||||
editormd.loadScript(loadPath + "plantuml-encoder.min", function() {
|
||||
editormd.$plantumlEncoder = plantumlEncoder;
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.flowChart || settings.sequenceDiagram)
|
||||
{
|
||||
editormd.loadScript(loadPath + "raphael.min", function() {
|
||||
@ -2052,6 +2058,7 @@
|
||||
tex : settings.tex,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
@ -3449,6 +3456,7 @@
|
||||
taskList : false, // Enable Github Flavored Markdown task lists
|
||||
emoji : false, // :emoji: , Support Twemoji, fontAwesome, Editor.md logo emojis.
|
||||
tex : false, // TeX(LaTeX), based on KaTeX
|
||||
plantuml : false,
|
||||
flowChart : false, // flowChart.js only support IE9+
|
||||
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
|
||||
};
|
||||
@ -3687,7 +3695,11 @@
|
||||
else if ( lang === "math" || lang === "latex" || lang === "katex")
|
||||
{
|
||||
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
||||
}
|
||||
}
|
||||
else if ( lang === "plantuml" && settings.plantuml ) {
|
||||
const encoded = editormd.$plantumlEncoder.encode(code);
|
||||
return `<img src="https://www.plantuml.com/plantuml/svg/${encoded}" />`;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -4003,6 +4015,7 @@
|
||||
pageBreak : settings.pageBreak,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
|
||||
2
public/static/editor.md/editormd.min.js
vendored
2
public/static/editor.md/editormd.min.js
vendored
File diff suppressed because one or more lines are too long
6
public/static/editor.md/lib/plantuml-encoder.min.js
vendored
Normal file
6
public/static/editor.md/lib/plantuml-encoder.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -549,6 +549,12 @@
|
||||
return ;
|
||||
}
|
||||
|
||||
if (settings.plantuml) {
|
||||
editormd.loadScript(loadPath + "plantuml-encoder.min", function() {
|
||||
editormd.$plantumlEncoder = plantumlEncoder;
|
||||
});
|
||||
}
|
||||
|
||||
if (settings.flowChart || settings.sequenceDiagram)
|
||||
{
|
||||
editormd.loadScript(loadPath + "raphael.min", function() {
|
||||
@ -2039,6 +2045,7 @@
|
||||
tex : settings.tex,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
@ -3439,6 +3446,7 @@
|
||||
taskList : false, // Enable Github Flavored Markdown task lists
|
||||
emoji : false, // :emoji: , Support Twemoji, fontAwesome, Editor.md logo emojis.
|
||||
tex : false, // TeX(LaTeX), based on KaTeX
|
||||
plantuml : false,
|
||||
flowChart : false, // flowChart.js only support IE9+
|
||||
sequenceDiagram : false, // sequenceDiagram.js only support IE9+
|
||||
};
|
||||
@ -3677,7 +3685,11 @@
|
||||
else if ( lang === "math" || lang === "latex" || lang === "katex")
|
||||
{
|
||||
return "<p class=\"" + editormd.classNames.tex + "\">" + code + "</p>";
|
||||
}
|
||||
}
|
||||
else if ( lang === "plantuml" && settings.plantuml ) {
|
||||
const encoded = editormd.$plantumlEncoder.encode(code);
|
||||
return `<img src="https://www.plantuml.com/plantuml/svg/${encoded}" />`;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -3993,6 +4005,7 @@
|
||||
pageBreak : settings.pageBreak,
|
||||
atLink : settings.atLink, // for @link
|
||||
emailLink : settings.emailLink, // for mail address auto link
|
||||
plantuml : settings.plantuml,
|
||||
flowChart : settings.flowChart,
|
||||
sequenceDiagram : settings.sequenceDiagram,
|
||||
previewCodeHighlight : settings.previewCodeHighlight,
|
||||
|
||||
@ -148,6 +148,7 @@ export default {
|
||||
htmlDecode: 'style,script,iframe|on*', // 开启 HTML 标签解析,为了安全性,默认不开启
|
||||
tocm: true, // Using [TOCM]
|
||||
tex: true, // 开启科学公式TeX语言支持,默认关闭
|
||||
plantuml: true, // 开启 plantuml 解析,默认关闭
|
||||
flowChart: true, // 开启流程图支持,默认关闭
|
||||
sequenceDiagram: true, // 开启时序/序列图支持,默认关闭
|
||||
taskList: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user