|
@@ -1,3 +1,4 @@
|
|
|
|
|
+import plantumlEncoder from 'plantuml-encoder';
|
|
|
import urljoin from 'url-join';
|
|
import urljoin from 'url-join';
|
|
|
|
|
|
|
|
export default class PlantUMLConfigurer {
|
|
export default class PlantUMLConfigurer {
|
|
@@ -6,7 +7,6 @@ export default class PlantUMLConfigurer {
|
|
|
this.crowi = crowi;
|
|
this.crowi = crowi;
|
|
|
const config = crowi.getConfig();
|
|
const config = crowi.getConfig();
|
|
|
|
|
|
|
|
- this.deflate = require('markdown-it-plantuml/lib/deflate.js');
|
|
|
|
|
this.serverUrl = config.env.PLANTUML_URI || 'http://plantuml.com/plantuml';
|
|
this.serverUrl = config.env.PLANTUML_URI || 'http://plantuml.com/plantuml';
|
|
|
|
|
|
|
|
this.generateSource = this.generateSource.bind(this);
|
|
this.generateSource = this.generateSource.bind(this);
|
|
@@ -19,8 +19,7 @@ export default class PlantUMLConfigurer {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
generateSource(umlCode) {
|
|
generateSource(umlCode) {
|
|
|
- const zippedCode =
|
|
|
|
|
- this.deflate.encode64(this.deflate.zip_deflate('@startuml\n' + umlCode + '\n@enduml', 9));
|
|
|
|
|
|
|
+ const zippedCode = plantumlEncoder.encode(`@startuml\n${umlCode}\n@enduml`);
|
|
|
return urljoin(this.serverUrl, 'svg' , zippedCode);
|
|
return urljoin(this.serverUrl, 'svg' , zippedCode);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|