md/js/app.e8e970b2.js

4 lines
83 KiB
JavaScript
Raw Normal View History

(function(e){function t(t){for(var r,a,s=t[0],c=t[1],l=t[2],d=0,_=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&_.push(n[a][0]),n[a]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);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],r=!0,s=1;s<o.length;s++){var c=o[s];0!==n[c]&&(r=!1)}r&&(i.splice(t--,1),e=a(a.s=o[0]))}return e}var r={},n={app:0},i=[];function a(t){if(r[t])return r[t].exports;var o=r[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=r,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 r in e)a.d(o,r,function(t){return e[t]}.bind(null,r));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")},"0518":function(e,t,o){"use strict";o("991e")},"08bb":function(e,t,o){},1:function(e,t){},"11ef":function(e,t,o){"use strict";o("8c0a")},2395:function(e,t,o){},"3a5e":function(e,t,o){"use strict";var r=o("aae9"),n=o("cb57"),i=(o("11ef"),o("2877")),a=Object(i["a"])(n["default"],r["a"],r["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_string_pad_start_js__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("4d90"),core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(core_js_modules_es_string_pad_start_js__WEBPACK_IMPORTED_MODULE_5__),core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("d3b7"),core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6___default=__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_6__),core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("25f0"),core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7___default=__webpack_require__.n(core_js_modules_es_regexp_to_string_js__WEBPACK_IMPORTED_MODULE_7__),core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("99af"),core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODU
//!影响到右键菜单的点击事件右键菜单的点击事件在组件内通过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(),K(e.cssEditor,"__css_content")}))},cssChanged:function(){var e=U(this.cssEditor.getValue(0)),t=A(this.currentSize.replace("px",""));t=R(e,this.currentColor,t),this.setWxRendererOptions({theme:t}),this.onEditorRefresh()},beforeUpload:function(e){var t=H(e);if(!t.ok)return this.$message.error(t.msg),!1;var o=localStorage.getItem("imgHost");o=o||"default",localStorage.setItem("imgHost",o);var r=localStorage.getItem("".concat(o,"Config")),n="default"==o||r;return!!n||(this.$message.error("请先配置 ".concat(o," 图床参数")),!1)},uploadImage:function(e){var t=this;this.isImgLoading=!0,F(e).then((function(o){ze["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,r="![](".concat(o,")");this.editor.replaceSelection("\n".concat(r,"\n"),t),this.$message.success("图片上传成功"),this.onEditorRefresh()}else this.$message.error("上传图片未知异常")},leftAndRightScroll:function(){var e=this,t=function(t){var n,i;clearTimeout(e.timeout),"preview"===t?(n=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&&(n=document.getElementsByClassName("CodeMirror-scroll")[0],i=e.$refs.preview.$el,i.removeEventListener("scroll",r,!1),e.timeout=setTimeout((function(){i.addEventListener("scroll",r,!1)}),300));var a=n.scrollTop/(n.scrollHeight-n.offsetHeight),s=a*(i.scrollHeight-i.offsetHeight);i.scrollTo(0,s)},o=function(){t("editor")},r=function(){t("preview")};this.$refs.preview.$el.addEventListener("scroll",r,!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(){q(this.editor.getValue(0))},exportEditorContent:function(){this.$nextTick((function(){G()}))},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 r=new FileReader;r.readAsText(t),r.onload=function(t){var o=t.target.result;o=L(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=L(this.editor.getValue(0));localStorage.setItem("__editor_content",e),this.editor.setValue(e)},openMenu:function(e){var t=105,o=this.$el.getBoundingClientRect().left,r=this.$el.offsetWidth,n=r-t,i=e.clientX-o;this.mouseLeft=Math.min(n,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
//# sourceMappingURL=app.e8e970b2.js.map