mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 18:02:55 +00:00
2 lines
5.3 KiB
JavaScript
Vendored
2 lines
5.3 KiB
JavaScript
Vendored
import{m as h}from"./vuex.cc7cb26e.js";import{n as p}from"./app.befdac39.js";import"./@micro-zoe.c2e1472d.js";import"./jquery.5afcbe3d.js";import"./@traptitech.b6e72224.js";import"./katex.9792db63.js";import"./localforage.25a6b490.js";import"./markdown-it.28fd7f10.js";import"./entities.797c3e49.js";import"./uc.micro.39573202.js";import"./mdurl.2f66c031.js";import"./linkify-it.3ecfda1e.js";import"./punycode.b7e94e71.js";import"./highlight.js.24fdca15.js";import"./markdown-it-link-attributes.e1d5d151.js";import"./vue.ea2bb532.js";import"./axios.6ec123f8.js";import"./le5le-store.b40f9152.js";import"./openpgp_hi.15f91b1d.js";import"./vue-router.2d566cd7.js";import"./vue-clipboard2.f62d09e0.js";import"./clipboard.13c9d2be.js";import"./view-design-hi.3da58854.js";import"./default-passive-events.a3d698c9.js";import"./vuedraggable.4bb621b8.js";import"./sortablejs.88918bd7.js";import"./vue-resize-observer.eb9dc3d4.js";import"./element-sea.faaf089e.js";import"./deepmerge.cecf392e.js";import"./resize-observer-polyfill.88ee0e7b.js";import"./throttle-debounce.7c3948b2.js";import"./babel-helper-vue-jsx-merge-props.5ed215c3.js";import"./normalize-wheel.2a034b9f.js";import"./async-validator.45b57f96.js";import"./babel-runtime.4773988a.js";import"./core-js.314b4a1d.js";const l={name:"AceEditor",props:{value:{default:""},options:{type:Object,default:()=>({})},theme:{type:String,default:"auto"},ext:{type:String,default:"txt"},height:{type:Number||null,default:null},width:{type:Number||null,default:null},wrap:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1}},render(e){return e("div",{class:"no-dark-content"})},data:()=>({code:"",editor:null,cursorPosition:{row:0,column:0},supportedModes:{Apache_Conf:["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],BatchFile:["bat|cmd"],C_Cpp:["cpp|c|cc|cxx|h|hh|hpp|ino"],CSharp:["cs"],CSS:["css"],Dockerfile:["^Dockerfile"],golang:["go|golang"],HTML:["html|htm|xhtml|vue|we|wpy"],Java:["java"],JavaScript:["js|jsm|jsx"],JSON:["json"],JSP:["jsp"],LESS:["less"],Lua:["lua"],Makefile:["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],Markdown:["md|markdown"],MySQL:["mysql"],Nginx:["nginx|conf"],INI:["ini|conf|cfg|prefs"],ObjectiveC:["m|mm"],Perl:["pl|pm"],Perl6:["p6|pl6|pm6"],pgSQL:["pgsql"],PHP_Laravel_blade:["blade.php"],PHP:["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],Powershell:["ps1"],Python:["py"],R:["r"],Ruby:["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],Rust:["rs"],SASS:["sass"],SCSS:["scss"],SH:["sh|bash|^.bashrc"],SQL:["sql"],SQLServer:["sqlserver"],Swift:["swift"],Text:["txt"],Typescript:["ts|typescript|str"],VBScript:["vbs|vb"],Verilog:["v|vh|sv|svh"],XML:["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml|plist"],YAML:["yaml|yml"],Compress:["tar|zip|7z|rar|gz|arj|z"],images:["icon|jpg|jpeg|webp|png|bmp|gif|tif|emf"]}}),mounted(){$A.loadScriptS(["js/ace/ace.js","js/ace/mode-json.js"]).then(e=>{this.setSize(this.$el,{height:this.height,width:this.width}),this.editor=window.ace.edit(this.$el,{wrap:this.wrap,showPrintMargin:!1,readOnly:this.readOnly,keyboardHandler:"vscode"}),this.editor.session.setMode(`ace/mode/${this.getFileMode()}`),this.$emit("mounted",this.editor),this.editor.session.$worker&&this.editor.session.$worker.addEventListener("annotate",this.workerMessage,!1),this.setValue(this.value),this.editor.setOptions(this.options),this.editTheme&&this.editor.setTheme(`ace/theme/${this.editTheme}`),this.editor.commands.addCommand({name:"\u4FDD\u5B58\u6587\u4EF6",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:()=>{this.$emit("saveData")},readOnly:!1}),this.editor.getSession().on("change",()=>{this.code=this.editor.getValue(),this.$emit("input",this.code)})})},methods:{workerMessage({data:e}){this.cursorPosition=this.editor.selection.getCursor();const[t]=e;t&&t.type==="error"?this.$emit("validationFailed",t):this.$emit("change",this.editor.getValue())},setSize(e,{width:t=this.width,height:i=this.height}){e.style.width=t&&typeof t=="number"?`${t}px`:"100%",e.style.height=i&&typeof i=="number"?`${i}px`:"100%",this.$nextTick(()=>this.editor&&this.editor.resize())},setValue(e){typeof e=="string"&&this.editor&&(this.editor.setValue(e),this.editor.clearSelection())},getFileMode(){var e=this.ext||"text";for(var t in this.supportedModes)for(var i=this.supportedModes[t],r=i[0].split("|"),a=t.toLowerCase(),s=0;s<r.length;s++)if(e==r[s])return a;return"text"}},computed:{...h(["themeName"]),editTheme(){return this.theme=="auto"?this.themeName==="dark"?"dracula-dark":"chrome":this.theme}},watch:{options(e){e&&typeof e=="object"&&this.editor&&this.editor.setOptions(e)},editTheme(e){e&&typeof e=="string"&&this.editor&&this.editor.setTheme(`ace/theme/${e}`)},ext(e){e&&typeof e=="string"&&this.editor&&this.editor.session.setMode(`ace/mode/${this.getFileMode()}`)},width(e){this.setSize(this.el,{width:e})},height(e){this.setSize(this.el,{height:e})},readOnly(e){typeof e=="boolean"&&this.editor&&this.editor.setReadOnly(e)},value(e){if(!this.editor||e==this.code)return;this.setValue(e);const{row:t,column:i}=this.cursorPosition;this.editor.selection.moveCursorTo(t,i)}},beforeDestroy(){this.editor&&(this.editor.session.$worker&&this.editor.session.$worker.removeEventListener("message",this.workerMessage,!1),this.editor.destroy(),this.editor.container.remove())}};let m,d;const o={};var n=p(l,m,d,!1,c,null,null,null);function c(e){for(let t in o)this[t]=o[t]}var X=function(){return n.exports}();export{X as default};
|