From e810eb4a1451b111e7a8bbca98c46ae82a31ce89 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Fri, 22 May 2020 18:27:14 +0200 Subject: [PATCH] update markon --- MarkOn/build/debug/main.js | 2 +- MarkOn/build/debug/package.json | 2 +- MarkOn/build/release/MarkOn.zip | Bin 4474 -> 4486 bytes MarkOn/main.coffee | 6 ++++-- MarkOn/package.json | 2 +- packages.json | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/MarkOn/build/debug/main.js b/MarkOn/build/debug/main.js index 0468577..8475711 100644 --- a/MarkOn/build/debug/main.js +++ b/MarkOn/build/debug/main.js @@ -1 +1 @@ -(function(){var e;(e=class extends this.OS.GUI.BaseApplication{constructor(e){super("MarkOn",e)}main(){var e;return e=this.find("markarea"),this.container=this.find("mycontainer"),this.previewOn=!1,this.args&&this.args.length>0?this.currfile=this.args[0].path.asFileHandle():this.currfile="Untitled".asFileHandle(),this.editormux=!1,this.editor=new SimpleMDE({element:e,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:["bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|",{name:"preview",className:"fa fa-eye no-disable",action:e=>(this.previewOn=!this.previewOn,SimpleMDE.togglePreview(e))}]}),this.editor.codemirror.on("change",()=>{if(!this.editormux)return!1===this.currfile.dirty?(this.currfile.dirty=!0,this.scheme.set("apptitle",this.currfile.basename+"*")):void 0}),this.on("hboxchange",e=>this.resizeContent()),this.bindKey("ALT-N",()=>this.actionFile(this.name+"-New")),this.bindKey("ALT-O",()=>this.actionFile(this.name+"-Open")),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas")),this.resizeContent(),this.open(this.currfile)}resizeContent(){var e,t,i,s,a;return t=$(this.container).children(),s=$(this.scheme).find(".afx-window-top")[0],a=t[1],i=t[4],e=$(this.scheme).height()-$(s).height()-$(a).height()-$(i).height()-40,$(t[2]).css("height",e+"px")}open(e){if("Untitled"!==e.path)return e.dirty=!1,e.read().then(t=>(this.currfile=e,this.editormux=!0,this.editor.value(t),this.scheme.set("apptitle",""+this.currfile.basename),this.editormux=!1)).catch(t=>this.error(__("Unable to open: {0}",e.path),t))}save(e){return e.write("text/plain").then(t=>t.error?this.error(__("Error saving file {0}: {1}",e.basename,t.error)):(e.dirty=!1,e.text=e.basename,this.scheme.set("apptitle",""+this.currfile.basename))).catch(t=>this.error(__("Unable to save file: {0}",e.path),t))}menu(){return[{text:"__(File)",child:[{text:"__(New)",dataid:this.name+"-New",shortcut:"A-N"},{text:"__(Open)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:e=>this.actionFile(e.data.item.get("data").dataid)}]}actionFile(e){var t;switch(t=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(e=>{var t;return t=e.file.path.asFileHandle(),"file"===e.file.type&&(t=t.parent()),this.currfile.setPath(`${t.path}/${e.name}`),this.save(this.currfile)}),e){case this.name+"-Open":return this.openDialog("FileDialog",{title:__("Open file")}).then(e=>this.open(e.file.path.asFileHandle()));case this.name+"-Save":return this.currfile.cache=this.editor.value(),this.currfile.basename?this.save(this.currfile):t();case this.name+"-Saveas":return this.currfile.cache=this.editor.value(),t();case this.name+"-New":return this.currfile="Untitled".asFileHandle(),this.currfile.cache="",this.editor.value("")}}cleanup(e){if(this.currfile.dirty)return e.preventDefault(),this.openDialog("YesNoDialog",e=>{if(e)return this.currfile.dirty=!1,this.quit()},__("Quit"),{text:__("Quit without saving ?")})}}).dependencies=["os://scripts/mde/simplemde.min.js","os://scripts/mde/simplemde.min.css"],this.OS.register("MarkOn",e)}).call(this); \ No newline at end of file +(function(){var e;(e=class extends this.OS.GUI.BaseApplication{constructor(e){super("MarkOn",e)}main(){var e;return e=this.find("markarea"),this.container=this.find("mycontainer"),this.previewOn=!1,this.args&&this.args.length>0?this.currfile=this.args[0].path.asFileHandle():this.currfile="Untitled".asFileHandle(),this.editormux=!1,this.editor=new SimpleMDE({element:e,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:["bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule","|",{name:"preview",className:"fa fa-eye no-disable",action:e=>(this.previewOn=!this.previewOn,SimpleMDE.togglePreview(e))}]}),this.editor.codemirror.on("change",()=>{if(!this.editormux)return!1===this.currfile.dirty?(this.currfile.dirty=!0,this.scheme.set("apptitle",this.currfile.basename+"*")):void 0}),this.on("hboxchange",e=>this.resizeContent()),this.bindKey("ALT-N",()=>this.actionFile(this.name+"-New")),this.bindKey("ALT-O",()=>this.actionFile(this.name+"-Open")),this.bindKey("CTRL-S",()=>this.actionFile(this.name+"-Save")),this.bindKey("ALT-W",()=>this.actionFile(this.name+"-Saveas")),this.resizeContent(),this.open(this.currfile)}resizeContent(){var e,t,i,s,a;return t=$(this.container).children(),s=$(this.scheme).find(".afx-window-top")[0],a=t[1],i=t[4],e=$(this.scheme).height()-$(s).height()-$(a).height()-$(i).height()-40,$(t[2]).css("height",e+"px")}open(e){if("Untitled"!==e.path)return e.dirty=!1,e.read().then(t=>(this.currfile=e,this.editormux=!0,this.editor.value(t),this.scheme.set("apptitle",""+this.currfile.basename),this.editormux=!1)).catch(t=>this.error(__("Unable to open: {0}",e.path),t))}save(e){return e.write("text/plain").then(t=>t.error?this.error(__("Error saving file {0}: {1}",e.basename,t.error)):(e.dirty=!1,e.text=e.basename,this.scheme.set("apptitle",""+this.currfile.basename))).catch(t=>this.error(__("Unable to save file: {0}",e.path),t))}menu(){return[{text:"__(File)",child:[{text:"__(New)",dataid:this.name+"-New",shortcut:"A-N"},{text:"__(Open)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Save)",dataid:this.name+"-Save",shortcut:"C-S"},{text:"__(Save as)",dataid:this.name+"-Saveas",shortcut:"A-W"}],onchildselect:e=>this.actionFile(e.data.item.get("data").dataid)}]}actionFile(e){var t;switch(t=()=>this.openDialog("FileDialog",{title:__("Save as"),file:this.currfile}).then(e=>{var t;return t=e.file.path.asFileHandle(),"file"===e.file.type&&(t=t.parent()),this.currfile.setPath(`${t.path}/${e.name}`),this.save(this.currfile)}),e){case this.name+"-Open":return this.openDialog("FileDialog",{title:__("Open file")}).then(e=>this.open(e.file.path.asFileHandle()));case this.name+"-Save":return this.currfile.cache=this.editor.value(),this.currfile.basename?this.save(this.currfile):t();case this.name+"-Saveas":return this.currfile.cache=this.editor.value(),t();case this.name+"-New":return this.currfile="Untitled".asFileHandle(),this.currfile.cache="",this.editor.value("")}}cleanup(e){if(this.currfile.dirty)return e.preventDefault(),this.openDialog("YesNoDialog",{title:__("Quit"),text:__("Quit without saving ?")}).then(e=>{if(e)return this.currfile.dirty=!1,this.quit()})}}).dependencies=["os://scripts/mde/simplemde.min.js","os://scripts/mde/simplemde.min.css"],this.OS.register("MarkOn",e)}).call(this); \ No newline at end of file diff --git a/MarkOn/build/debug/package.json b/MarkOn/build/debug/package.json index 2048972..d5a395a 100644 --- a/MarkOn/build/debug/package.json +++ b/MarkOn/build/debug/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.0.2-a", + "version":"0.0.3-a", "category":"Utils", "iconclass":"fa fa-leanpub", "mimes":["text/.*"] diff --git a/MarkOn/build/release/MarkOn.zip b/MarkOn/build/release/MarkOn.zip index 614070b0b158993e6218dc2f75a3d8b90ed61fc1..6d4857278d0a05e10ac88ca6940a5f99c3ddd197 100644 GIT binary patch delta 177 zcmeyR)TYc6;LXg!#Q*|<%^P{d7?}c_C#x_W)0gwv;e>64; delta 207 zcmZou{-wkd;LXg!#Q*|)O&fW{7@7E*CaW+;fT%jgT3)`UZ2`OHZ5MmN!@%%jGY1nN z&*T6;V_u#3cnzh%(##SiO`Yn=8hlEVTlgk$fE1rt@ls{74F7XRqsc4+$sl7g1 return unless @currfile.dirty evt.preventDefault() - @.openDialog "YesNoDialog", (d) => + @.openDialog("YesNoDialog", { + title: __("Quit"), + text: __("Quit without saving ?") + }).then (d) => if d @currfile.dirty = false @quit() - , __("Quit"), { text: __("Quit without saving ?") } MarkOn.dependencies = [ "os://scripts/mde/simplemde.min.js", diff --git a/MarkOn/package.json b/MarkOn/package.json index 2048972..d5a395a 100644 --- a/MarkOn/package.json +++ b/MarkOn/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.0.2-a", + "version":"0.0.3-a", "category":"Utils", "iconclass":"fa fa-leanpub", "mimes":["text/.*"] diff --git a/packages.json b/packages.json index 62701cd..c73872c 100644 --- a/packages.json +++ b/packages.json @@ -32,7 +32,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/MarkOn/README.md", "category": "Utils", "author": "Xuan Sang LE", - "version": "0.0.2-a", + "version": "0.0.3-a", "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/MarkOn/build/release/MarkOn.zip" }, {