mirror of
https://github.com/doocs/md.git
synced 2024-11-28 13:36:32 +08:00
4 lines
73 KiB
JavaScript
4 lines
73 KiB
JavaScript
|
(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(r,a)&&r[a]&&f.push(r[a][0]),r[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 i.push.apply(i,l||[]),o()}function o(){for(var e,t=0;t<i.length;t++){for(var o=i[t],n=!0,c=1;c<o.length;c++){var s=o[c];0!==r[s]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=o[0]))}return e}var n={},r={app:0},i=[];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;i.push([0,"chunk-vendors"]),o()})({0:function(e,t,o){e.exports=o("56d7")},"0518":function(e,t,o){"use strict";o("9a2f")},1:function(e,t){},10:function(e,t){},11:function(e,t){},"119a":function(e,t,o){},"11ef":function(e,t,o){"use strict";o("695a")},12:function(e,t){},13:function(e,t){},14:function(e,t){},2:function(e,t){},3:function(e,t){},"3a5e":function(e,t,o){"use strict";var n=o("aae9"),r=o("cb57"),i=(o("11ef"),o("2877")),a=Object(i["a"])(r["default"],n["a"],n["b"],!1,null,"a205efe8",null);t["default"]=a.exports},4:function(e,t){},5:function(e,t){},"536a":function(e,t,o){},"537d":function(e,t,o){"use strict";o("6396")},"56d7":function(e,t,o){"use strict";o.r(t);var n=o("5530"),r=(o("e260"),o("e6cf"),o("cca6"),o("a79d"),o("2b0e")),i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{attrs:{id:"app"}},[o("router-view")],1)},a=[],c=(o("7c55"),o("94fb"),o("2877")),s={},l=Object(c["a"])(s,i,a,!1,null,null,null),u=l.exports,d=(o("ac1f"),o("5319"),o("2f62")),f={builtinFonts:[{label:"无衬线",value:"-apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif"},{label:"衬线",value:"Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif"}],sizeOption:[{label:"12px",value:"12px",desc:"更小"},{label:"13px",value:"13px",desc:"稍小"},{label:"14px",value:"14px",desc:"推荐"},{label:"15px",value:"15px",desc:"稍大"},{label:"16px",value:"16px",desc:"更大"}],colorOption:[{label:"经典蓝",value:"rgba(15, 76, 129, 1)",desc:"最新流行"},{label:"翡翠绿",value:"rgba(0, 152, 116, 1)",desc:"优雅清新"},{label:"活力橘",value:"rgba(250, 81, 81, 1)",desc:"热情活泼"}],codeThemeOption:[{label:"微信",value:"wechat",desc:"默认样式"},{label:"GitHub",value:"github",desc:"精简风格"}],form:{rows:1,cols:1}},m=o("d4ec"),p=(o("a15b"),o("d81d"),o("99af"),o("c975"),o("1276"),o("2ca0"),o("0e54")),g=o.n(p),h=function e(t){var o=this;Object(m["a"])(this,e),this.opts=t;var n=!0,r=[],i=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});for(var r in e.inline)if(e.inline.hasOwnProperty(r)){var i=e.inline[r];t[r]=s(e.BASE,i)}var a=s(n,{});for(var l in e.block)if(e.block.hasOwnProperty(l)){var u=e.block[l];"code"===l&&(u["font-family"]=c),t[l]=s(a,u)}return t};var l=function(e,t){var o=[],n=a[e];if(!n)return"";for(var
|
|||
|
//!影响到右键菜单的点击事件,右键菜单的点击事件在组件内通过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(),q(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=N(this.cssEditor.getValue(0)),t=H(this.currentSize.replace("px",""));t=z(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},beforeUpload:function(e){var t=Q(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")),r="default"==o||n;return!!r||(this.$message.error("请先配置 ".concat(o," 图床参数")),!1)},uploadImage:function(e){var t=this;this.isImgLoading=!0,P(e).then((function(o){Et.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 r,i;clearTimeout(e.timeout),"preview"===t?(r=e.$refs.preview.$el,i=document.getElementsByClassName("CodeMirror-scroll")[0],e.editor.off("scroll",o),e.timeout=setTimeout((function(){e.editor.on("scroll",o)}),300)):"editor"===t&&(r=document.getElementsByClassName("CodeMirror-scroll")[0],i=e.$refs.preview.$el,i.removeEventListener("scroll",n,!1),e.timeout=setTimeout((function(){i.addEventListener("scroll",n,!1)}),300));var a=r.scrollTop/(r.scrollHeight-r.offsetHeight),c=a*(i.scrollHeight-i.offsetHeight);i.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(){K(this.editor.getValue(0))},exportEditorContent:function(){this.$nextTick((function(){L()}))},importMarkdownContent:function(){var e=this,t=document.getElementById("menu"),o=document.createElement("input");o.type="file",o.name="filename",o.accept=".txt,.md",t.appendChild(o),o.onchange=function(){if(o.files){var t=o.files[0];if(/\.(txt|TXT|MD|md)$/.test(t.name)){var n=new FileReader;n.readAsText(t),n.onload=function(t){var o=t.target.result;o=D(o),o&&(localStorage.setItem("__editor_content",o),e.editor.setValue(o),e.$message.success("文档导入成功"))}}else e.$message.error("不支持的文档格式")}},o.click(),t.removeChild(o)},formatContent:function(){var e=D(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,r=n-t,i=e.clientX-o;this.mouseLeft=Math.min(r,i),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"export":this.exportEditorContent();break;case"insertTable":this.dialogFormVisible=!0;break;case"importMarkdown":this.importMarkdownContent();break;case"formatMarkdown":this.formatContent();break;default:break}}},Object(d["b"])(["initEditorState","initEditorEntity","setWxRendererOptions","editorRefresh","initCssEditorEntity"])),mounted:function(){var e=this;setTimeout((function(){e.leftAndRightScroll(),PR.prettyPrint()}),300)}},I
|
|||
|
//# sourceMappingURL=app.55eacff9.js.map
|