chunk-2de8.da48ea22.js 4.6 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2de8"],{"/Ofm":function(t,e,n){"use strict";var i=n("uLH/");n.n(i).a},RAt8:function(t,e,n){"use strict";n.r(e);var i=n("QbLZ"),o=n.n(i),a=n("P2sY"),r=n.n(a),s=(n("p77/"),n("9RMS"),n("WGVu")),d={minHeight:"200px",previewStyle:"vertical",useCommandShortcut:!0,useDefaultHTMLSanitizer:!0,usageStatistics:!1,hideModeSwitch:!1,toolbarItems:["heading","bold","italic","strike","divider","hr","quote","divider","ul","ol","task","indent","outdent","divider","table","image","link","divider","code","codeblock"]},l={name:"MarddownEditor",props:{value:{type:String,default:""},id:{type:String,required:!1,default:function(){return"markdown-editor-"+ +new Date+(1e3*Math.random()).toFixed(0)}},options:{type:Object,default:function(){return d}},mode:{type:String,default:"markdown"},height:{type:String,required:!1,default:"300px"},language:{type:String,required:!1,default:"en_US"}},data:function(){return{editor:null}},computed:{editorOptions:function(){var t=r()({},d,this.options);return t.initialEditType=this.mode,t.height=this.height,t.language=this.language,t}},watch:{value:function(t,e){t!==e&&t!==this.editor.getMarkdown()&&this.editor.setMarkdown(t)},language:function(t){this.destroyEditor(),this.initEditor()},height:function(t){this.editor.height(t)},mode:function(t){this.editor.changeMode(t)}},mounted:function(){this.initEditor()},destroyed:function(){this.destroyEditor()},methods:{initEditor:function(){var t=this;this.editor=new s.a(o()({el:document.getElementById(this.id)},this.editorOptions)),this.value&&this.editor.setMarkdown(this.value),this.editor.on("change",function(){t.$emit("input",t.editor.getMarkdown())})},destroyEditor:function(){this.editor&&(this.editor.off("change"),this.editor.remove())},setMarkdown:function(t){this.editor.setMarkdown(t)},getMarkdown:function(){return this.editor.getMarkdown()},setHtml:function(t){this.editor.setHtml(t)},getHtml:function(){return this.editor.getHtml()}}},c=n("KHd+"),u=Object(c.a)(l,function(){var t=this.$createElement;return(this._self._c||t)("div",{attrs:{id:this.id}})},[],!1,null,null,null);u.options.__file="index.vue";var h={name:"MarkdownDemo",components:{MarkdownEditor:u.exports},data:function(){return{content:"\n**This is test**\n\n* vue\n* element\n* webpack\n\n",html:"",languageTypeList:{en:"en_US",zh:"zh_CN",es:"es_ES"}}},computed:{language:function(){return this.languageTypeList[this.$store.getters.language]}},methods:{getHtml:function(){this.html=this.$refs.markdownEditor.getHtml(),console.log(this.html)}}},m=(n("/Ofm"),Object(c.a)(h,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"components-container"},[t._m(0),t._v(" "),n("div",{staticClass:"editor-container"},[n("el-tag",{staticClass:"tag-title"},[t._v("Basic:")]),t._v(" "),n("markdown-editor",{attrs:{height:"300px"},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),n("div",{staticClass:"editor-container"},[n("el-tag",{staticClass:"tag-title"},[t._v("Markdown Mode:")]),t._v(" "),n("markdown-editor",{ref:"markdownEditor",attrs:{options:{hideModeSwitch:!0,previewStyle:"tab"},height:"200px"},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),n("div",{staticClass:"editor-container"},[n("el-tag",{staticClass:"tag-title"},[t._v("Customize Toolbar:")]),t._v(" "),n("markdown-editor",{ref:"markdownEditor",attrs:{options:{toolbarItems:["heading","bold","italic"]}},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),n("div",{staticClass:"editor-container"},[n("el-tag",{staticClass:"tag-title"},[t._v("I18n:")]),t._v(" "),n("el-alert",{attrs:{closable:!1,title:"You can change the language of the admin system to see the effect",type:"success"}}),t._v(" "),n("markdown-editor",{attrs:{language:t.language,height:"300px"},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1),t._v(" "),n("el-button",{staticStyle:{"margin-top":"80px"},attrs:{type:"primary",icon:"el-icon-document"},on:{click:t.getHtml}},[t._v("Get HTML")]),t._v(" "),n("div",{domProps:{innerHTML:t._s(t.html)}})],1)},[function(){var t=this.$createElement,e=this._self._c||t;return e("code",[this._v("Markdown is based on\n "),e("a",{attrs:{href:"https://github.com/nhnent/tui.editor",target:"_blank"}},[this._v("tui.editor")]),this._v(" ,Simply encapsulated in Vue.\n "),e("a",{attrs:{target:"_blank",href:"https://panjiachen.github.io/vue-element-admin-site/feature/component/markdown-editor.html"}},[this._v("\n Documentation ")])])}],!1,null,"3af0f7dd",null));m.options.__file="markdown.vue";e.default=m.exports},"uLH/":function(t,e,n){}}]);