md/js/app.7186de00.js

4 lines
71 KiB
JavaScript
Raw Normal View History

(function(e){function t(t){for(var n,a,c=t[0],s=t[1],l=t[2],d=0,f=[];d<c.length;d++)a=c[d],Object.prototype.hasOwnProperty.call(i,a)&&i[a]&&f.push(i[a][0]),i[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[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,c=1;c<o.length;c++){var s=o[c];0!==i[s]&&(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 c=window["webpackJsonp"]=window["webpackJsonp"]||[],s=c.push.bind(c);c.push=t,c=c.slice();for(var l=0;l<c.length;l++)t(c[l]);var u=s;r.push([0,"chunk-vendors"]),o()})({0:function(e,t,o){e.exports=o("56d7")},"0816":function(e,t,o){"use strict";o("156c")},"0a06":function(e,t,o){"use strict";o("d91e")},1:function(e,t){},10:function(e,t){},11:function(e,t){},12:function(e,t){},13:function(e,t){},14:function(e,t){},15:function(e,t){},"156c":function(e,t,o){},2:function(e,t){},2530:function(e,t,o){},"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){},"4c45":function(e,t,o){},"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"),c=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},"show-dialog-form":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.source=t.target.value)}}})]),o("el-col",{ref:"preview",staticClass:"p
//!影响到右键菜单的点击事件右键菜单的点击事件在组件内通过mousedown触发
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=w(this.currentSize.replace("px",""));t=O(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},beforeUpload:function(e){var t=A(e);if(!t.ok)return this.$message.error(t.msg),!1;var o=localStorage.getItem("imgHost");o=o||"default",localStorage.setItem("imgHost",o);var n=localStorage.getItem("".concat(o,"Config")),i="default"==o||n;return!!i||(this.$message.error("请先配置 ".concat(o," 图床参数")),!1)},uploadImage:function(e){var t=this;this.isImgLoading=!0,M(e).then((function(o){rt.fileUpload(o,e).then((function(e){t.uploaded(e)})).catch((function(e){t.$message.error(e.message)}))})).catch((function(e){t.$message.error(e.message)})),this.isImgLoading=!1},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.success("图片上传成功"),this.onEditorRefresh()}else this.$message.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),c=a*(r.scrollHeight-r.offsetHeight);r.scrollTo(0,c)},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=I(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(B["b"])(["initEditorState","initEditorEntity","setWxRendererOptions","editorRefresh","initCssEditorEntity"])),mounted:function(){var e=this;setTimeout((function(){e.leftAndRightScroll(),PR.prettyPrint()}),300)}},ct=at,st=(o("6daa"),o("85fe"),Object(Q["a"])(ct,c,s,!1,null,"107b45b4",null)),lt=st.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(Q["a"])(dt,i,r,!1,null,"f01d475a",null)),mt=ft.exports,pt=(o("2ca0"),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,c="Menlo, Operator Mono, Consolas, Monaco, monospace",s=function(e,t){return Object.assign({},e,t)};this.buildTheme=function(e){var t={},n=s(e.BASE,{"font-family":o.opts.fonts,"font-size":o.opts.size}),i=s(n,{});for(var r in
//# sourceMappingURL=app.7186de00.js.map