Skip to content

Commit

Permalink
plantuml
Browse files Browse the repository at this point in the history
  • Loading branch information
star7th committed Feb 11, 2020
1 parent 22a2889 commit 319f6c2
Show file tree
Hide file tree
Showing 3 changed files with 1,768 additions and 1 deletion.
1 change: 1 addition & 0 deletions web_src/src/components/common/Editormd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default {
`${this.editorPath}/lib/sequence-diagram.min.js`,
`${this.editorPath}/lib/jquery.flowchart.min.js`,
`${this.editorPath}/lib/jquery.mark.min.js`,
`${this.editorPath}/lib/plantuml.js`,
], () => {
$s(`${this.editorPath}/editormd.js`, () => {
Expand Down
22 changes: 21 additions & 1 deletion web_src/static/editor.md/editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,23 @@
if (typeof ($) === "undefined") {
return ;
}


$.fn.extend({
//tag@a:plantuml
plantuml:function() {
var previewContainer = $(this);
previewContainer.find("pre:has(.lang-plantuml)").each(function(){
var $uml = $(this);
var lines = [];
$uml.find('.lang-plantuml').each(function(){
lines.push($(this).text());
});
var img = '<img src="'+plantuml_imgsrc(lines.join("\n"))+'"><br>'
$uml.replaceWith(img);
});
}
});

/**
* editormd
*
Expand Down Expand Up @@ -1530,6 +1546,8 @@
}

previewContainer.find(".flowchart").flowChart();
//tag@a:plantuml
previewContainer.plantuml();
}

if (settings.sequenceDiagram) {
Expand Down Expand Up @@ -4018,6 +4036,8 @@
{
if (settings.flowChart) {
div.find(".flowchart").flowChart();
//tag@a:plantuml
$(div).plantuml();
}

if (settings.sequenceDiagram) {
Expand Down
Loading

0 comments on commit 319f6c2

Please sign in to comment.