diff --git a/package.json b/package.json
index 36045c4d..e02be220 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,6 @@
"echarts": "4.1.0",
"element-ui": "2.4.6",
"file-saver": "1.3.8",
- "font-awesome": "4.7.0",
"js-cookie": "2.2.0",
"jsonlint": "1.6.3",
"jszip": "3.1.5",
@@ -52,8 +51,8 @@
"nprogress": "0.2.0",
"screenfull": "3.3.3",
"showdown": "1.8.6",
- "simplemde": "1.11.2",
"sortablejs": "1.7.0",
+ "tui-editor": "1.2.7",
"vue": "2.5.17",
"vue-count-to": "1.0.13",
"vue-i18n": "7.3.2",
diff --git a/src/components/MarkdownEditor/defaultOptions.js b/src/components/MarkdownEditor/defaultOptions.js
new file mode 100644
index 00000000..303aa13d
--- /dev/null
+++ b/src/components/MarkdownEditor/defaultOptions.js
@@ -0,0 +1,31 @@
+// doc: https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#ToastUIEditor
+export default {
+ minHeight: '200px',
+ previewStyle: 'vertical',
+ useCommandShortcut: true,
+ useDefaultHTMLSanitizer: true,
+ usageStatistics: false,
+ hideModeSwitch: false,
+ toolbarItems: [
+ 'heading',
+ 'bold',
+ 'italic',
+ 'strike',
+ 'divider',
+ 'hr',
+ 'quote',
+ 'divider',
+ 'ul',
+ 'ol',
+ 'task',
+ 'indent',
+ 'outdent',
+ 'divider',
+ 'table',
+ 'image',
+ 'link',
+ 'divider',
+ 'code',
+ 'codeblock'
+ ]
+}
diff --git a/src/components/MarkdownEditor/index.vue b/src/components/MarkdownEditor/index.vue
index 9847668a..4a6d8b0f 100644
--- a/src/components/MarkdownEditor/index.vue
+++ b/src/components/MarkdownEditor/index.vue
@@ -1,16 +1,18 @@
-
-
-
+
-
-
diff --git a/src/views/components-demo/markdown.vue b/src/views/components-demo/markdown.vue
index f60911d0..5fb39569 100644
--- a/src/views/components-demo/markdown.vue
+++ b/src/views/components-demo/markdown.vue
@@ -1,15 +1,40 @@
+
Markdown is based on
- simplemde-markdown-editor ,Simply encapsulated in Vue.
+ tui.editor ,Simply encapsulated in Vue.
相关文章
+
-
+ Basic:
+
-
To HTML
+
+
+ Markdown Mode:
+
+
+
+
+ Customize Toolbar:
+
+
+
+
+ I18n:
+
+
+
+
+
Get HTML
+
@@ -17,32 +42,46 @@
import MarkdownEditor from '@/components/MarkdownEditor'
const content = `
-**this is test**
+**This is test**
* vue
* element
* webpack
-## Simplemde
`
-
export default {
name: 'MarkdownDemo',
components: { MarkdownEditor },
data() {
return {
content: content,
- html: ''
+ html: '',
+ languageTypeList: {
+ 'en': 'en_US',
+ 'zh': 'zh_CN',
+ 'es': 'es_ES'
+ }
+ }
+ },
+ computed: {
+ language() {
+ return this.languageTypeList[this.$store.getters.language]
}
},
methods: {
- markdown2Html() {
- import('showdown').then(showdown => {
- const converter = new showdown.Converter()
- this.html = converter.makeHtml(this.content)
- })
+ getHtml() {
+ this.html = this.$refs.markdownEditor.getHtml()
+ console.log(this.html)
}
}
}
+