md/js/app.2ee3bfa7.js

3 lines
86 KiB
JavaScript
Raw Normal View History

(function(e){function t(t){for(var n,a,s=t[0],c=t[1],l=t[2],d=0,_=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&_.push(r[a][0]),r[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);u&&u(t);while(_.length)_.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,s=1;s<o.length;s++){var c=o[s];0!==r[c]&&(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 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;i.push([0,"chunk-vendors"]),o()})({0:function(e,t,o){e.exports=o("56d7")},1:function(e,t){},"115d":function(e,t,o){},"11ef":function(e,t,o){"use strict";o("8c0a")},1280:function(e,t,o){"use strict";o("115d")},2395:function(e,t,o){},"2b77":function(e,t,o){},"37e4":function(e,t,o){},"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},"3ea0":function(e,t,o){},"3f5e":function(module,__webpack_exports__,__webpack_require__){"use strict";var _home_runner_work_md_md_node_modules_babel_runtime_helpers_esm_asyncToGenerator_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("1da1"),regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("96cf"),regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_1__),core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("ac1f"),core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_2__),core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("5319"),core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_3__),core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("1276"),core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__),core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("0d03"),core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(core_js_modules_es_date_to_string_js__WEBPACK_IMPORTED_MODULE_5__),core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("4d90"),core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_6__),core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("d401"),core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(core_js_modules_es_error_to_string_js__WEBPACK_IMPORTED_MODULE_7__),core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("d3b7"),core_js_module
//!影响到右键菜单的点击事件右键菜单的点击事件在组件内通过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(),$(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=B(this.cssEditor.getValue(0)),t=K(this.currentSize.replace("px",""));t=L(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},codeThemeChanged:function(){var e=this.codeTheme,t=document.getElementById("hljs");if(void 0!=t)t.setAttribute("href",e);else{var o=document.createElement("link");o.setAttribute("type","text/css"),o.setAttribute("rel","stylesheet"),o.setAttribute("href",e),o.setAttribute("id","hljs"),document.head.appendChild(o)}},beforeUpload:function(e){var t=N(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,H(e).then((function(o){Ve["a"].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),s=a*(i.scrollHeight-i.offsetHeight);i.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.codeThemeChanged(this.codeTheme),this.editorRefresh(),setTimeout((function(){return PR.prettyPrint()}),0)},endCopy:function(){var e=this;this.backLight=!1,setTimeout((function(){e.isCoping=!1}),800)},downloadEditorContent:function(){G(this.editor.getValue(0))},exportEditorContent:function(){this.$nextTick((function(){F()}))},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=q(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=q(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"resetStyle":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.di