← Back
Editing: index-legacy140.js
!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function r(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?t(Object(o),!0).forEach((function(t){n(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function n(t,r,n){return(r=function(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return r};var t,r={},n=Object.prototype,a=n.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(t){f=function(e,t,r){return e[t]=r}}function v(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),u=new _(n||[]);return i(a,"_invoke",{value:k(e,r,u)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=v;var p="suspendedStart",d="suspendedYield",y="executing",g="completed",m={};function b(){}function w(){}function x(){}var O={};f(O,c,(function(){return this}));var P=Object.getPrototypeOf,j=P&&P(P(B([])));j&&j!==n&&a.call(j,c)&&(O=j);var S=x.prototype=b.prototype=Object.create(O);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function E(t,r){function n(o,i,u,c){var l=h(t[o],t,i);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==e(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,u,c)}),(function(e){n("throw",e,u,c)})):r.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return n("throw",e,u,c)}))}c(l.arg)}var o;i(this,"_invoke",{value:function(e,t){function a(){return new r((function(r,o){n(e,t,r,o)}))}return o=o?o.then(a,a):a()}})}function k(e,r,n){var o=p;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===g){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=q(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?g:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function q(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,q(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var a=h(o,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,m;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function V(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(V,this),this.reset(!0)}function B(r){if(r||""===r){var n=r[c];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(a.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(e(r)+" is not iterable")}return w.prototype=x,i(S,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},r.awrap=function(e){return{__await:e}},L(E.prototype),f(E.prototype,l,(function(){return this})),r.AsyncIterator=E,r.async=function(e,t,n,o,a){void 0===a&&(a=Promise);var i=new E(v(e,t,n,o),a);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},L(S),f(S,s,"Generator"),f(S,c,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=B,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=a.call(i,"catchLoc"),l=a.call(i,"finallyLoc");if(c&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:B(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},r}function a(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}System.register(["./ace-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER"],(function(e,t){"use strict";var n,a,u,c,l,s,f,v,h,p,d,y,g;return{setters:[null,function(e){n=e.bS,a=e.bT,u=e.b},function(e){c=e.c,l=e.t,s=e.r,f=e.U,v=e.w,h=e.p,p=e.n,d=e.e,y=e.m,g=e.a5}],execute:function(){var t=u(),m=t.load,b=t.request;e("B",c({name:"BtAceEditor",props:{modelValue:{type:String,default:""},isZoom:{type:Boolean,default:!1},isScrollBottom:{type:Boolean,default:!1},filePath:{type:String,default:""},request:{type:[Object,Boolean],default:!1},encoding:{type:String,default:"utf-8"},autoSave:{type:Boolean,default:!1},editorOption:{type:Object,default:function(){return{}}}},emits:["update:modelValue","save"],setup:function(e,t){var c=t.attrs,w=t.emit,x=l(e),O=x.modelValue,P=x.editorOption,j=s("file"),S=s(),L=f(),E=s(!1),k={theme:"ace/theme/chrome",mode:"ace/mode/nginx",wrap:!0,showInvisibles:!1,showFoldWidgets:!1,useSoftTabs:!0,tabSize:2,showPrintMargin:!1,readOnly:!1,fontSize:"12px"},q=s(!1),V=u();v((function(){return O.value}),(function(t){if(L.value){if(E.value)return void(E.value=!1);try{var r;L.value.getValue()!==O.value&&(L.value.setValue(t||""),L.value.moveCursorTo(0,0)),e.isScrollBottom&&null!==(r=L.value.renderer)&&void 0!==r&&null!==(r=r.scrollBar)&&void 0!==r&&r.scrollHeight&&setTimeout((function(){L.value&&L.value.getSession().setScrollTop(L.value.renderer.scrollBar.scrollHeight)}),50)}catch(n){}}})),v((function(){return e.filePath}),(function(t,r){t!==r&&L.value&&(T(),"model"!==j.value&&N({filePath:t,request:e.request}))})),v((function(){return e.request}),(function(t,r){t!==r&&L.value&&(T(),"request"===j.value&&N({filePath:e.filePath,request:t}))}),{deep:!0});var T=function(){var t,r;""!==e.filePath?j.value="file":null!=e&&null!==(t=e.request)&&void 0!==t&&t.get&&null!=e&&null!==(r=e.request)&&void 0!==r&&r.set?j.value="request":j.value="model"},_=function(){var t=i(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p();case 2:!S.value||L.value&&L.value.container||B(!0)&&("model"!==j.value?N({filePath:e.filePath,request:e.request}):L.value&&(L.value.setValue(O.value||""),p((function(){L.value&&(L.value.focus(),L.value.moveCursorTo(0,0))}))));case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),B=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{if(!S.value)return!1;if(L.value&&L.value.container&&L.value.container.parentNode)return!0;if(!t){var n=S.value.getBoundingClientRect();if(0===n.width||0===n.height)return!1}S.value.innerHTML="",window.ace.config.set("basePath","/static/editor/");var o=window.ace.edit(S.value,r(r({},g(k)),P.value));return o.commands.addCommand({name:"保存文件",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:function(){w("save",o.getValue()),e.autoSave&&C({filePath:e.filePath,request:e.request,encoding:e.encoding})},readOnly:!1}),o.getSession().on("change",(function(){w("update:modelValue",o.getValue())})),L.value=o,!0}catch(a){return L.value=null,!1}},N=function(){var e=i(o().mark((function e(t){var r,a,i,u,c,l,s,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.filePath,a=t.request,i=m("正在加载文件内容,请稍后..."),e.prev=2,L.value){e.next=6;break}return e.abrupt("return");case 6:if("file"!==j.value){e.next=13;break}return e.next=9,n({path:r});case 9:(u=e.sent).status?(c=u.data,l=c&&c.data||"",L.value.setValue(l)):b(u),e.next=23;break;case 13:if("request"!==j.value){e.next=21;break}return e.next=16,a.get();case 16:s=e.sent,f=s.data,L.value.setValue(f||""),e.next=23;break;case 21:E.value=!0,w("update:modelValue",L.value.getValue());case 23:p((function(){L.value&&(L.value.focus(),L.value.moveCursorTo(0,0))})),e.next=29;break;case 26:e.prev=26,e.t0=e.catch(2);case 29:return e.prev=29,i.close(),e.finish(29);case 32:case"end":return e.stop()}}),e,null,[[2,26,29,32]])})));return function(t){return e.apply(this,arguments)}}(),C=function(){var e=i(o().mark((function e(t){var r,n,i,u,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.filePath,n=t.request,i=t.encoding,u=V.load("正在保存文件,请稍后..."),e.prev=2,"file"!==j.value){e.next=10;break}return e.next=6,a({path:r,encoding:i,data:L.value.getValue()});case 6:c=e.sent,V.request(c),e.next=18;break;case 10:if("request"!==j.value){e.next=17;break}return e.next=13,n.set({data:L.value.getValue(),encoding:i});case 13:l=e.sent,V.request(l),e.next=18;break;case 17:w("save",L.value.getValue());case 18:e.next=23;break;case 20:e.prev=20,e.t0=e.catch(2),V.error(e.t0);case 23:return e.prev=23,u.close(),e.finish(23);case 26:case"end":return e.stop()}}),e,null,[[2,20,23,26]])})));return function(t){return e.apply(this,arguments)}}(),G=function(){q.value=!q.value};return h(i(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,p();case 2:return T(),B(),t.next=6,p();case 6:"model"!==j.value?N({filePath:e.filePath,request:e.request}):L.value&&(L.value.setValue(O.value||""),p((function(){L.value&&(L.value.focus(),L.value.moveCursorTo(0,0))}))),S.value&&window.ResizeObserver&&new ResizeObserver((function(e){e.forEach((function(e){var t=e.contentRect,r=t.width,n=t.height;!(r>0&&n>0)||L.value&&L.value.container?L.value&&r>0&&n>0&&L.value.resize():_()}))})).observe(S.value);case 8:case"end":return t.stop()}}),t)})))),function(){return d("div",{class:"ace-editor-content h-full relative"},[d("div",y({class:"ace-editor "+(e.isZoom,""),style:"height:100%",ref:S},c),null),e.isZoom?d("div",{class:"absolute right-0 top-0 icon-zoom",title:e.isZoom?"全屏显示":"退出全屏",onClick:G},null):null])}}}))}}}))}();
Save File
Cancel