Skip to content

Commit

Permalink
refactor: update plugin files (#719)
Browse files Browse the repository at this point in the history
* refactor: update uml plugin files

* chore: add file to ignore prettier
  • Loading branch information
seonim-ryu committed Jan 13, 2020
1 parent 074a400 commit 5fb361b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .prettierignore
@@ -0,0 +1,2 @@
*.md
*.html
3 changes: 3 additions & 0 deletions plugins/uml/.babelrc.js
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env']
};
4 changes: 2 additions & 2 deletions plugins/uml/README.md
Expand Up @@ -4,7 +4,7 @@

### Build

> Note: The bundle files under the `cdn` folder include all dependencies.
> Note : The bundle files under the `cdn` folder include all dependencies.
```
- dist/
Expand Down Expand Up @@ -100,7 +100,7 @@ const instance = Editor.factory({

## Use CDN

> Note : To use the plugin, `tui-editor`'s cdn files(css, scripts) must be included.
> Note : To use the plugin, `tui-editor`'s CDN files(css, scripts) must be included.
### Include Files

Expand Down
15 changes: 5 additions & 10 deletions plugins/uml/demo/editor.html
Expand Up @@ -4,14 +4,8 @@
<meta charset="UTF-8" />
<title>Editor</title>
<!-- Editor's Dependencies -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/codemirror.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.33.0/codemirror.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
<!-- Editor -->
<link rel="stylesheet" href="http://localhost:8080/dist/tui-editor.css" />
<link rel="stylesheet" href="http://localhost:8080/dist/tui-editor-contents.css" />
Expand Down Expand Up @@ -56,22 +50,23 @@ <h2>Viewer</h2>
].join('\n');

var Editor = tui.Editor;
var umlPlugin = Editor.plugin.uml;

var editor = new Editor({
el: document.querySelector('#editor'),
previewStyle: 'vertical',
height: '400px',
initialEditType: 'markdown',
initialValue: content,
plugins: [Editor.plugin.uml]
plugins: [umlPlugin]
});

var viewer = Editor.factory({
el: document.querySelector('#viewer'),
viewer: true,
height: '500px',
initialValue: content,
plugins: [Editor.plugin.uml]
plugins: [umlPlugin]
});
</script>
</body>
Expand Down
8 changes: 2 additions & 6 deletions plugins/uml/demo/viewer.html
Expand Up @@ -4,10 +4,7 @@
<meta charset="UTF-8" />
<title>Viewer</title>
<!-- Editor's Dependencies -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" />
<!-- Editor -->
<link rel="stylesheet" href="http://localhost:8080/dist/tui-editor-contents.css" />
</head>
Expand All @@ -18,7 +15,7 @@
<!-- Editor's Viewer -->
<script src="http://localhost:8080/dist/tui-editor-Viewer-full.js"></script>
<!-- Plugin -->
<script src="../../dist/cdn/toastui-editor-plugin-uml.js"></script>
<script src="../dist/cdn/toastui-editor-plugin-uml.js"></script>
<script class="code-js">
var content = [
'```uml',
Expand Down Expand Up @@ -51,7 +48,6 @@
el: document.querySelector('#viewer'),
previewStyle: 'vertical',
height: '400px',
initialEditType: 'markdown',
initialValue: content,
plugins: [Viewer.plugin.uml]
});
Expand Down
4 changes: 2 additions & 2 deletions plugins/uml/src/js/index.js
@@ -1,5 +1,5 @@
/**
* @fileoverview Implements UML plugin
* @fileoverview Implements uml plugin
* @author NHN FE Development Lab <dl_javascript@nhn.com>
*/
import plantumlEncoder from 'plantuml-encoder';
Expand All @@ -8,7 +8,7 @@ const DEFAULT_RENDERER_URL = 'http://www.plantuml.com/plantuml/png/';
const UML_LANGUAGES = ['uml', 'plantuml'];

/**
* plant uml plugin
* Plant uml plugin
* @param {Editor} editor - editor
* @param {object} [options={}] - plugin options
* @param {string} options.rendererURL - plant uml renderer url
Expand Down
13 changes: 2 additions & 11 deletions plugins/uml/webpack.config.js
@@ -1,5 +1,5 @@
/**
* @fileoverview configs for plugin's bundle file
* @fileoverview Configs for plugin's bundle file
* @author NHN FE Development Lab <dl_javascript@nhn.com>
*/
const path = require('path');
Expand Down Expand Up @@ -29,16 +29,7 @@ function getOutputConfig(isCDN, isMinified) {

function getExternalsConfig(isProduction, isCDN) {
if (isProduction && !isCDN) {
return [
{
'plantuml-encoder': {
commonjs: 'plantuml-encoder',
commonjs2: 'plantuml-encoder',
amd: 'plantuml-encoder',
root: ['plantumlEncoder']
}
}
];
return ['plantuml-encoder'];
}

return [];
Expand Down

0 comments on commit 5fb361b

Please sign in to comment.