diff --git a/About/build/debug/main.js b/About/build/debug/main.js index 44ecd9c..ad1fcfa 100644 --- a/About/build/debug/main.js +++ b/About/build/debug/main.js @@ -1 +1,34 @@ -(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("About",t)}main(){var t,n;return t=this,this.container=this.find("container"),(n="os://README.md").asFileHandle().read().then((function(n){var i;return i=new showdown.Converter,$(t.container).html(i.makeHtml(n))})).catch(()=>this.notify(__("Unable to read: {0}",n))),this.find("btnclose").onbtclick=()=>this.quit()}}).singleton=!0,t.dependencies=["os://scripts/showdown.min.js"],this.OS.register("About",t)}).call(this); \ No newline at end of file +(function() { + var About; + + About = class About extends this.OS.application.BaseApplication { + constructor(args) { + super("About", args); + } + + main() { + var me, path; + me = this; + this.container = this.find("container"); + path = "os://README.md"; + path.asFileHandle().read().then(function(txt) { + var converter; + converter = new showdown.Converter(); + return ($(me.container)).html(converter.makeHtml(txt)); + }).catch(() => { + return this.notify(__("Unable to read: {0}", path)); + }); + return this.find("btnclose").onbtclick = () => { + return this.quit(); + }; + } + + }; + + About.singleton = true; + + About.dependencies = ["os://scripts/showdown.min.js"]; + + this.OS.register("About", About); + +}).call(this); diff --git a/ShowCase/build/debug/main.js b/ShowCase/build/debug/main.js index 7610608..3816eec 100644 --- a/ShowCase/build/debug/main.js +++ b/ShowCase/build/debug/main.js @@ -1 +1,500 @@ -(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("ShowCase",t)}main(){var t,e,i,a,o,n,s,d;return this.find("bttest"),this.observable.on("btclick",t=>this.notify("button clicked")),(o=this.find("list")).data=[{text:"some thing with avery long text"},{text:"some thing 1",closable:!0},{text:"some thing 2",iconclass:"fa fa-camera-retro fa-lg"},{text:"some thing 3"},{text:"some thing 4"},{text:"some thing 5"}],o.onlistselect=t=>this.notify(t.data.items),this.find("switch").onswchange=t=>this.notify(t.data),this.find("spin").onvaluechange=t=>this.notify(t.data),this.find("menu").items=this.menu(),o.contextmenuHandle=(t,e)=>(e.items=this.menu(),e.show(t)),(a=this.find("grid")).oncelldbclick=t=>this.notify("on dbclick",t),a.onrowselect=t=>this.notify("on rowselect"),a.header=[{text:"header1",width:80},{text:"header2"},{text:"header3"}],a.rows=[[{text:"text 1"},{text:"text 2"},{text:"text 3"}],[{text:"text 4"},{text:"text 5"},{text:"text 6"}],[{text:"text 7"},{text:"text 8"},{text:"text 9"}],[{text:"text 10"},{text:"this is a long text"},{text:"text 11"}]],n={text:"Tree root",nodes:[{text:"leaf 1",iconclass:"fa fa-car"},{text:"leaf 2"},{text:"sub tree 1",nodes:[{text:"sub sub tree 1",nodes:[{text:"leaf 1 of sub sub tree 1"},{text:"leaf 2 of sub sub tree 1"}]},{text:"leaf 1 of sub tree"},{text:"leaf 2 of sub tree"},{text:"sub sub tree 2",nodes:[{text:"leaf 1 of sub sub tree 2"},{text:"leaf 2 of sub sub tree 2"}]}]}]},(s=this.find("tree")).data=n,s.ontreeselect=t=>this.notify(t.data.item.treepath),s.ontreedbclick=t=>this.notify("treedbclick"),this.observable.on("treedbclick",t=>this.notify("observable treedbclick")),this.find("slider").onvaluechange=t=>this.notify(t),this.find("cal").ondateselect=t=>this.notify(t.data.toString()),this.find("cpk").oncolorselect=t=>this.notify(JSON.stringify(t)),(i=this.find("fileview")).fetch=function(t){return new Promise((function(e,i){var a;return(a=t.asFileHandle()).read().then((function(t){var o;return(o=a.parent().asFileHandle()).filename="[..]",o.type="dir",t.error?i(t.error):(t.result.unshift(o),e(t.result))}))}))},i.path="home:///",(d=this.find("viewoption")).data=[{text:"icon"},{text:"list"},{text:"tree"}],d.onlistselect=t=>(this.notify(t.data.item.data.text),i.view=t.data.item.data.text),e=this.find("dialoglist"),t=this.find("btrundia"),e.data=[{text:"Prompt dialog",id:"prompt"},{text:"Calendar dialog",id:"calendar"},{text:"Color picker dialog",id:"colorpicker"},{text:"Info dialog",id:"info"},{text:"YesNo dialog",id:"yesno"},{text:"Selection dialog",id:"selection"},{text:"About dialog",id:"about"},{text:"File dialog",id:"file"},{text:"Text dialog",id:"text"}],t.onbtclick=t=>{var i;if(i=e.selectedItem)switch(i.data.id){case"prompt":return this.openDialog("PromptDialog",{title:"Prompt review",value:"txt data",label:"enter value"}).then(t=>this.notify(t));case"calendar":return this.openDialog("CalendarDialog",{title:"Calendar dialog"}).then(t=>this.notify(t.toString()));case"colorpicker":return this.openDialog("ColorPickerDialog").then(t=>this.notify(JSON.stringify(t)));case"info":return this.openDialog("InfoDialog",{title:"Info application",name:"Show case",date:"10/12/2014",description:"the brown fox jumps over the lazy dog"}).then((function(t){}));case"yesno":return this.openDialog("YesNoDialog",{title:"Question ?",text:"Do you realy want to delete file ?"}).then(t=>this.notify(t));case"selection":return this.openDialog("SelectionDialog",{title:"Select data ?",data:[{text:"Option 1"},{text:"Option 2"},{text:"Option 3",iconclass:"fa fa-camera-retro fa-lg"}]}).then(t=>this.notify(t.text));case"about":return this.openDialog("AboutDialog").then(t=>{});case"file":return this.openDialog("FileDialog",{title:"Select file ?",mimes:["text/*","dir"],file:"Untitled".asFileHandle()}).then((t,e)=>this.notify(t,e));case"text":return this.openDialog("TextDialog",{title:"Text dialog review",value:"txt data"}).then(t=>this.notify(t))}}}mnFile(){return{text:"__(File)",nodes:[{text:"__(New file)",dataid:this.name+"-mkf",shortcut:"C-F"},{text:"__(New folder)",dataid:this.name+"-mkdir",shortcut:"C-D"},{text:"__(Open with)",dataid:this.name+"-open",child:this.apps},{text:"__(Upload)",dataid:this.name+"-upload",shortcut:"C-U"},{text:"__(Download)",dataid:this.name+"-download"},{text:"__(Share file)",dataid:this.name+"-share",shortcut:"C-S"},{text:"__(Properties)",dataid:this.name+"-info",shortcut:"C-I"}],onchildselect:t=>this.notify(t.data.item.data.text)}}mnEdit(){return{text:"__(Edit)",nodes:[{text:"__(Rename)",dataid:this.name+"-mv",shortcut:"C-R"},{text:"__(Delete)",dataid:this.name+"-rm",shortcut:"C-M"},{text:"__(Cut)",dataid:this.name+"-cut",shortcut:"C-X"},{text:"__(Copy)",dataid:this.name+"-copy",shortcut:"C-C"},{text:"__(Paste)",dataid:this.name+"-paste",shortcut:"C-P"}],onchildselect:t=>this.notify(t.data.item.data.text)}}menu(){return[this.mnFile(),this.mnEdit(),{text:"__(View)",nodes:[{text:"__(Refresh)",dataid:this.name+"-refresh"},{text:"__(Sidebar)",switch:!0,checked:!0},{text:"__(Navigation bar)",switch:!0,checked:!1},{text:"__(Hidden files)",switch:!0,checked:!0,dataid:this.name+"-hidden"},{text:"__(Type)",child:[{text:"__(Icon view)",radio:!0,checked:!0,dataid:this.name+"-icon",type:"icon"},{text:"__(List view)",radio:!0,checked:!1,dataid:this.name+"-list",type:"list"},{text:"__(Tree view)",radio:!0,checked:!1,dataid:this.name+"-tree",type:"tree"}],onchildselect:function(t){return this.notify(t.data.item.data.text)}}],onchildselect:t=>this.notify(t.data.item.data.text)}]}}).singleton=!0,this.OS.register("ShowCase",t)}).call(this); \ No newline at end of file +(function() { + var Ant, ShowCase; + + Ant = this; + + ShowCase = class ShowCase extends this.OS.application.BaseApplication { + constructor(args) { + super("ShowCase", args); + } + + main() { + var bt, btrun, cal, dllist, fileview, grid, list, menu, pk, slider, spin, sw, tdata, tree, viewoption; + bt = this.find('bttest'); + this.observable.on("btclick", (e) => { + return this.notify("button clicked"); + }); + list = this.find('list'); + list.data = [ + { + text: "some thing with avery long text" + }, + { + text: "some thing 1", + closable: true + }, + { + text: "some thing 2", + iconclass: "fa fa-camera-retro fa-lg" + }, + { + text: "some thing 3" + }, + { + text: "some thing 4" + }, + { + text: "some thing 5" + } + ]; + list.onlistselect = (e) => { + return this.notify(e.data.items); + }; + sw = this.find('switch'); + sw.onswchange = (e) => { + return this.notify(e.data); + }; + spin = this.find('spin'); + spin.onvaluechange = (e) => { + return this.notify(e.data); + }; + menu = this.find('menu'); + menu.items = this.menu(); + list.contextmenuHandle = (e, m) => { + m.items = this.menu(); + return m.show(e); + }; + grid = this.find('grid'); + grid.oncelldbclick = (e) => { + return this.notify("on dbclick", e); + }; + grid.onrowselect = (e) => { + return this.notify("on rowselect"); + }; + grid.header = [ + { + text: "header1", + width: 80 + }, + { + text: "header2" + }, + { + text: "header3" + } + ]; + grid.rows = [ + [ + { + text: "text 1" + }, + { + text: "text 2" + }, + { + text: "text 3" + } + ], + [ + { + text: "text 4" + }, + { + text: "text 5" + }, + { + text: "text 6" + } + ], + [ + { + text: "text 7" + }, + { + text: "text 8" + }, + { + text: "text 9" + } + ], + [ + { + text: "text 10" + }, + { + text: "this is a long text" + }, + { + text: "text 11" + } + ] + ]; + tdata = { + text: 'Tree root', + nodes: [ + { + text: 'leaf 1', + iconclass: 'fa fa-car' + }, + { + text: 'leaf 2' + }, + { + text: 'sub tree 1', + nodes: [ + { + text: 'sub sub tree 1', + nodes: [ + { + text: 'leaf 1 of sub sub tree 1' + }, + { + text: 'leaf 2 of sub sub tree 1' + } + ] + }, + { + text: 'leaf 1 of sub tree' + }, + { + text: 'leaf 2 of sub tree' + }, + { + text: 'sub sub tree 2', + nodes: [ + { + text: 'leaf 1 of sub sub tree 2' + }, + { + text: 'leaf 2 of sub sub tree 2' + } + ] + } + ] + } + ] + }; + tree = this.find('tree'); + tree.data = tdata; + tree.ontreeselect = (e) => { + return this.notify(e.data.item.treepath); + }; + tree.ontreedbclick = (e) => { + return this.notify("treedbclick"); + }; + this.observable.on("treedbclick", (e) => { + return this.notify("observable treedbclick"); + }); + slider = this.find('slider'); + slider.onvaluechange = (v) => { + return this.notify(v); + }; + cal = this.find('cal'); + cal.ondateselect = (e) => { + return this.notify(e.data.toString()); + }; + pk = this.find('cpk'); + pk.oncolorselect = (e) => { + return this.notify(JSON.stringify(e)); + }; + fileview = this.find('fileview'); + fileview.fetch = function(path) { + return new Promise(function(resolve, reject) { + var dir; + dir = path.asFileHandle(); + return dir.read().then(function(d) { + var p; + p = dir.parent().asFileHandle(); + p.filename = "[..]"; + p.type = "dir"; + if (d.error) { + return reject(d.error); + } + d.result.unshift(p); + return resolve(d.result); + }); + }); + }; + fileview.path = "home:///"; + viewoption = this.find('viewoption'); + viewoption.data = [ + { + text: "icon" + }, + { + text: "list" + }, + { + text: "tree" + } + ]; + viewoption.onlistselect = (e) => { + this.notify(e.data.item.data.text); + return fileview.view = e.data.item.data.text; + }; + dllist = this.find("dialoglist"); + btrun = this.find("btrundia"); + dllist.data = [ + { + text: "Prompt dialog", + id: "prompt" + }, + { + text: "Calendar dialog", + id: "calendar" + }, + { + text: "Color picker dialog", + id: "colorpicker" + }, + { + text: "Info dialog", + id: "info" + }, + { + text: "YesNo dialog", + id: "yesno" + }, + { + text: "Selection dialog", + id: "selection" + }, + { + text: "About dialog", + id: "about" + }, + { + text: "File dialog", + id: "file" + }, + { + text: "Text dialog", + id: "text" + } + ]; + return btrun.onbtclick = (e) => { + var item; + item = dllist.selectedItem; + if (!item) { + return; + } + switch (item.data.id) { + case "prompt": + return this.openDialog("PromptDialog", { + title: "Prompt review", + value: "txt data", + label: "enter value" + }).then((d) => { + return this.notify(d); + }); + case "calendar": + return this.openDialog("CalendarDialog", { + title: "Calendar dialog" + }).then((d) => { + return this.notify(d.toString()); + }); + case "colorpicker": + return this.openDialog("ColorPickerDialog").then((d) => { + return this.notify(JSON.stringify(d)); + }); + case "info": + return this.openDialog("InfoDialog", { + title: "Info application", + name: "Show case", + date: "10/12/2014", + description: "the brown fox jumps over the lazy dog" + }).then(function(d) {}); + case "yesno": + return this.openDialog("YesNoDialog", { + title: "Question ?", + text: "Do you realy want to delete file ?" + }).then((d) => { + return this.notify(d); + }); + case "selection": + return this.openDialog("SelectionDialog", { + title: "Select data ?", + data: [ + { + text: "Option 1" + }, + { + text: "Option 2" + }, + { + text: "Option 3", + iconclass: "fa fa-camera-retro fa-lg" + } + ] + }).then((d) => { + return this.notify(d.text); + }); + case "about": + return this.openDialog("AboutDialog").then((d) => {}); + case "file": + return this.openDialog("FileDialog", { + title: "Select file ?", + //root: "home:///", + mimes: ["text/*", "dir"], + file: "Untitled".asFileHandle() + }).then((f, name) => { + return this.notify(f, name); + }); + case "text": + return this.openDialog("TextDialog", { + title: "Text dialog review", + value: "txt data" + }).then((d) => { + return this.notify(d); + }); + } + }; + } + + mnFile() { + var arr; + //@notify file + arr = { + text: "__(File)", + nodes: [ + { + text: "__(New file)", + dataid: `${this.name}-mkf`, + shortcut: 'C-F' + }, + { + text: "__(New folder)", + dataid: `${this.name}-mkdir`, + shortcut: 'C-D' + }, + { + text: "__(Open with)", + dataid: `${this.name}-open`, + child: this.apps + }, + { + text: "__(Upload)", + dataid: `${this.name}-upload`, + shortcut: 'C-U' + }, + { + text: "__(Download)", + dataid: `${this.name}-download` + }, + { + text: "__(Share file)", + dataid: `${this.name}-share`, + shortcut: 'C-S' + }, + { + text: "__(Properties)", + dataid: `${this.name}-info`, + shortcut: 'C-I' + } + ], + onchildselect: (e) => { + return this.notify(e.data.item.data.text); + } + }; + return arr; + } + + mnEdit() { + return { + text: "__(Edit)", + nodes: [ + { + text: "__(Rename)", + dataid: `${this.name}-mv`, + shortcut: 'C-R' + }, + { + text: "__(Delete)", + dataid: `${this.name}-rm`, + shortcut: 'C-M' + }, + { + text: "__(Cut)", + dataid: `${this.name}-cut`, + shortcut: 'C-X' + }, + { + text: "__(Copy)", + dataid: `${this.name}-copy`, + shortcut: 'C-C' + }, + { + text: "__(Paste)", + dataid: `${this.name}-paste`, + shortcut: 'C-P' + } + ], + onchildselect: (e) => { + return this.notify(e.data.item.data.text); + } + }; + } + + menu() { + var menu; + menu = [ + this.mnFile(), + this.mnEdit(), + { + text: "__(View)", + nodes: [ + { + text: "__(Refresh)", + dataid: `${this.name}-refresh` + }, + { + text: "__(Sidebar)", + switch: true, + checked: true + }, + { + text: "__(Navigation bar)", + switch: true, + checked: false + }, + { + text: "__(Hidden files)", + switch: true, + checked: true, + dataid: `${this.name}-hidden` + }, + { + text: "__(Type)", + child: [ + { + text: "__(Icon view)", + radio: true, + checked: true, + dataid: `${this.name}-icon`, + type: 'icon' + }, + { + text: "__(List view)", + radio: true, + checked: false, + dataid: `${this.name}-list`, + type: 'list' + }, + { + text: "__(Tree view)", + radio: true, + checked: false, + dataid: `${this.name}-tree`, + type: 'tree' + } + ], + onchildselect: function(e) { + return this.notify(e.data.item.data.text); + } + } + ], + onchildselect: (e) => { + return this.notify(e.data.item.data.text); + } + } + ]; + return menu; + } + + }; + + ShowCase.singleton = true; + + this.OS.register("ShowCase", ShowCase); + +}).call(this); diff --git a/TinyEditor/build/debug/main.js b/TinyEditor/build/debug/main.js index 5e0f379..27465ab 100644 --- a/TinyEditor/build/debug/main.js +++ b/TinyEditor/build/debug/main.js @@ -1,146 +1 @@ -(function() { - var TinyEditor; - - TinyEditor = class TinyEditor extends this.OS.application.BaseApplication { - constructor(args) { - super("TinyEditor", args); - } - - main() { - this.editor = this.find("editor"); - this.bindKey("ALT-N", () => { - return this.newFile(); - }); - this.bindKey("ALT-O", () => { - return this.openFile(); - }); - this.bindKey("CTRL-S", () => { - return this.saveFile(); - }); - this.filehandle = this.args && this.args.length > 0 ? this.args[0].path.asFileHandle() : null; - $(this.editor).on('input', (e) => { - if (this.filehandle.dirty === true) { - return; - } - this.filehandle.dirty = true; - return this.scheme.apptitle = `${this.filehandle.path}*`; - }); - return this.read(); - } - - menu() { - var m; - m = [ - { - text: "__(File)", - nodes: [ - { - text: "__(New)", - dataid: "new", - shortcut: 'A-N' - }, - { - text: "__(Open)", - dataid: "open", - shortcut: 'A-O' - }, - { - text: "__(Save)", - dataid: "save", - shortcut: 'C-S' - } - ], - onchildselect: (e) => { - switch (e.data.item.data.dataid) { - case "new": - return this.newFile(); - case "open": - return this.openFile(); - case "save": - return this.saveFile(); - } - } - } - ]; - return m; - } - - newFile() { - this.filehandle = null; - return this.read(); - } - - openFile() { - return this.openDialog("FileDialog", { - title: __("Open file") - }).then((d) => { - this.filehandle = d.file.path.asFileHandle(); - return this.read(); - }); - } - - saveFile() { - this.filehandle.cache = this.editor.value; - if (this.filehandle.path !== "Untitled") { - return this.write(); - } - return this.openDialog("FileDialog", { - title: __("Save as"), - file: this.filehandle - }).then((f) => { - var d; - d = f.file.path.asFileHandle(); - if (f.file.type === "file") { - d = d.parent(); - } - this.filehandle.setPath(`${d.path}/${f.name}`); - return this.write(); - }); - } - - read() { - this.editor.value = ""; - if (this.filehandle === null) { - this.filehandle = "Untitled".asFileHandle(); - this.scheme.apptitle = "Untitled"; - return; - } - return this.filehandle.read().then((d) => { - this.scheme.apptitle = this.filehandle.path; - return this.editor.value = d; - }).catch((e) => { - return this.error(__("Unable to read file content")); - }); - } - - write() { - return this.filehandle.write("text/plain").then((d) => { - this.filehandle.dirty = false; - return this.scheme.apptitle = `${this.filehandle.path}`; - }).catch((e) => { - return this.error(__("Error saving file {0}", this.filehandle.path), e); - }); - } - - cleanup(e) { - if (!this.filehandle.dirty) { - return; - } - e.preventDefault(); - return this.ask({ - title: "__(Quit)", - text: "__(Quit without saving?)" - }).then((d) => { - if (!d) { - return; - } - this.filehandle.dirty = false; - return this.quit(); - }); - } - - }; - - this.OS.register("TinyEditor", TinyEditor); - -}).call(this); +(function(){var e;e=class extends this.OS.application.BaseApplication{constructor(e){super("TinyEditor",e)}main(){return this.editor=this.find("editor"),this.bindKey("ALT-N",()=>this.newFile()),this.bindKey("ALT-O",()=>this.openFile()),this.bindKey("CTRL-S",()=>this.saveFile()),this.filehandle=this.args&&this.args.length>0?this.args[0].path.asFileHandle():null,$(this.editor).on("input",e=>{if(!0!==this.filehandle.dirty)return this.filehandle.dirty=!0,this.scheme.apptitle=this.filehandle.path+"*"}),this.read()}menu(){return[{text:"__(File)",nodes:[{text:"__(New)",dataid:"new",shortcut:"A-N"},{text:"__(Open)",dataid:"open",shortcut:"A-O"},{text:"__(Save)",dataid:"save",shortcut:"C-S"}],onchildselect:e=>{switch(e.data.item.data.dataid){case"new":return this.newFile();case"open":return this.openFile();case"save":return this.saveFile()}}}]}newFile(){return this.filehandle=null,this.read()}openFile(){return this.openDialog("FileDialog",{title:__("Open file")}).then(e=>(this.filehandle=e.file.path.asFileHandle(),this.read()))}saveFile(){return this.filehandle.cache=this.editor.value,"Untitled"!==this.filehandle.path?this.write():this.openDialog("FileDialog",{title:__("Save as"),file:this.filehandle}).then(e=>{var t;return t=e.file.path.asFileHandle(),"file"===e.file.type&&(t=t.parent()),this.filehandle.setPath(`${t.path}/${e.name}`),this.write()})}read(){return this.editor.value="",null===this.filehandle?(this.filehandle="Untitled".asFileHandle(),void(this.scheme.apptitle="Untitled")):this.filehandle.read().then(e=>(this.scheme.apptitle=this.filehandle.path,this.editor.value=e)).catch(e=>this.error(__("Unable to read file content")))}write(){return this.filehandle.write("text/plain").then(e=>(this.filehandle.dirty=!1,this.scheme.apptitle=""+this.filehandle.path)).catch(e=>this.error(__("Error saving file {0}",this.filehandle.path),e))}cleanup(e){if(this.filehandle.dirty)return e.preventDefault(),this.ask({title:"__(Quit)",text:"__(Quit without saving?)"}).then(e=>{if(e)return this.filehandle.dirty=!1,this.quit()})}},this.OS.register("TinyEditor",e)}).call(this); \ No newline at end of file diff --git a/TinyEditor/build/release/TinyEditor.zip b/TinyEditor/build/release/TinyEditor.zip index b0de0a4..8d7b054 100644 Binary files a/TinyEditor/build/release/TinyEditor.zip and b/TinyEditor/build/release/TinyEditor.zip differ diff --git a/packages.json b/packages.json index 5200238..f381568 100644 --- a/packages.json +++ b/packages.json @@ -295,7 +295,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/README.md", "category": "System", "author": "Xuan Sang LE", - "version": "0.1.11-a", + "version": "0.1.12-a", "dependencies": ["Antunnel@0.1.8-a","xTerm@4.8.1-r"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/vTerm/build/release/vTerm.zip" }, diff --git a/vTerm/README.md b/vTerm/README.md index ae071fd..72412c6 100644 --- a/vTerm/README.md +++ b/vTerm/README.md @@ -12,5 +12,6 @@ VTerm depends on the server side **tunnel** plugin and the AntOS **Antunnel** client side package ## Change logs +- v0.1.12-a: Add copy/paste shortcuts (CTRL+SHIFT+C/ CTRL+SHIFT+V) - v0.1.9-a: Update dependencies to latest - v0.1.6-a: Add dependencies to package meta-data \ No newline at end of file diff --git a/vTerm/build/debug/README.md b/vTerm/build/debug/README.md index ae071fd..72412c6 100644 --- a/vTerm/build/debug/README.md +++ b/vTerm/build/debug/README.md @@ -12,5 +12,6 @@ VTerm depends on the server side **tunnel** plugin and the AntOS **Antunnel** client side package ## Change logs +- v0.1.12-a: Add copy/paste shortcuts (CTRL+SHIFT+C/ CTRL+SHIFT+V) - v0.1.9-a: Update dependencies to latest - v0.1.6-a: Add dependencies to package meta-data \ No newline at end of file diff --git a/vTerm/build/debug/main.js b/vTerm/build/debug/main.js index 2174f8a..31870ab 100644 --- a/vTerm/build/debug/main.js +++ b/vTerm/build/debug/main.js @@ -1 +1 @@ -(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("vTerm",t)}main(){var t;return this.mterm=this.find("myterm"),this.term=new Terminal({cursorBlink:!0}),this.fitAddon=new FitAddon.FitAddon,this.term.loadAddon(this.fitAddon),this.term.setOption("fontSize","12"),this.term.open(this.mterm),this.sub=void 0,this.term.onKey(t=>{if(this.sub)return this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t.key))}),this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(t,e)=>(e.items=[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}],e.onmenuselect=t=>{if(t)return this.mctxHandle(t.data.item.data)},e.show(t)),this.resizeContent(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"vTerm"}),this.on("hboxchange",t=>this.resizeContent()),t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):(this.error(__("The Antunnel service is not started, please start it first")),this._gui.pushService("Antunnel/AntunnelService").catch(t=>this.error(t.toString(),t)),this.quit()),window.Antunnel?t():(console.log("require Antunnel"),this._api.requires("pkg://Antunnel/main.js").then(()=>t()).catch(t=>(this.error(__("Unable to load Antunnel: {0}",t.toString()),t),this.quit())))}mctxHandle(t){var e,s;switch(t.id){case"paste":return e=t=>{if(t&&""!==t)return t=t.replace(/\n/g,"\r"),this.sub&&this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t)),this.term.focus()},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(t=>this.error(t.toString(),t))));case"copy":if(!(s=this.term.getSelection())||""===s)return;return this._api.setClipboard(s)}}resizeContent(){var t,e,s;if(this.fitAddon.fit(),e=this.term.cols,s=this.term.rows,this.sub)return(t=new Uint8Array(8)).set(Antunnel.Msg.bytes_of(e),0),t.set(Antunnel.Msg.bytes_of(s),4),this.sub.send(Antunnel.Msg.CTRL,t)}openSession(){return this.term.clear(),this.term.focus(),this.sub=new Antunnel.Subscriber("vterm"),this.sub.onopen=()=>(console.log("Subscribed"),this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.sub.onerror=t=>(this.error(__("Unable to connect to: vterm"),t),this.sub=void 0),this.sub.onmessage=t=>{if(this.term&&t.data)return this.term.write(new TextDecoder("utf-8").decode(t.data))},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Terminal connection closed")),this.quit()),this.tunnel.subscribe(this.sub)}cleanup(t){if(this.sub)return this.sub.close()}}).dependencies=["pkg://xTerm/main.js","pkg://xTerm/main.css","pkg://Antunnel/main.js"],this.OS.register("vTerm",t)}).call(this); \ No newline at end of file +(function(){var t;(t=class extends this.OS.application.BaseApplication{constructor(t){super("vTerm",t)}main(){var t;return this.mterm=this.find("myterm"),this.term=new Terminal({cursorBlink:!0}),this.fitAddon=new FitAddon.FitAddon,this.term.loadAddon(this.fitAddon),this.term.setOption("fontSize","12"),this.term.open(this.mterm),this.sub=void 0,this.bindKey("CTRL-SHIFT-C",t=>(this.mctxHandle({id:"copy"}),this.term.focus())),this.bindKey("CTRL-SHIFT-V",t=>this.mctxHandle({id:"paste"})),this.term.onKey(t=>{if(this.sub)return this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t.key))}),this.on("focus",()=>this.term.focus()),this.mterm.contextmenuHandle=(t,e)=>(e.items=[{text:"__(Copy)",id:"copy"},{text:"__(Paste)",id:"paste"}],e.onmenuselect=t=>{if(t)return this.mctxHandle(t.data.item.data)},e.show(t)),this.resizeContent(),this.systemsetting.desktop.menu[this.name]||(this.systemsetting.desktop.menu[this.name]={text:"__(Open terminal)",app:"vTerm"}),this.on("hboxchange",t=>this.resizeContent()),t=()=>Antunnel.tunnel?(this.tunnel=Antunnel.tunnel,this.openSession()):(this.error(__("The Antunnel service is not started, please start it first")),this._gui.pushService("Antunnel/AntunnelService").catch(t=>this.error(t.toString(),t)),this.quit()),window.Antunnel?t():(console.log("require Antunnel"),this._api.requires("pkg://Antunnel/main.js").then(()=>t()).catch(t=>(this.error(__("Unable to load Antunnel: {0}",t.toString()),t),this.quit())))}mctxHandle(t){var e,s;switch(t.id){case"paste":return e=t=>{if(t&&""!==t)return t=t.replace(/\n/g,"\r"),this.sub&&this.sub.send(Antunnel.Msg.DATA,new TextEncoder("utf-8").encode(t)),this.term.focus()},this._api.getClipboard().then(t=>e(t)).catch(t=>(this.error(__("Unable to paste"),t),this.openDialog("TextDialog",{title:"Paste text"}).then(t=>e(t)).catch(t=>this.error(t.toString(),t))));case"copy":if(!(s=this.term.getSelection())||""===s)return;return this._api.setClipboard(s)}}resizeContent(){var t,e,s;if(this.fitAddon.fit(),e=this.term.cols,s=this.term.rows,this.sub)return(t=new Uint8Array(8)).set(Antunnel.Msg.bytes_of(e),0),t.set(Antunnel.Msg.bytes_of(s),4),this.sub.send(Antunnel.Msg.CTRL,t)}openSession(){return this.term.clear(),this.term.focus(),this.sub=new Antunnel.Subscriber("vterm"),this.sub.onopen=()=>(console.log("Subscribed"),this.resizeContent($(this.mterm).width(),$(this.mterm).height()),this.term.focus()),this.sub.onerror=t=>(this.error(__("Unable to connect to: vterm"),t),this.sub=void 0),this.sub.onmessage=t=>{if(this.term&&t.data)return this.term.write(new TextDecoder("utf-8").decode(t.data))},this.sub.onclose=()=>(this.sub=void 0,this.notify(__("Terminal connection closed")),this.quit()),this.tunnel.subscribe(this.sub)}cleanup(t){if(this.sub)return this.sub.close()}}).dependencies=["pkg://xTerm/main.js","pkg://xTerm/main.css","pkg://Antunnel/main.js"],this.OS.register("vTerm",t)}).call(this); \ No newline at end of file diff --git a/vTerm/build/debug/package.json b/vTerm/build/debug/package.json index 75af356..a0d8d37 100644 --- a/vTerm/build/debug/package.json +++ b/vTerm/build/debug/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.1.11-a", + "version":"0.1.12-a", "category":"System", "iconclass":"fa fa-terminal", "mimes":["none"], diff --git a/vTerm/build/release/vTerm.zip b/vTerm/build/release/vTerm.zip index 5728a2a..082fddf 100644 Binary files a/vTerm/build/release/vTerm.zip and b/vTerm/build/release/vTerm.zip differ diff --git a/vTerm/main.coffee b/vTerm/main.coffee index bca7384..2fddc10 100644 --- a/vTerm/main.coffee +++ b/vTerm/main.coffee @@ -28,6 +28,14 @@ class vTerm extends this.OS.application.BaseApplication @term.setOption('fontSize', '12') @term.open @mterm @sub = undefined + + @bindKey "CTRL-SHIFT-C", (e) => + @mctxHandle {id: "copy"} + @term.focus() + + @bindKey "CTRL-SHIFT-V", (e) => + @mctxHandle {id: "paste"} + @term.onKey (d) => return unless @sub @sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(d.key) diff --git a/vTerm/package.json b/vTerm/package.json index 75af356..a0d8d37 100644 --- a/vTerm/package.json +++ b/vTerm/package.json @@ -6,7 +6,7 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.1.11-a", + "version":"0.1.12-a", "category":"System", "iconclass":"fa fa-terminal", "mimes":["none"],