From b37a789f636004c23b55ce92aaa51bc21e1f9be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Wed, 28 Nov 2018 11:05:41 +0800 Subject: [PATCH] add tui.editor (#1374) --- package.json | 3 +- .../MarkdownEditor/defaultOptions.js | 31 ++++ src/components/MarkdownEditor/index.vue | 171 +++++++++--------- src/views/components-demo/markdown.vue | 63 +++++-- 4 files changed, 166 insertions(+), 102 deletions(-) create mode 100644 src/components/MarkdownEditor/defaultOptions.js diff --git a/package.json b/package.json index 36045c4d6b7..e02be220d8f 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 00000000000..303aa13d377 --- /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 9847668ae6b..4a6d8b0f7d5 100644 --- a/src/components/MarkdownEditor/index.vue +++ b/src/components/MarkdownEditor/index.vue @@ -1,16 +1,18 @@