2020-12-03 00:55:08 +08:00
|
|
|
|
(function(e){function t(t){for(var n,a,s=t[0],c=t[1],l=t[2],d=0,f=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(i,a)&&i[a]&&f.push(i[a][0]),i[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);u&&u(t);while(f.length)f.shift()();return r.push.apply(r,l||[]),o()}function o(){for(var e,t=0;t<r.length;t++){for(var o=r[t],n=!0,s=1;s<o.length;s++){var c=o[s];0!==i[c]&&(n=!1)}n&&(r.splice(t--,1),e=a(a.s=o[0]))}return e}var n={},i={app:0},r=[];function a(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=n,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="/md/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],c=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var u=c;r.push([0,"chunk-vendors"]),o()})({0:function(e,t,o){e.exports=o("56d7")},"0816":function(e,t,o){"use strict";o("156c")},"09837":function(e,t,o){"use strict";o("90be")},"0fd0":function(e,t,o){"use strict";o("1467")},1:function(e,t){},10:function(e,t){},11:function(e,t){},12:function(e,t){},13:function(e,t){},14:function(e,t){},1467:function(e,t,o){},15:function(e,t){},"156c":function(e,t,o){},"16aa":function(e,t,o){"use strict";o("ff20")},2:function(e,t){},"2ce0":function(e,t,o){},3:function(e,t){},3572:function(e,t,o){"use strict";o("52d4")},"3a5e":function(e,t,o){"use strict";var n=o("4fda"),i=o("cb57"),r=(o("0816"),o("2877")),a=Object(r["a"])(i["default"],n["a"],n["b"],!1,null,"28c1354c",null);t["default"]=a.exports},4:function(e,t){},"4fda":function(e,t,o){"use strict";o.d(t,"a",(function(){return n})),o.d(t,"b",(function(){return i}));var n=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},i=[function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"loading",attrs:{id:"loading"}},[o("div",{staticClass:"loading-wrapper"},[o("div",{staticClass:"loading-anim"}),o("div",{staticClass:"loading-text"},[e._v("致力于让 Markdown 编辑更简单")])])])}]},5:function(e,t){},"52d4":function(e,t,o){},"56d7":function(e,t,o){"use strict";o.r(t);o("e260"),o("e6cf"),o("cca6"),o("a79d");var n=o("2b0e"),i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return e.loading?o("transition",{attrs:{name:"fade"}},[o("loading")],1):o("codemirror-editor")},r=[],a=o("3a5e"),s=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"container",class:{container_night:e.nightMode}},[o("el-container",[o("el-header",{staticClass:"editor__header"},[o("editor-header",{ref:"header",on:{refresh:e.onEditorRefresh,cssChanged:e.cssChanged,download:e.downloadEditorContent,showCssEditor:function(t){e.showCssEditor=!e.showCssEditor},"show-about-dialog":function(t){e.aboutDialogVisible=!0},showDialogForm:function(t){e.dialogFormVisible=!0},"show-dialog-upload-img":function(t){e.dialogUploadImgVisible=!0},startCopy:function(t){e.isCoping=!0,e.backLight=!0},endCopy:e.endCopy}})],1),o("el-main",{staticClass:"main-body"},[o("el-row",{staticClass:"main-section"},[o("el-col",{attrs:{span:12},nativeOn:{contextmenu:function(t){return t.preventDefault(),e.openMenu(t)}}},[o("textarea",{directives:[{name:"model",rawName:"v-model",value:e.source,expression:"source"}],attrs:{id:"editor",type:"textarea",placeholder:"Your markdown text here."},domProps:{value:e.source},on:{input:function(t){t.target.composing||(e.sou
|
|
|
|
|
e.$store.commit("setRightClickMenuVisible",!1)})),this.editor.on("scroll",(function(){e.$store.commit("setRightClickMenuVisible",!1)}))},initCssEditor:function(){var e=this;this.initCssEditorEntity(),this.cssEditor.on("keyup",(function(e,t){(t.keyCode>=65&&t.keyCode<=90||189===t.keyCode)&&e.showHint(t)})),this.cssEditor.on("update",(function(t){e.cssChanged(),T(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=_(this.cssEditor.getValue(0)),t=x(this.currentSize.replace("px",""));t=O(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},uploaded:function(e){if(e){this.dialogUploadImgVisible=!1;var t=this.editor.getCursor(),o=e,n="![](".concat(o,")");this.editor.replaceSelection("\n".concat(n,"\n"),t),this.$message({showClose:!0,message:"图片上传成功",type:"success"}),this.onEditorRefresh()}else this.$message({showClose:!0,message:"上传图片未知异常",type:"error"})},leftAndRightScroll:function(){var e=this,t=function(t){var i,r;clearTimeout(e.timeout),"preview"===t?(i=e.$refs.preview.$el,r=document.getElementsByClassName("CodeMirror-scroll")[0],e.editor.off("scroll",o),e.timeout=setTimeout((function(){e.editor.on("scroll",o)}),300)):"editor"===t&&(i=document.getElementsByClassName("CodeMirror-scroll")[0],r=e.$refs.preview.$el,r.removeEventListener("scroll",n,!1),e.timeout=setTimeout((function(){r.addEventListener("scroll",n,!1)}),300));var a=i.scrollTop/(i.scrollHeight-i.offsetHeight),s=a*(r.scrollHeight-r.offsetHeight);r.scrollTo(0,s)},o=function(){t("editor")},n=function(){t("preview")};this.$refs.preview.$el.addEventListener("scroll",n,!1),this.editor.on("scroll",o)},onEditorRefresh:function(){this.editorRefresh(),setTimeout((function(){return PR.prettyPrint()}),0)},endCopy:function(){var e=this;this.backLight=!1,setTimeout((function(){e.isCoping=!1}),800)},downloadEditorContent:function(){R(this.editor.getValue(0))},formatContent:function(){var e=E(this.editor.getValue(0));localStorage.setItem("__editor_content",e),this.editor.setValue(e)},openMenu:function(e){var t=105,o=this.$el.getBoundingClientRect().left,n=this.$el.offsetWidth,i=n-t,r=e.clientX-o;this.mouseLeft=Math.min(i,r),this.mouseTop=e.clientY+10,this.$store.commit("setRightClickMenuVisible",!0)},closeRightClickMenu:function(){this.$store.commit("setRightClickMenuVisible",!1)},onMenuEvent:function(e){switch(e){case"pageReset":this.$refs.header.showResetConfirm=!0;break;case"insertPic":this.dialogUploadImgVisible=!0;break;case"download":this.downloadEditorContent();break;case"insertTable":this.dialogFormVisible=!0;break;case"formatMarkdown":this.formatContent();break;default:break}}},Object(V["b"])(["initEditorState","initEditorEntity","setWxRendererOptions","editorRefresh","initCssEditorEntity"])),mounted:function(){var e=this;setTimeout((function(){e.leftAndRightScroll(),PR.prettyPrint()}),300)}},st=at,ct=(o("7318"),o("85fe"),Object(L["a"])(st,s,c,!1,null,"47950998",null)),lt=ct.exports,ut={name:"App",components:{Loading:a["default"],CodemirrorEditor:lt},data:function(){return{loading:!0}},mounted:function(){var e=this;setTimeout((function(){e.loading=!1}),100)}},dt=ut,ft=(o("91eb"),Object(L["a"])(dt,i,r,!1,null,"f01d475a",null)),mt=ft.exports,pt=o("d4ec"),gt=o("0e54"),ht=o.n(gt),bt=function e(t){var o=this;Object(pt["a"])(this,e),this.opts=t;var n=!0,i=[],r=0,a=null,s="Menlo, Operator Mono, Consolas, Monaco, monospace",c=function(e,t){return Object.assign({},e,t)};this.buildTheme=function(e){var t={},n=c(e.BASE,{"font-family":o.opts.fonts,"font-size":o.opts.size}),i=c(n,{});for(var r in e.inline)if(e.inline.hasOwnProperty(r)){var a=e.inline[r];t[r]=c(n,a)}for(var l in e.block)if(e.block.hasOwnProperty(l)){var u=e.block[l];"code"===l&&(u["font-family"]=s),t[l]=c(i,u)}return t};var l=function(e,t){var o=[],n=a[e];if(!n)return"";for(var i in n)o.push(i+":"+n[i]);return'style="'.concat(o.join(";")+(t||""),'"')},u=function(e,t){return i.push([++r,e,t]),r};this.buildFootnotes=function(){var e=i.map((function(e){return e[1]===e[2]?'<code style="font-size: 90%; opacity: 0.6;">['.concat(e[0],"]</code>: <i>").conc
|