From 7c161236f36d77bd9765822bc3d21119f84727f3 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Wed, 4 Jan 2023 00:33:08 +0100 Subject: [PATCH] Update Blogger and Booklet to use new MDE library --- Blogger/README.md | 1 + Blogger/build/debug/README.md | 1 + Blogger/build/debug/main.js | 2 +- Blogger/build/debug/package.json | 4 ++-- Blogger/build/release/Blogger.zip | Bin 9210 -> 9247 bytes Blogger/dialogs.coffee | 8 ++++---- Blogger/main.coffee | 14 +++++++------- Blogger/package.json | 4 ++-- Booklet/README.md | 2 ++ Booklet/build/debug/README.md | 2 ++ Booklet/build/debug/main.js | 2 +- Booklet/build/debug/package.json | 4 ++-- Booklet/build/release/Booklet.zip | Bin 5200 -> 5226 bytes Booklet/coffees/main.coffee | 14 +++++++------- Booklet/package.json | 4 ++-- packages.json | 8 ++++---- 16 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Blogger/README.md b/Blogger/README.md index 79b221f..8b57be7 100644 --- a/Blogger/README.md +++ b/Blogger/README.md @@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev ## Change logs ### v0.2.x-a +* Patch 9: Update to use the new MDE library * Patch 8: Support for antOS 2.0.x * Patch 7: Fix sendmail API security bug * Patch 6: Chage libraries load order diff --git a/Blogger/build/debug/README.md b/Blogger/build/debug/README.md index 79b221f..8b57be7 100644 --- a/Blogger/build/debug/README.md +++ b/Blogger/build/debug/README.md @@ -6,6 +6,7 @@ Blackend for my blog at https://blog.iohub.dev ## Change logs ### v0.2.x-a +* Patch 9: Update to use the new MDE library * Patch 8: Support for antOS 2.0.x * Patch 7: Fix sendmail API security bug * Patch 6: Chage libraries load order diff --git a/Blogger/build/debug/main.js b/Blogger/build/debug/main.js index 18f370e..985e4f6 100644 --- a/Blogger/build/debug/main.js +++ b/Blogger/build/debug/main.js @@ -1 +1 @@ -(function(){var t,e,i,s,a,n;(e=class extends this.OS.application.BaseApplication{constructor(t){super("Blogger",t)}main(){var t;return this.user={},this.cvlist=this.find("cv-list"),this.cvlist.ontreeselect=t=>{var e;if(t)return e=t.data.item.data,this.CVSectionByCID(Number(e.id))},this.inputtags=this.find("input-tags"),this.bloglist=this.find("blog-list"),this.seclist=this.find("cv-sec-list"),t=this.find("photo"),$(t).click(e=>this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(e=>t.value=e.file.path).catch(t=>this.error(__("Unable to get file"),t))),this.userdb=new this._api.DB("user"),this.cvcatdb=new this._api.DB("cv_cat"),this.cvsecdb=new this._api.DB("cv_sections"),this.blogdb=new this._api.DB("blogs"),this.tabcontainer=this.find("tabcontainer"),this.tabcontainer.ontabselect=t=>this.fetchData(t.data.container.aid),this.find("bt-user-save").onbtclick=t=>this.saveUser(),this.find("cv-cat-add").onbtclick=t=>{var e;return e=t=>this.openDialog(new s,{title:__("Add category"),tree:t}).then(t=>{var e;return e={name:t.value,pid:t.p.id,publish:1},this.cvcatdb.save(e).then(t=>this.refreshCVCat()).catch(t=>this.error(__("Cannot add new category"),t))}).catch(t=>this.error(t.toString(),t)),this.fetchCVCat().then(t=>e(t)).catch(t=>(e({text:"Porfolio",id:"0",nodes:[]}),this.error(__("Unable to fetch categories"),t)))},this.find("cv-cat-edit").onbtclick=t=>{var e,i;if((i=this.cvlist.selectedItem)&&(e=i.data))return this.fetchCVCat().then(t=>this.openDialog(new s,{title:__("Edit category"),tree:t,cat:e}).then(t=>{var i;return i={id:e.id,publish:e.publish,pid:t.p.id,name:t.value},this.cvcatdb.save(i).then(t=>this.refreshCVCat()).catch(t=>this.error(__("Cannot Edit category"),t))})).catch(t=>this.error(__("Unable to fetch categories"),t))},this.find("cv-cat-del").onbtclick=t=>{var e,i;if((i=this.cvlist.selectedItem)&&(e=i.data))return this.openDialog("YesNoDialog",{title:__("Delete category"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",e.name)}).then(t=>{if(t)return this.deleteCVCat(e)}).catch(t=>this.error(t.toString(),t))},this.find("cv-sec-add").onbtclick=t=>{var e,s;if(s=this.cvlist.selectedItem)return(e=s.data)&&"0"!==e.id?this.openDialog(new i(this),{title:__("New section entry for {0}",e.name)}).then(t=>(t.cid=Number(e.id),t.start=Number(t.start),t.end=Number(t.end),this.cvsecdb.save(t).then(t=>this.CVSectionByCID(Number(e.id))).catch(t=>this.error(__("Cannot save section: {0}",t.toString()),t)))):this.notify(__("Please select a category"))},this.find("cv-sec-move").onbtclick=t=>{var e,i;return(i=this.find("cv-sec-list").selectedItem)?(e=i.data,this.fetchCVCat().then(t=>this.openDialog(new s,{title:__("Move to"),tree:t,selonly:!0}).then(t=>{var i;return i={id:e.id,cid:t.p.id},this.cvsecdb.save(i).then(t=>(this.CVSectionByCID(e.cid),this.find("cv-sec-list").unselect())).catch(t=>this.error(__("Cannot move section"),t))}))):this.notify(__("Please select a section to move"))},this.find("cv-sec-edit").onbtclick=t=>{var e,s;return(s=this.find("cv-sec-list").selectedItem)?(e=s.data,this.openDialog(new i(this),{title:__("Modify section entry"),section:e}).then(t=>(t.cid=Number(e.cid),t.start=Number(t.start),t.end=Number(t.end),this.cvsecdb.save(t).then(t=>this.CVSectionByCID(Number(e.cid))).catch(t=>this.error(__("Cannot save section: {0}",t.toString()),t))))):this.notify(__("Please select a section to edit"))},this.seclist.onitemclose=t=>{var e;if(t)return e=t.data.item.data,this.openDialog("YesNoDialog",{iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",e.title)}).then(i=>{if(i)return this.cvsecdb.delete(e.id).then(e=>this.seclist.delete(t.data.item)).catch(t=>this.error(__("Cannot delete the section: {0}",t.toString()),t))}),!1},this.editor=new SimpleMDE({element:this.find("markarea"),autoDownloadFontAwesome:!1,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:[{name:__("New"),className:"fa fa-file",action:t=>(this.bloglist.unselect(),this.clearEditor())},{name:__("Save"),className:"fa fa-save",action:t=>this.saveBlog()},"|","bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule",{name:"image",className:"fa fa-file-image-o",action:t=>this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(t=>t.file.path.asFileHandle().publish().then(t=>this.editor.codemirror.getDoc().replaceSelection(`![](${this._api.handle.shared}/${t.result})`)).catch(t=>this.error(__("Cannot export file for embedding to text"),t)))},{name:"Youtube",className:"fa fa-youtube",action:t=>this.editor.codemirror.getDoc().replaceSelection("[[youtube:]]")},"|",{name:__("Preview"),className:"fa fa-eye no-disable",action:t=>(this.previewOn=!this.previewOn,SimpleMDE.togglePreview(t),renderMathInElement(this.find("editor-container")))},"|",{name:__("Send mail"),className:"fa fa-paper-plane",action:t=>{var e,i;return(i=this.bloglist.selectedItem)?(e=i.data,this.openDialog(new a(this),{title:__("Send mail"),content:this.editor.value(),id:e.id}).then((function(t){return console.log("Email sent")}))):this.error(__("No post selected"))}}]}),this.bloglist.onlistselect=e=>{var i;if((t=this.bloglist.selectedItem)&&(i=t.data))return this.blogdb.get(Number(i.id)).then(t=>(this.editor.value(t.content),this.inputtags.value=t.tags,this.find("blog-publish").swon=!!Number(t.publish))).catch(t=>this.error(__("Cannot fetch the entry content"),t))},this.bloglist.onitemclose=e=>{var i;if(e)return t=e.data.item,i=t.data,this.openDialog("YesNoDialog",{title:__("Delete a post"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete this post ?")}).then(e=>{if(e)return this.blogdb.delete(i.id).then(e=>(this.bloglist.delete(t),this.bloglist.unselect(),this.clearEditor()))}),!1},this.bindKey("CTRL-S",()=>{var t;if((t=this.tabcontainer.selectedTab)&&"blog-container"===t.container.aid)return this.saveBlog()}),this.on("vboxchange",()=>this.resizeContent()),this.resizeContent(),this.loadBlogs()}fetchData(t){switch(t){case"user-container":return this.userdb.get(null).then(t=>{var e,i,s,a,n;for(this.user=t[0],a=[],e=0,s=(i=this.select("[input-class='user-input']")).length;ethis.error(__("Cannot fetch user data"),t));case"cv-container":return this.refreshCVCat();default:return this.loadBlogs()}}saveUser(){var t,e,i,s;for(t=0,i=(e=this.select("[input-class='user-input']")).length;tthis.notify(__("User data updated"))).catch(t=>this.error(__("Cannot save user data"),t)):this.notify(__("Full name must be entered"))}refreshCVCat(){return this.fetchCVCat().then(t=>(this.cvlist.data=t,this.cvlist.expandAll())).catch(t=>this.error(__("Unable to load categories"),t))}fetchCVCat(){return new Promise((t,e)=>{var i,s;return s={text:"Porfolio",id:"0",nodes:[]},i={order:{name:"ASC"}},this.cvcatdb.find(i).then(e=>(this.catListToTree(e,s,"0"),t(s))).catch((function(t){return e(__e(t))}))})}catListToTree(t,e,i){var s,a,n,r,o;if(0===(n=function(){var e,s,a;for(a=[],e=0,s=t.length;e(e=function(){var t,e,i;for(i=[],t=0,e=s.length;t(this.refreshCVCat(),this.seclist.data=[])).catch(e=>this.error(__("Cannot delete the category: {0} [{1}]",t.name,e.toString()),e)))).catch(e=>this.error(__("Cannot delete all content of: {0} [{1}]",t.name,e.toString()),e))}CVSectionByCID(t){var e;return e={exp:{"=":{cid:t}},order:{start:"DESC"}},this.cvsecdb.find(e).then(t=>{var e,i,s,a;for(i=[],this.find("cv-sec-status").text=__("Found {0} sections",t.length),e=0,s=t.length;ethis.error(t.toString(),t))}saveBlog(){var t,e,i,s,a,n,r;return s=void 0,(a=this.bloglist.selectedItem)&&(s=a.data),n=this.inputtags.value,t=this.editor.value(),(r=new RegExp("^#+(.*)\n","g").exec(t))&&2===r.length?""===n?this.notify(__("Please enter tags")):(e=new Date,i={content:t,title:r[1].trim(),tags:n,ctime:s?s.ctime:e.timestamp(),ctimestr:s?s.ctimestr:e.toString(),utime:e.timestamp(),utimestr:e.toString(),rendered:this.process(this.editor.options.previewRender(t)),publish:this.find("blog-publish").swon?1:0},s&&(i.id=s.id),this.blogdb.save(i).then(t=>this.loadBlogs()).catch(t=>this.error(__("Cannot save blog: {0}",t.toString()),t))):this.notify(__("Please insert a title in the text: beginning with heading"))}process(t){var e,i,s,a,n,r,o,l,h;for(i=function(t){return``},o=/\[\[youtube:([^\]]*)\]\]/g,l=[];null!==(s=o.exec(t));)l.push(s);if(!(l.length>0))return t;for(h="",e=0,a=0,r=l.length;a{var e,s;for(e=0,s=t.length;ethis.error(__("No post found: {0}",t.toString()),t))}resizeContent(){var t,e,i,s,a,n;return i=this.find("editor-container"),e=$(i).children(),a=$(this.scheme).find(".afx-window-top")[0],n=e[1],s=e[4],t=$(this.scheme).height()-$(a).height()-$(n).height()-$(s).height()-90,$(e[2]).css("height",t+"px")}}).singleton=!0,e.dependencies=["pkg://SimpleMDE/main.js","pkg://SimpleMDE/main.css","pkg://Katex/main.js","pkg://Katex/main.css"],this.OS.register("Blogger",e),(s=class t extends this.OS.GUI.BasicDialog{constructor(){super("BloggerCategoryDialog",t.scheme)}main(){var t;if(super.main(),this.tree=this.find("tree"),this.txtinput=this.find("txtinput"),this.find("bt-ok").onbtclick=t=>{var e,i,s;return(e=this.tree.selectedItem)?(i=e.data,""!==(s=this.txtinput.value)||this.data.selonly?this.data.cat&&this.data.cat.id===i.id?this.notify(__("Parent can not be the category itself")):(this.handle&&this.handle({p:i,value:s}),this.quit()):this.notify(__("Please enter category name"))):this.notify(__("Please select a parent category"))},this.find("bt-cancel").onbtclick=t=>this.quit(),this.data&&this.data.tree)return this.data&&this.data.cat&&(this.txtinput.value=this.data.cat.name,(t="0"===this.data.cat.pid?this.data.tree:this.findDataByID(this.data.cat.pid,this.data.tree.nodes))&&(t.selected=!0)),this.tree.data=this.data.tree,this.tree.expandAll()}findDataByID(t,e){var i,s,a;for(s=0,a=e.length;s\n \n \n \n \n \n \n
\n \n \n
\n
\n
\n',i=class extends this.OS.GUI.BasicDialog{constructor(t){super("BloggerCVSectionDiaglog",(t.meta().path+"/cvsection.html").asFileHandle())}main(){var t,e;return super.main(),this.editor=new SimpleMDE({autoDownloadFontAwesome:!1,element:this.find("contentarea"),status:!1,toolbar:!1}),$(this.select('[class = "CodeMirror-scroll"]')[0]).css("min-height","50px"),$(this.select('[class="CodeMirror cm-s-paper CodeMirror-wrap"]')[0]).css("min-height","50px"),t=this.select("[input-class='user-input']"),this.data&&this.data.section&&function(){var i,s,a;for(a=[],i=0,s=t.length;i{var s,a,n,r;for(s={},a=0,n=t.length;athis.resizeContent()),this.resizeContent()}resizeContent(){var t,e,i;return i=this.find("editor-container"),e=$(i).children(),t=$(i).height()-30,$(e[1]).css("height",t+"px")}},(a=class t extends this.OS.GUI.BasicDialog{constructor(t){super("BloggerSendmailDiaglog",(t.meta().path+"/sendmail.html").asFileHandle())}main(){var e,i;return super.main(),this.subdb=new this.parent._api.DB("subscribers"),this.maillinglist=this.find("email-list"),i=new RegExp("^#+(.*)\n","g").exec(this.data.content),this.find("mail-title").value=i[1],e=this.data.content.substring(0,500)+"...",this.find("contentarea").value=t.template.format(this.data.id,e),this.subdb.find({}).then(t=>{var e,i,s;for(e=0,i=t.length;ethis.error(__("Cannot fetch subscribers data: {0}",t.toString()),t)),this.find("bt-sendmail").onbtclick=t=>{var e,i,s,a,n,r;for(i=[],s=0,n=(a=this.maillinglist.items).length;st.error?this.notify(__("Unable to send mail to: {0}",t.result.join(", "))):this.quit()).catch(t=>(console.log(t),this.error(__("Error sending mail: {0}",t.toString()),t))))}}}).template="Hello,\n\nXuan Sang LE has just published a new post on his blog: https://blog.lxsang.me/post/id/{0}\n\n==========\n{1}\n==========\n\n\nRead the full article via:\nhttps://blog.lxsang.me/post/id/{0}\n\nYou receive this email because you have been subscribed to his blog.\n\nHave a nice day,\n\nSent from Blogger, an AntOS application",n=class extends this.OS.GUI.tag.ListViewItemTag{constructor(){super()}ondatachange(){var t,e,i,s,a,n;if(this.data){for(e in n=this.data,i=["content","start","end"],this.closable=n.closable,a=[],s=this.refs)t=s[e],n[e]&&""!==n[e]?i.includes(e)?a.push($(t).text(n[e])):a.push(t.text=n[e]):a.push(void 0);return a}}reload(){}init(){}itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"title",class:"afx-cv-sec-title"},{el:"afx-label",ref:"subtitle",class:"afx-cv-sec-subtitle"},{el:"p",ref:"content",class:"afx-cv-sec-content"},{el:"p",class:"afx-cv-sec-period",children:[{el:"i",ref:"start"},{el:"i",ref:"end",class:"period-end"}]},{el:"afx-label",ref:"location",class:"afx-cv-sec-loc"}]}}},this.OS.GUI.tag.define("afx-blogger-cvsection-item",n),t=class extends this.OS.GUI.tag.ListViewItemTag{constructor(){super()}ondatachange(t){if(this.data)return(t=this.data).closable=!0,this.closable=t.closable,this.refs.title.text=t.title,this.refs.ctimestr.text=__("Created: {0}",t.ctimestr),this.refs.utimestr.text=__("Updated: {0}",t.utimestr)}reload(){}init(){}itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"title",class:"afx-blogpost-title"},{el:"afx-label",ref:"ctimestr",class:"blog-dates"},{el:"afx-label",ref:"utimestr",class:"blog-dates"}]}}},this.OS.GUI.tag.define("afx-blogger-post-item",t)}).call(this); \ No newline at end of file +(function(){var t,e,i,s,a,n;(e=class extends this.OS.application.BaseApplication{constructor(t){super("Blogger",t)}main(){var t;return this.user={},this.cvlist=this.find("cv-list"),this.cvlist.ontreeselect=t=>{var e;if(t)return e=t.data.item.data,this.CVSectionByCID(Number(e.id))},this.inputtags=this.find("input-tags"),this.bloglist=this.find("blog-list"),this.seclist=this.find("cv-sec-list"),t=this.find("photo"),$(t).click(e=>this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(e=>t.value=e.file.path).catch(t=>this.error(__("Unable to get file"),t))),this.userdb=new this._api.DB("user"),this.cvcatdb=new this._api.DB("cv_cat"),this.cvsecdb=new this._api.DB("cv_sections"),this.blogdb=new this._api.DB("blogs"),this.tabcontainer=this.find("tabcontainer"),this.tabcontainer.ontabselect=t=>this.fetchData(t.data.container.aid),this.find("bt-user-save").onbtclick=t=>this.saveUser(),this.find("cv-cat-add").onbtclick=t=>{var e;return e=t=>this.openDialog(new s,{title:__("Add category"),tree:t}).then(t=>{var e;return e={name:t.value,pid:t.p.id,publish:1},this.cvcatdb.save(e).then(t=>this.refreshCVCat()).catch(t=>this.error(__("Cannot add new category"),t))}).catch(t=>this.error(t.toString(),t)),this.fetchCVCat().then(t=>e(t)).catch(t=>(e({text:"Porfolio",id:"0",nodes:[]}),this.error(__("Unable to fetch categories"),t)))},this.find("cv-cat-edit").onbtclick=t=>{var e,i;if((i=this.cvlist.selectedItem)&&(e=i.data))return this.fetchCVCat().then(t=>this.openDialog(new s,{title:__("Edit category"),tree:t,cat:e}).then(t=>{var i;return i={id:e.id,publish:e.publish,pid:t.p.id,name:t.value},this.cvcatdb.save(i).then(t=>this.refreshCVCat()).catch(t=>this.error(__("Cannot Edit category"),t))})).catch(t=>this.error(__("Unable to fetch categories"),t))},this.find("cv-cat-del").onbtclick=t=>{var e,i;if((i=this.cvlist.selectedItem)&&(e=i.data))return this.openDialog("YesNoDialog",{title:__("Delete category"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",e.name)}).then(t=>{if(t)return this.deleteCVCat(e)}).catch(t=>this.error(t.toString(),t))},this.find("cv-sec-add").onbtclick=t=>{var e,s;if(s=this.cvlist.selectedItem)return(e=s.data)&&"0"!==e.id?this.openDialog(new i(this),{title:__("New section entry for {0}",e.name)}).then(t=>(t.cid=Number(e.id),t.start=Number(t.start),t.end=Number(t.end),this.cvsecdb.save(t).then(t=>this.CVSectionByCID(Number(e.id))).catch(t=>this.error(__("Cannot save section: {0}",t.toString()),t)))):this.notify(__("Please select a category"))},this.find("cv-sec-move").onbtclick=t=>{var e,i;return(i=this.find("cv-sec-list").selectedItem)?(e=i.data,this.fetchCVCat().then(t=>this.openDialog(new s,{title:__("Move to"),tree:t,selonly:!0}).then(t=>{var i;return i={id:e.id,cid:t.p.id},this.cvsecdb.save(i).then(t=>(this.CVSectionByCID(e.cid),this.find("cv-sec-list").unselect())).catch(t=>this.error(__("Cannot move section"),t))}))):this.notify(__("Please select a section to move"))},this.find("cv-sec-edit").onbtclick=t=>{var e,s;return(s=this.find("cv-sec-list").selectedItem)?(e=s.data,this.openDialog(new i(this),{title:__("Modify section entry"),section:e}).then(t=>(t.cid=Number(e.cid),t.start=Number(t.start),t.end=Number(t.end),this.cvsecdb.save(t).then(t=>this.CVSectionByCID(Number(e.cid))).catch(t=>this.error(__("Cannot save section: {0}",t.toString()),t))))):this.notify(__("Please select a section to edit"))},this.seclist.onitemclose=t=>{var e;if(t)return e=t.data.item.data,this.openDialog("YesNoDialog",{iconclass:"fa fa-question-circle",text:__("Do you really want to delete: {0}?",e.title)}).then(i=>{if(i)return this.cvsecdb.delete(e.id).then(e=>this.seclist.delete(t.data.item)).catch(t=>this.error(__("Cannot delete the section: {0}",t.toString()),t))}),!1},this.editor=new EasyMDE({element:this.find("markarea"),autoDownloadFontAwesome:!1,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:[{name:__("New"),className:"fa fa-file",action:t=>(this.bloglist.unselect(),this.clearEditor())},{name:__("Save"),className:"fa fa-save",action:t=>this.saveBlog()},"|","bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule",{name:"image",className:"fa fa-file-image-o",action:t=>this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"]}).then(t=>t.file.path.asFileHandle().publish().then(t=>this.editor.codemirror.getDoc().replaceSelection(`![](${this._api.handle.shared}/${t.result})`)).catch(t=>this.error(__("Cannot export file for embedding to text"),t)))},{name:"Youtube",className:"fa fa-youtube",action:t=>this.editor.codemirror.getDoc().replaceSelection("[[youtube:]]")},"|",{name:__("Preview"),className:"fa fa-eye no-disable",action:t=>(this.previewOn=!this.previewOn,EasyMDE.togglePreview(t),renderMathInElement(this.find("editor-container")))},"|",{name:__("Send mail"),className:"fa fa-paper-plane",action:t=>{var e,i;return(i=this.bloglist.selectedItem)?(e=i.data,this.openDialog(new a(this),{title:__("Send mail"),content:this.editor.value(),id:e.id}).then((function(t){return console.log("Email sent")}))):this.error(__("No post selected"))}}]}),this.bloglist.onlistselect=e=>{var i;if((t=this.bloglist.selectedItem)&&(i=t.data))return this.blogdb.get(Number(i.id)).then(t=>(this.editor.value(t.content),this.inputtags.value=t.tags,this.find("blog-publish").swon=!!Number(t.publish))).catch(t=>this.error(__("Cannot fetch the entry content"),t))},this.bloglist.onitemclose=e=>{var i;if(e)return t=e.data.item,i=t.data,this.openDialog("YesNoDialog",{title:__("Delete a post"),iconclass:"fa fa-question-circle",text:__("Do you really want to delete this post ?")}).then(e=>{if(e)return this.blogdb.delete(i.id).then(e=>(this.bloglist.delete(t),this.bloglist.unselect(),this.clearEditor()))}),!1},this.bindKey("CTRL-S",()=>{var t;if((t=this.tabcontainer.selectedTab)&&"blog-container"===t.container.aid)return this.saveBlog()}),this.on("resize",()=>this.resizeContent()),this.resizeContent(),this.loadBlogs()}fetchData(t){switch(t){case"user-container":return this.userdb.get(null).then(t=>{var e,i,s,a,n;for(this.user=t[0],a=[],e=0,s=(i=this.select("[input-class='user-input']")).length;ethis.error(__("Cannot fetch user data"),t));case"cv-container":return this.refreshCVCat();default:return this.loadBlogs()}}saveUser(){var t,e,i,s;for(t=0,i=(e=this.select("[input-class='user-input']")).length;tthis.notify(__("User data updated"))).catch(t=>this.error(__("Cannot save user data"),t)):this.notify(__("Full name must be entered"))}refreshCVCat(){return this.fetchCVCat().then(t=>(this.cvlist.data=t,this.cvlist.expandAll())).catch(t=>this.error(__("Unable to load categories"),t))}fetchCVCat(){return new Promise((t,e)=>{var i,s;return s={text:"Porfolio",id:"0",nodes:[]},i={order:{name:"ASC"}},this.cvcatdb.find(i).then(e=>(this.catListToTree(e,s,"0"),t(s))).catch((function(t){return e(__e(t))}))})}catListToTree(t,e,i){var s,a,n,r,o;if(0===(n=function(){var e,s,a;for(a=[],e=0,s=t.length;e(e=function(){var t,e,i;for(i=[],t=0,e=s.length;t(this.refreshCVCat(),this.seclist.data=[])).catch(e=>this.error(__("Cannot delete the category: {0} [{1}]",t.name,e.toString()),e)))).catch(e=>this.error(__("Cannot delete all content of: {0} [{1}]",t.name,e.toString()),e))}CVSectionByCID(t){var e;return e={exp:{"=":{cid:t}},order:{start:"DESC"}},this.cvsecdb.find(e).then(t=>{var e,i,s,a;for(i=[],this.find("cv-sec-status").text=__("Found {0} sections",t.length),e=0,s=t.length;ethis.error(t.toString(),t))}saveBlog(){var t,e,i,s,a,n,r;return s=void 0,(a=this.bloglist.selectedItem)&&(s=a.data),n=this.inputtags.value,t=this.editor.value(),(r=new RegExp("^#+(.*)\n","g").exec(t))&&2===r.length?""===n?this.notify(__("Please enter tags")):(e=new Date,i={content:t,title:r[1].trim(),tags:n,ctime:s?s.ctime:e.timestamp(),ctimestr:s?s.ctimestr:e.toString(),utime:e.timestamp(),utimestr:e.toString(),rendered:this.process(this.editor.options.previewRender(t)),publish:this.find("blog-publish").swon?1:0},s&&(i.id=s.id),this.blogdb.save(i).then(t=>this.loadBlogs()).catch(t=>this.error(__("Cannot save blog: {0}",t.toString()),t))):this.notify(__("Please insert a title in the text: beginning with heading"))}process(t){var e,i,s,a,n,r,o,l,h;for(i=function(t){return``},o=/\[\[youtube:([^\]]*)\]\]/g,l=[];null!==(s=o.exec(t));)l.push(s);if(!(l.length>0))return t;for(h="",e=0,a=0,r=l.length;a{var e,s;for(e=0,s=t.length;ethis.error(__("No post found: {0}",t.toString()),t))}resizeContent(){var t,e,i,s,a,n;return i=this.find("editor-container"),e=$(".EasyMDEContainer",i).children(),a=$(this.scheme).find(".afx-window-top")[0],n=e[0],s=e[3],t=$(this.scheme).height()-$(a).height()-$(n).height()-$(s).height()-90,$(e[1]).css("height",t+"px")}}).singleton=!0,e.dependencies=["pkg://SimpleMDE/main.js","pkg://SimpleMDE/main.css","pkg://Katex/main.js","pkg://Katex/main.css"],this.OS.register("Blogger",e),(s=class t extends this.OS.GUI.BasicDialog{constructor(){super("BloggerCategoryDialog",t.scheme)}main(){var t;if(super.main(),this.tree=this.find("tree"),this.txtinput=this.find("txtinput"),this.find("bt-ok").onbtclick=t=>{var e,i,s;return(e=this.tree.selectedItem)?(i=e.data,""!==(s=this.txtinput.value)||this.data.selonly?this.data.cat&&this.data.cat.id===i.id?this.notify(__("Parent can not be the category itself")):(this.handle&&this.handle({p:i,value:s}),this.quit()):this.notify(__("Please enter category name"))):this.notify(__("Please select a parent category"))},this.find("bt-cancel").onbtclick=t=>this.quit(),this.data&&this.data.tree)return this.data&&this.data.cat&&(this.txtinput.value=this.data.cat.name,(t="0"===this.data.cat.pid?this.data.tree:this.findDataByID(this.data.cat.pid,this.data.tree.nodes))&&(t.selected=!0)),this.tree.data=this.data.tree,this.tree.expandAll()}findDataByID(t,e){var i,s,a;for(s=0,a=e.length;s\n \n \n \n \n \n \n
\n \n \n
\n
\n
\n',i=class extends this.OS.GUI.BasicDialog{constructor(t){super("BloggerCVSectionDiaglog",(t.meta().path+"/cvsection.html").asFileHandle())}main(){var t,e;return super.main(),this.editor=new EasyMDE({autoDownloadFontAwesome:!1,element:this.find("contentarea"),status:!1,toolbar:!1}),$(this.select('[class = "CodeMirror-scroll"]')[0]).css("min-height","50px"),$(this.select('[class="CodeMirror cm-s-paper CodeMirror-wrap"]')[0]).css("min-height","50px"),t=this.select("[input-class='user-input']"),this.data&&this.data.section&&function(){var i,s,a;for(a=[],i=0,s=t.length;i{var s,a,n,r;for(s={},a=0,n=t.length;athis.resizeContent()),this.resizeContent()}resizeContent(){var t,e,i;return i=this.find("editor-container"),e=$(".EasyMDEContainer",i).children(),t=$(i).height()-30,$(e[0]).css("height",t+"px")}},(a=class t extends this.OS.GUI.BasicDialog{constructor(t){super("BloggerSendmailDiaglog",(t.meta().path+"/sendmail.html").asFileHandle())}main(){var e,i;return super.main(),this.subdb=new this.parent._api.DB("subscribers"),this.maillinglist=this.find("email-list"),i=new RegExp("^#+(.*)\n","g").exec(this.data.content),this.find("mail-title").value=i[1],e=this.data.content.substring(0,500)+"...",this.find("contentarea").value=t.template.format(this.data.id,e),this.subdb.find({}).then(t=>{var e,i,s;for(e=0,i=t.length;ethis.error(__("Cannot fetch subscribers data: {0}",t.toString()),t)),this.find("bt-sendmail").onbtclick=t=>{var e,i,s,a,n,r;for(i=[],s=0,n=(a=this.maillinglist.items).length;st.error?this.notify(__("Unable to send mail to: {0}",t.result.join(", "))):this.quit()).catch(t=>(console.log(t),this.error(__("Error sending mail: {0}",t.toString()),t))))}}}).template="Hello,\n\nXuan Sang LE has just published a new post on his blog: https://blog.lxsang.me/post/id/{0}\n\n==========\n{1}\n==========\n\n\nRead the full article via:\nhttps://blog.lxsang.me/post/id/{0}\n\nYou receive this email because you have been subscribed to his blog.\n\nHave a nice day,\n\nSent from Blogger, an AntOS application",n=class extends this.OS.GUI.tag.ListViewItemTag{constructor(){super()}ondatachange(){var t,e,i,s,a,n;if(this.data){for(e in n=this.data,i=["content","start","end"],this.closable=n.closable,a=[],s=this.refs)t=s[e],n[e]&&""!==n[e]?i.includes(e)?a.push($(t).text(n[e])):a.push(t.text=n[e]):a.push(void 0);return a}}reload(){}init(){}itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"title",class:"afx-cv-sec-title"},{el:"afx-label",ref:"subtitle",class:"afx-cv-sec-subtitle"},{el:"p",ref:"content",class:"afx-cv-sec-content"},{el:"p",class:"afx-cv-sec-period",children:[{el:"i",ref:"start"},{el:"i",ref:"end",class:"period-end"}]},{el:"afx-label",ref:"location",class:"afx-cv-sec-loc"}]}}},this.OS.GUI.tag.define("afx-blogger-cvsection-item",n),t=class extends this.OS.GUI.tag.ListViewItemTag{constructor(){super()}ondatachange(t){if(this.data)return(t=this.data).closable=!0,this.closable=t.closable,this.refs.title.text=t.title,this.refs.ctimestr.text=__("Created: {0}",t.ctimestr),this.refs.utimestr.text=__("Updated: {0}",t.utimestr)}reload(){}init(){}itemlayout(){return{el:"div",children:[{el:"afx-label",ref:"title",class:"afx-blogpost-title"},{el:"afx-label",ref:"ctimestr",class:"blog-dates"},{el:"afx-label",ref:"utimestr",class:"blog-dates"}]}}},this.OS.GUI.tag.define("afx-blogger-post-item",t)}).call(this); \ No newline at end of file diff --git a/Blogger/build/debug/package.json b/Blogger/build/debug/package.json index 9700097..29dc296 100644 --- a/Blogger/build/debug/package.json +++ b/Blogger/build/debug/package.json @@ -6,9 +6,9 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.2.8-a", + "version":"0.2.9-a", "category":"Internet", "iconclass":"fa fa-book", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"], "mimes":["none"] } \ No newline at end of file diff --git a/Blogger/build/release/Blogger.zip b/Blogger/build/release/Blogger.zip index 7806afc9b5c4106ae5e0b82e952568005c650da4..a1c602632156b59760697da89bbece59c1a3e2b2 100644 GIT binary patch delta 6310 zcmZvgbx<5ol812(I)es+4DJ#jxH|y`cLE6xgS!k6+#P}j_klog3pz+}2@)h|(BKSy z+1;z!+q-*zb-n6-{p;%PdR5<@Vu2D=Qxz2r2MGxY3rVyCq}SpMkrV(TAq7e!Az}W# zb+WL7aM`4D^X+a>Ea{48r=L8UmUI*!N;d6w7X$n3lX zQJnlxn`_KVH-U_qXs_vYs(IZjiI)g{s`yaU%`GQE@Nj7@SNAY=Oi0$oAzbG(qXzSY0q5wYDm)XZOmp-F)m~uGiodSK-1CZNr7jI z;DK9y=*nAiS(%Ps;&vzVTaV7e=|DDTTZO5<`T9oYA43p9QM5Z68KOgsDK%f!r_U#FYNd!D#Ljq+X&eXcy5P5-pc={KBszJNLvG zMK=e_M^;lHBLIAE?|C+ho+|BQ(8y(wPd3wUCT`T$p}Dwy`UXldwyBjtZ;nxAJU2Y} zUB528KZ}YUnZS#9!f6v~o)$|F2&b|5__UaKZmB+m0*J&fneflo)tdxNBW0=Ty8 zFX^Sb*$AT#=e{PK-TrVf_;tqnLWgAsNA`y~KI9CH?h{*jDL~togZ<|qq~4D^zNEyTQ` ztn-kEz}@9s{C&e&H@q6J1ui>nOP(W#X)CC%r44S?5;Bl>1n)-&z=gIFg z8n!kxj6$4L>_VwevU)lZC5GU$#2S74$YhOIP`0!<2X0o68p2uw3#-CNd+&ubz)8Ye z0vqkbSlPs0wL~0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plE9{R8TR2W_7jp?U05ESp+$U=1Q;?zfxaRNRW z+ml-@FM2L)otBJjX81+###h)b(b644f#(Kg>S+rRA0K=XXU1foF|?0<^!XWd!^3#4 zzQn#e$D0M=Ym6Rvm|m z>yg8H&E8~p{#vU+Mi=j7p$4IzFlS{@oW+-`kG+Ub_zWx*fLFdw1=&Xk+MC-n7T8BK^6{tyzKV z(cE5W7JvO2CxYWstmeRvoiXR6ER0e4b03)OIxVgoZ_dIU6y;Fje`SY;Xd`3ek_`@3 zKrh0@!bEt01@S?F5ixi->oLw=P41uHEZf9|=1d1oxCkjN)@xxn$Z=e1dk5Jcj{JNt zwUqnz#~jrU8%B2!+!w*JpP0Vz40&Ev{#)_+J&}l8?IkUwyvp;iCP^mSaq&x8`3nHQ zY^VtHs6a#gyG(1RMg&6>j{6(Xth3)$Lpub~VBk;&l@yr%zwH>P7(Y9azRxdi;1sj`vLR$V}s)3JE5iK8D&(bklr|1Ca$YDfl1p*MtuAImihw|h;Ar1 ziM@7BE%X>+3vTj){0_oKq)=g`On`*`%&j$Sfr4w)Fh%$SU*^ z4nk*d#kcGERl&|uDjKt*Ks=&MvvGTZtj5pFUdRs5*gBtnDgnCmbGpJBOnN1>g(kzp z{7B^#wD|8{DJZiecqyL&ZQy6i9S4tZ9m3~^9KyljB64chCeWc(nHkV^sW6xF)>f7~ zc2!sB4fS{H`5V;2t#TtjSVbFsM$w>VNBLMFsk5|7DnIfQ>VJ>35yDuE%=phVZRTk3 zJO9q`69y6z{@)q?=Sf>)rj_~sDE_a@& z`Zvx`b7!Fzzx%r%|03BoUS9tz_+O;`@8}BXX&%gE4FCL}{t*f6kBWr!<1hQh{kP(; zm64{yLjA8oU<4m9t^Q_1kA{SV_g@+@y0mT super.main() - @editor = new SimpleMDE + @editor = new EasyMDE autoDownloadFontAwesome: false element: @find "contentarea" status: false @@ -107,14 +107,14 @@ class BloggerCVSectionDiaglog extends this.OS.GUI.BasicDialog @handle data if @handle @quit() - @on "vboxchange", () => @resizeContent() + @on "resize", () => @resizeContent() @resizeContent() resizeContent: () -> container = @find "editor-container" - children = ($ container).children() + children = ($ ".EasyMDEContainer", container).children() cheight = ($ container).height() - 30 - ($ children[1]).css("height", cheight + "px") + ($ children[0]).css("height", cheight + "px") # this dialog is for send mail diff --git a/Blogger/main.coffee b/Blogger/main.coffee index e601d2b..9925b49 100644 --- a/Blogger/main.coffee +++ b/Blogger/main.coffee @@ -187,7 +187,7 @@ class Blogger extends this.OS.application.BaseApplication .catch (e) => @error __("Cannot delete the section: {0}", e.toString()), e return false - @editor = new SimpleMDE + @editor = new EasyMDE element: @find "markarea" autoDownloadFontAwesome: false autofocus: true @@ -237,7 +237,7 @@ class Blogger extends this.OS.application.BaseApplication className: "fa fa-eye no-disable", action: (e) => @previewOn = !@previewOn - SimpleMDE.togglePreview e + EasyMDE.togglePreview e #/console.log @select ".editor-preview editor-preview-active" renderMathInElement @find "editor-container" }, @@ -294,7 +294,7 @@ class Blogger extends this.OS.application.BaseApplication sel = @tabcontainer.selectedTab return unless sel and sel.container.aid is "blog-container" @saveBlog() - @on "vboxchange", () => + @on "resize", () => @resizeContent() @resizeContent() @@ -489,12 +489,12 @@ class Blogger extends this.OS.application.BaseApplication resizeContent: () -> container = @find "editor-container" - children = ($ container).children() + children = ($ ".EasyMDEContainer", container).children() titlebar = (($ @scheme).find ".afx-window-top")[0] - toolbar = children[1] - statusbar = children[4] + toolbar = children[0] + statusbar = children[3] cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 90 - ($ children[2]).css("height", cheight + "px") + ($ children[1]).css("height", cheight + "px") Blogger.singleton = true Blogger.dependencies = [ diff --git a/Blogger/package.json b/Blogger/package.json index 9700097..29dc296 100644 --- a/Blogger/package.json +++ b/Blogger/package.json @@ -6,9 +6,9 @@ "author": "Xuan Sang LE", "email": "xsang.le@gmail.com" }, - "version":"0.2.8-a", + "version":"0.2.9-a", "category":"Internet", "iconclass":"fa fa-book", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"], "mimes":["none"] } \ No newline at end of file diff --git a/Booklet/README.md b/Booklet/README.md index d34fb51..171b9e9 100644 --- a/Booklet/README.md +++ b/Booklet/README.md @@ -3,6 +3,8 @@ A back-end tool for my online document hub [https://doc.iohub.dev/antos/](https: ## Change logs +### v0.2.5-a +* Use the new MDE library ### v0.2.3-a * Chage app category name ### v0.2.1-a diff --git a/Booklet/build/debug/README.md b/Booklet/build/debug/README.md index d34fb51..171b9e9 100644 --- a/Booklet/build/debug/README.md +++ b/Booklet/build/debug/README.md @@ -3,6 +3,8 @@ A back-end tool for my online document hub [https://doc.iohub.dev/antos/](https: ## Change logs +### v0.2.5-a +* Use the new MDE library ### v0.2.3-a * Chage app category name ### v0.2.1-a diff --git a/Booklet/build/debug/main.js b/Booklet/build/debug/main.js index 38a0cd1..49643d9 100644 --- a/Booklet/build/debug/main.js +++ b/Booklet/build/debug/main.js @@ -1 +1 @@ -(function(){var t,e,i,r,n,a,s,o;(t=class extends this.OS.application.BaseApplication{constructor(t){super("Booklet",t)}main(){return this.tree=this.find("toc-ui"),this.currentToc=void 0,this.dirty=!1,this.emux=!1,this.on("treeselect",t=>{var e;return e=t.data.item.data,this.currentToc===e||void 0===e||0===e.treepath?this.reloadEditor():(e.treepath=e.path,this.load(e).then(()=>this.open(e)).catch(t=>(e.loaded=!0,this.open(e),this.error(__("Error when loading '{0}': {1}",e.text,t.toString()),t))))}),this.tree.ondragndrop=t=>this.dndhandle(t),this.initEditor(),this.resizeContent(),this.tree.contextmenuHandle=(t,e)=>{var i;if(i=this.contextMenu())return e.items=i,e.onmenuselect=t=>this[t.data.item.data.dataid](),e.show(t)},this.editor.codemirror.on("change",()=>{if(!this.emux&&this.currentToc)return this.currentToc.descFile.dirty=!0,this.dirty=!0})}newChapter(){var t;return this.currentToc&&"Book"===this.currentToc.type?(t=new i(this.book),this.displayToc(),t.treepath=t.path):this.error(__("No book selected"))}newSection(){var t;return this.currentToc&&"Chapter"===this.currentToc.type?(t=new s(this.currentToc),this.displayToc(),t.treepath=t.path):this.error(__("No chapter selected"))}newFile(){var t;return this.currentToc&&"Section"===this.currentToc.type?(t=new n(this.currentToc),this.displayToc(),t.treepath=t.path):this.error(__("No section selected"))}delete(){var t;return this.currentToc?(t=()=>(this.currentToc=void 0,this.displayToc(),this.reloadEditor()),this.currentToc.remove().then(()=>(this.notify(__("Entrie deleted")),t())).catch(e=>(this.error(e.toString(),e),t()))):this.error(__("No entrie select"))}goUp(){if(this.currentToc&&"Book"!==this.currentToc.type)return this.currentToc.parent.up(this.currentToc),this.displayToc()}goDown(){if(this.currentToc&&"Book"!==this.currentToc.type)return this.currentToc.parent.down(this.currentToc),this.displayToc()}load(t){return new Promise((e,i)=>t.loaded?e():t.descFile.meta().then(r=>t.descFile.read().then(i=>(t.descFile.cache=i,t.loaded=!0,t.descFile.dirty=!1,e())).catch((function(t){return i(__e(t))}))).catch((function(t){return i(__e(t))})))}dndhandle(t){var e,i;if(t&&t.data&&(e=t.data.from[0].data,i=t.data.to.data,e&&i&&"Book"!==e.type&&"Chapter"!==e.type&&e.parent!==i.parent&&e.parent!==i))return i.type===e.type&&(i=i.parent),i.type===e.parent.type?e.parent.removeChild(e).then(()=>(i.add(e),this.displayToc())):void 0}upload(){if(this.currentToc&&"File"!==this.currentToc.type)return this.currentToc.path.asFileHandle().upload().then(()=>this.notify(__("File uploaded"))).catch(t=>this.error(__("Unable to upload file {0}",t.toString()),t))}contextMenu(){if(this.currentToc)switch(this.currentToc.type){case"Book":return[{text:__("New chapter"),dataid:"newChapter"},{text:__("Delete book"),dataid:"delete"},{text:__("Upload media"),dataid:"upload"}];case"Chapter":return[{text:__("New section"),dataid:"newSection"},{text:__("Delete chapter"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"},{text:__("Upload media"),dataid:"upload"}];case"Section":return[{text:__("New file"),dataid:"newFile"},{text:__("Delete section"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"},{text:__("Upload media"),dataid:"upload"}];case"File":return[{text:__("Delete file"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"}]}}shareFile(t,e){return this.openDialog("FileDialog",{title:__("Select a file"),mimes:t}).then(t=>t.file.path.asFileHandle().publish().then((function(t){return e(t.result)})).catch(t=>this.error(__("Cannot export file for embedding to text"),t))).catch(t=>this.error(t.toString(),t))}initEditor(){var t;return t=this.find("markarea"),this.container=this.find("mycontainer"),this.previewOn=!1,this.editormux=!1,this.editor=new SimpleMDE({element:t,autoDownloadFontAwesome:!1,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:["bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule",{name:"shared image",className:"fa fa-share-square",action:t=>this.shareFile(["image/.*"],t=>this.editor.codemirror.getDoc().replaceSelection(`![](${this._api.handler.shared}/${t})`))},{name:"local image",className:"fa fa-file-image-o",action:t=>{if(this.book)return this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"],root:this.book.path}).then(t=>{var e;return e=t.file.path.replace(this.book.path,""),this.editor.codemirror.getDoc().replaceSelection(`[[@book:image:${e}]]`)}).catch(t=>this.error(t.toString(),t))}},{name:"Youtube",className:"fa fa-youtube",action:t=>{var e,i;return e=this.editor.codemirror.getDoc(),i=this.editor.codemirror.getSelection()||"",e.replaceSelection(`[[youtube:${i}]]`)}},{name:"3d object",className:"fa fa-cube",action:t=>{if(this.book)return this.openDialog("FileDialog",{title:__("Select 3d model"),mimes:["text/wavefront-obj","model/gltf-binary"],root:this.book.path}).then(t=>{var e;return e=t.file.path.replace(this.book.path,""),this.editor.codemirror.getDoc().replaceSelection(`[[@book:3dmodel:${e}]]`)}).catch(t=>this.error(t.toString(),t))}},"|",{name:__("Preview"),className:"fa fa-eye no-disable",action:t=>(SimpleMDE.togglePreview(t),renderMathInElement(this.find("mycontainer")),this.renderLocalElement())}],previewRender:(t,e)=>{var i;return this.book&&(t=t.replace(/\[\[@book:image:([^\]]*)\]\]/g,(t,e)=>`![](${this._api.handle.get}/${this.book.path}/${e})`)),i=this.editor.markdown(t),e.innerHTML=i}}),this.on("hboxchange",t=>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"))}reloadEditor(){return void 0===this.currentToc?(this.editor.value(""),this.scheme.apptitle=this.name):(this.editor.value(this.currentToc.descFile.cache||""),this.scheme.apptitle="Booklet - "+this.currentToc.descFile.path)}saveContext(){if(this.currentToc)return this.currentToc.descFile.cache=this.editor.value()}resizeContent(){var t,e,i,r,n;return e=$(this.container).children(),r=$(this.scheme).find(".afx-window-top")[0],n=e[1],i=e[4],t=$(this.scheme).height()-$(r).height()-$(n).height()-$(i).height()-40,$(e[2]).css("height",t+"px")}menu(){return[{text:"__(File)",nodes:[{text:"__(New booklet)",dataid:this.name+"-New",shortcut:"A-N"},{text:"__(Open a booklet)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Save a booklet)",dataid:this.name+"-Save",shortcut:"C-S"}],onchildselect:t=>this.actionFile(t.data.item.data.dataid)}]}actionFile(t){switch(t){case this.name+"-Open":return this.checkForDirty(()=>this.openDialog("FileDialog",{title:__("Open book"),mimes:["dir"]}).then(t=>(this.book=new e(t.file.path),this.book.read(t.file.path).then(()=>(this.book.treepath=this.book.path,this.tree.selectedItem=void 0,this.displayToc(),this.notify(__("Book loaded")))).catch(t=>this.error(__("Cannot load book: {0}",t.toString()),t)))).catch(t=>this.error(t.toString(),t)));case this.name+"-New":return this.openDialog("FileDialog",{title:__("New book at"),mimes:["dir"],file:{basename:__("BookName")}}).then(t=>this.newAt(`${t.file.path}/${t.name}`)).catch(t=>this.error(t.toString(),t));case this.name+"-Save":if(!this.book)return;return this.currentToc&&this.saveContext(),this.displayToc(),this.book.save().then(()=>(this.dirty=!1,this.notify(__("Book saved")))).catch(t=>this.error(__("Can't save the book : {0}",t.toString()),t))}}checkForDirty(t){return this.dirty?this.ask({title:__("Continue ?"),text:__("Book is unsaved, you want to continue ?")}).then(e=>{if(e)return t()}):t()}open(t){return this.emux=!0,this.saveContext(),this.currentToc=t,this.reloadEditor(),this.displayToc(),this.emux=!1}newAt(t){return this.tree.selectedItem=void 0,this.book=new e(t),this.book.treepath=this.book.path,this.currentToc=void 0,this.reloadEditor(),this.displayToc()}displayToc(){return this.book.toc(),this.tree.data=this.book,this.tree.expandAll()}cleanup(t){if(this.dirty)return t.preventDefault(),this.checkForDirty(()=>(this.dirty=!1,this.quit()))}renderLocalElement(){}}).dependencies=["pkg://SimpleMDE/main.js","pkg://SimpleMDE/main.css","pkg://Katex/main.js","pkg://Katex/main.css"],this.OS.register("Booklet",t),r=class{constructor(t){this.text=t,this.loaded=!0}save(){}remove(){}toc(){}updateName(){var t;return(t=new RegExp("^s*#+(.*)\n","g").exec(this.descFile.cache))&&2===t.length?(this.hasMeta&&this.metaFile&&(this.metaFile.dirty=!0),this.parent&&this.parent.hasMeta&&this.parent.metaFile&&(this.parent.metaFile.dirty=!0),this.text=t[1].trim()):this.text}remove(){return new Promise((t,e)=>{var i;return(i=this.path.asFileHandle()).meta().then(r=>i.remove().then(i=>this.parent?this.parent.removeChild(this).then((function(){return t()})).catch((function(t){return e(__e(t))})):t()).catch((function(t){return e(__e(t))}))).catch(i=>this.parent?this.parent.removeChild(this).then((function(){return t()})).catch((function(t){return e(__e(t))})):t())})}},a=class extends r{constructor(t,e,i){super("Untitle"),this.type=t,this.path=e,this.hasMeta=i,this.init()}init(){return this.cnt=0,this.nodes=[],this.hasMeta&&(this.metaFile=(this.path+"/meta.json").asFileHandle()),this.descFile=(this.path+"/INTRO.md").asFileHandle()}up(t){var e;if(t&&(e=this.nodes.indexOf(t))>0)return this.nodes.splice(e,1),this.nodes.splice(e-1,0,t)}down(t){var e;if(t&&(e=this.nodes.indexOf(t))>=0&&e(this.nodes.splice(this.nodes.indexOf(t),1),this.hasMeta&&this.metaFile?(this.metaFile.dirty=!0,this.updateMeta().then((function(){return e()})).catch((function(t){return i(__e(t))}))):e()))}read(t){return new Promise((e,i)=>(this.path=t,this.init(),this.loaded=!1,this.metaFile.meta().then(t=>this.metaFile.read("json").then(t=>{var i,r,n,a,s,h,c;for(this.text=t.name,s=[],r=n=0,a=(h=t.entries).length;n{var n,a;return 0===r.length?(this.cnt=t.cnt,e()):(n=r.splice(0,1)[0],(a=new o[n.type](this)).name=n.name,a.read(n.path.replace("book://",this.root)).then(()=>i(r)).catch(t=>i(r)))})(s)}).catch((function(t){return i(__e(t))}))).catch((function(t){return i(__e(t))}))))}size(){return this.nodes.length}mkdir(){return new Promise((t,e)=>{var i;return(i=this.path.asFileHandle()).meta().then(e=>t()).catch(r=>{var n;return n=i.basename,(i=i.parent().asFileHandle()).mk(n).then(e=>t()).catch((function(t){return e(__e(t))}))})})}mkdirs(){return new Promise((t,e)=>{var i,r,n,a,s,o;if(a=[],"Section"!==this.type)for(i=r=0,n=(s=this.nodes).length;r{var i;return(i=r=>0===r.length?t():r.splice(0,1)[0].mkdirs().then(()=>i(r)).catch((function(t){return e(__e(t))})))(a)}).catch((function(t){return e(__e(t))}))})}updateMeta(){return new Promise((t,e)=>{var i,r,n,a,s,o,h;if(!this.metaFile.dirty)return t();for(r=[],n=a=0,s=(o=this.nodes).length;a(this.metaFile.dirty=!1,t())).catch((function(t){return e(__e(t))}))})}update(){return new Promise((t,e)=>this.updateMeta().then(()=>this.descFile.dirty?this.descFile.write("text/plain").then(e=>(this.descFile.dirty=!1,t())).catch((function(t){return e(__e(t))})):t()).catch((function(t){return e(__e(t))})))}updateAll(){return new Promise((t,e)=>{var i,r,n,a,s,o;for(a=[],i=r=0,n=(s=this.nodes).length;r{var i;return(i=r=>0===r.length?t():r.splice(0,1)[0].updateAll().then(()=>i(r)).catch((function(t){return e(__e(t))})))(a)}).catch((function(t){return e(__e(t))}))})}toc(){var t,e,i;for(this.updateName(),t=0,e=(i=this.nodes).length;tthis.mkdirs().then(()=>this.updateAll().then(()=>t()).catch((function(t){return e(__e(t))}))).catch((function(t){return e(__e(t))})))}},Chapter:i=class extends a{constructor(t){super("Chapter",`${t.path}/c_${t.cnt}`,!0),t.add(this)}},Section:s=class extends a{constructor(t){super("Section",`${t.path}/s_${t.cnt}`,!0),t.add(this)}},File:n=class extends r{constructor(t){super("Untitle file"),this.section=t,this.hasMeta=!1,this.type="File",this.path=`${this.section.path}/f_${this.section.cnt}.md`,this.descFile=this.path.asFileHandle(),this.section.add(this)}updateAll(){return new Promise((t,e)=>this.descFile.dirty?this.descFile.write("text/plain").then(e=>(this.descFile.dirty=!1,t())).catch(t=>e(__e(t))):t())}read(t){return new Promise((e,i)=>(this.loaded=!1,this.treepath=t,this.path=t,this.descFile=this.path.asFileHandle(),e()))}toc(){return this.updateName(),this}}}}).call(this); \ No newline at end of file +(function(){var t,e,i,r,n,a,s,o;(t=class extends this.OS.application.BaseApplication{constructor(t){super("Booklet",t)}main(){return this.tree=this.find("toc-ui"),this.currentToc=void 0,this.dirty=!1,this.emux=!1,this.on("treeselect",t=>{var e;return e=t.data.item.data,this.currentToc===e||void 0===e||0===e.treepath?this.reloadEditor():(e.treepath=e.path,this.load(e).then(()=>this.open(e)).catch(t=>(e.loaded=!0,this.open(e),this.error(__("Error when loading '{0}': {1}",e.text,t.toString()),t))))}),this.tree.ondragndrop=t=>this.dndhandle(t),this.initEditor(),this.resizeContent(),this.tree.contextmenuHandle=(t,e)=>{var i;if(i=this.contextMenu())return e.items=i,e.onmenuselect=t=>this[t.data.item.data.dataid](),e.show(t)},this.editor.codemirror.on("change",()=>{if(!this.emux&&this.currentToc)return this.currentToc.descFile.dirty=!0,this.dirty=!0})}newChapter(){var t;return this.currentToc&&"Book"===this.currentToc.type?(t=new i(this.book),this.displayToc(),t.treepath=t.path):this.error(__("No book selected"))}newSection(){var t;return this.currentToc&&"Chapter"===this.currentToc.type?(t=new s(this.currentToc),this.displayToc(),t.treepath=t.path):this.error(__("No chapter selected"))}newFile(){var t;return this.currentToc&&"Section"===this.currentToc.type?(t=new n(this.currentToc),this.displayToc(),t.treepath=t.path):this.error(__("No section selected"))}delete(){var t;return this.currentToc?(t=()=>(this.currentToc=void 0,this.displayToc(),this.reloadEditor()),this.currentToc.remove().then(()=>(this.notify(__("Entrie deleted")),t())).catch(e=>(this.error(e.toString(),e),t()))):this.error(__("No entrie select"))}goUp(){if(this.currentToc&&"Book"!==this.currentToc.type)return this.currentToc.parent.up(this.currentToc),this.displayToc()}goDown(){if(this.currentToc&&"Book"!==this.currentToc.type)return this.currentToc.parent.down(this.currentToc),this.displayToc()}load(t){return new Promise((e,i)=>t.loaded?e():t.descFile.meta().then(r=>t.descFile.read().then(i=>(t.descFile.cache=i,t.loaded=!0,t.descFile.dirty=!1,e())).catch((function(t){return i(__e(t))}))).catch((function(t){return i(__e(t))})))}dndhandle(t){var e,i;if(t&&t.data&&(e=t.data.from[0].data,i=t.data.to.data,e&&i&&"Book"!==e.type&&"Chapter"!==e.type&&e.parent!==i.parent&&e.parent!==i))return i.type===e.type&&(i=i.parent),i.type===e.parent.type?e.parent.removeChild(e).then(()=>(i.add(e),this.displayToc())):void 0}upload(){if(this.currentToc&&"File"!==this.currentToc.type)return this.currentToc.path.asFileHandle().upload().then(()=>this.notify(__("File uploaded"))).catch(t=>this.error(__("Unable to upload file {0}",t.toString()),t))}contextMenu(){if(this.currentToc)switch(this.currentToc.type){case"Book":return[{text:__("New chapter"),dataid:"newChapter"},{text:__("Delete book"),dataid:"delete"},{text:__("Upload media"),dataid:"upload"}];case"Chapter":return[{text:__("New section"),dataid:"newSection"},{text:__("Delete chapter"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"},{text:__("Upload media"),dataid:"upload"}];case"Section":return[{text:__("New file"),dataid:"newFile"},{text:__("Delete section"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"},{text:__("Upload media"),dataid:"upload"}];case"File":return[{text:__("Delete file"),dataid:"delete"},{text:__("Go up"),dataid:"goUp"},{text:__("Go down"),dataid:"goDown"}]}}shareFile(t,e){return this.openDialog("FileDialog",{title:__("Select a file"),mimes:t}).then(t=>t.file.path.asFileHandle().publish().then((function(t){return e(t.result)})).catch(t=>this.error(__("Cannot export file for embedding to text"),t))).catch(t=>this.error(t.toString(),t))}initEditor(){var t;return t=this.find("markarea"),this.container=this.find("mycontainer"),this.previewOn=!1,this.editormux=!1,this.editor=new EasyMDE({element:t,autoDownloadFontAwesome:!1,autofocus:!0,tabSize:4,indentWithTabs:!0,toolbar:["bold","italic","heading","|","quote","code","unordered-list","ordered-list","|","link","image","table","horizontal-rule",{name:"shared image",className:"fa fa-share-square",action:t=>this.shareFile(["image/.*"],t=>this.editor.codemirror.getDoc().replaceSelection(`![](${this._api.handler.shared}/${t})`))},{name:"local image",className:"fa fa-file-image-o",action:t=>{if(this.book)return this.openDialog("FileDialog",{title:__("Select image file"),mimes:["image/.*"],root:this.book.path}).then(t=>{var e;return e=t.file.path.replace(this.book.path,""),this.editor.codemirror.getDoc().replaceSelection(`[[@book:image:${e}]]`)}).catch(t=>this.error(t.toString(),t))}},{name:"Youtube",className:"fa fa-youtube",action:t=>{var e,i;return e=this.editor.codemirror.getDoc(),i=this.editor.codemirror.getSelection()||"",e.replaceSelection(`[[youtube:${i}]]`)}},{name:"3d object",className:"fa fa-cube",action:t=>{if(this.book)return this.openDialog("FileDialog",{title:__("Select 3d model"),mimes:["text/wavefront-obj","model/gltf-binary"],root:this.book.path}).then(t=>{var e;return e=t.file.path.replace(this.book.path,""),this.editor.codemirror.getDoc().replaceSelection(`[[@book:3dmodel:${e}]]`)}).catch(t=>this.error(t.toString(),t))}},"|",{name:__("Preview"),className:"fa fa-eye no-disable",action:t=>(EasyMDE.togglePreview(t),renderMathInElement(this.find("mycontainer")),this.renderLocalElement())}],previewRender:(t,e)=>{var i;return this.book&&(t=t.replace(/\[\[@book:image:([^\]]*)\]\]/g,(t,e)=>`![](${this._api.handle.get}/${this.book.path}/${e})`)),i=this.editor.markdown(t),e.innerHTML=i}}),this.on("resize",t=>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"))}reloadEditor(){return void 0===this.currentToc?(this.editor.value(""),this.scheme.apptitle=this.name):(this.editor.value(this.currentToc.descFile.cache||""),this.scheme.apptitle="Booklet - "+this.currentToc.descFile.path)}saveContext(){if(this.currentToc)return this.currentToc.descFile.cache=this.editor.value()}resizeContent(){var t,e,i,r,n;return e=$(".EasyMDEContainer",this.container).children(),r=$(this.scheme).find(".afx-window-top")[0],n=e[0],i=e[3],t=$(this.scheme).height()-$(r).height()-$(n).height()-$(i).height()-40,$(e[1]).css("height",t+"px")}menu(){return[{text:"__(File)",nodes:[{text:"__(New booklet)",dataid:this.name+"-New",shortcut:"A-N"},{text:"__(Open a booklet)",dataid:this.name+"-Open",shortcut:"A-O"},{text:"__(Save a booklet)",dataid:this.name+"-Save",shortcut:"C-S"}],onchildselect:t=>this.actionFile(t.data.item.data.dataid)}]}actionFile(t){switch(t){case this.name+"-Open":return this.checkForDirty(()=>this.openDialog("FileDialog",{title:__("Open book"),mimes:["dir"]}).then(t=>(this.book=new e(t.file.path),this.book.read(t.file.path).then(()=>(this.book.treepath=this.book.path,this.tree.selectedItem=void 0,this.displayToc(),this.notify(__("Book loaded")))).catch(t=>this.error(__("Cannot load book: {0}",t.toString()),t)))).catch(t=>this.error(t.toString(),t)));case this.name+"-New":return this.openDialog("FileDialog",{title:__("New book at"),mimes:["dir"],file:{basename:__("BookName")}}).then(t=>this.newAt(`${t.file.path}/${t.name}`)).catch(t=>this.error(t.toString(),t));case this.name+"-Save":if(!this.book)return;return this.currentToc&&this.saveContext(),this.displayToc(),this.book.save().then(()=>(this.dirty=!1,this.notify(__("Book saved")))).catch(t=>this.error(__("Can't save the book : {0}",t.toString()),t))}}checkForDirty(t){return this.dirty?this.ask({title:__("Continue ?"),text:__("Book is unsaved, you want to continue ?")}).then(e=>{if(e)return t()}):t()}open(t){return this.emux=!0,this.saveContext(),this.currentToc=t,this.reloadEditor(),this.displayToc(),this.emux=!1}newAt(t){return this.tree.selectedItem=void 0,this.book=new e(t),this.book.treepath=this.book.path,this.currentToc=void 0,this.reloadEditor(),this.displayToc()}displayToc(){return this.book.toc(),this.tree.data=this.book,this.tree.expandAll()}cleanup(t){if(this.dirty)return t.preventDefault(),this.checkForDirty(()=>(this.dirty=!1,this.quit()))}renderLocalElement(){}}).dependencies=["pkg://SimpleMDE/main.js","pkg://SimpleMDE/main.css","pkg://Katex/main.js","pkg://Katex/main.css"],this.OS.register("Booklet",t),r=class{constructor(t){this.text=t,this.loaded=!0}save(){}remove(){}toc(){}updateName(){var t;return(t=new RegExp("^s*#+(.*)\n","g").exec(this.descFile.cache))&&2===t.length?(this.hasMeta&&this.metaFile&&(this.metaFile.dirty=!0),this.parent&&this.parent.hasMeta&&this.parent.metaFile&&(this.parent.metaFile.dirty=!0),this.text=t[1].trim()):this.text}remove(){return new Promise((t,e)=>{var i;return(i=this.path.asFileHandle()).meta().then(r=>i.remove().then(i=>this.parent?this.parent.removeChild(this).then((function(){return t()})).catch((function(t){return e(__e(t))})):t()).catch((function(t){return e(__e(t))}))).catch(i=>this.parent?this.parent.removeChild(this).then((function(){return t()})).catch((function(t){return e(__e(t))})):t())})}},a=class extends r{constructor(t,e,i){super("Untitle"),this.type=t,this.path=e,this.hasMeta=i,this.init()}init(){return this.cnt=0,this.nodes=[],this.hasMeta&&(this.metaFile=(this.path+"/meta.json").asFileHandle()),this.descFile=(this.path+"/INTRO.md").asFileHandle()}up(t){var e;if(t&&(e=this.nodes.indexOf(t))>0)return this.nodes.splice(e,1),this.nodes.splice(e-1,0,t)}down(t){var e;if(t&&(e=this.nodes.indexOf(t))>=0&&e(this.nodes.splice(this.nodes.indexOf(t),1),this.hasMeta&&this.metaFile?(this.metaFile.dirty=!0,this.updateMeta().then((function(){return e()})).catch((function(t){return i(__e(t))}))):e()))}read(t){return new Promise((e,i)=>(this.path=t,this.init(),this.loaded=!1,this.metaFile.meta().then(t=>this.metaFile.read("json").then(t=>{var i,r,n,a,s,h,c;for(this.text=t.name,s=[],r=n=0,a=(h=t.entries).length;n{var n,a;return 0===r.length?(this.cnt=t.cnt,e()):(n=r.splice(0,1)[0],(a=new o[n.type](this)).name=n.name,a.read(n.path.replace("book://",this.root)).then(()=>i(r)).catch(t=>i(r)))})(s)}).catch((function(t){return i(__e(t))}))).catch((function(t){return i(__e(t))}))))}size(){return this.nodes.length}mkdir(){return new Promise((t,e)=>{var i;return(i=this.path.asFileHandle()).meta().then(e=>t()).catch(r=>{var n;return n=i.basename,(i=i.parent().asFileHandle()).mk(n).then(e=>t()).catch((function(t){return e(__e(t))}))})})}mkdirs(){return new Promise((t,e)=>{var i,r,n,a,s,o;if(a=[],"Section"!==this.type)for(i=r=0,n=(s=this.nodes).length;r{var i;return(i=r=>0===r.length?t():r.splice(0,1)[0].mkdirs().then(()=>i(r)).catch((function(t){return e(__e(t))})))(a)}).catch((function(t){return e(__e(t))}))})}updateMeta(){return new Promise((t,e)=>{var i,r,n,a,s,o,h;if(!this.metaFile.dirty)return t();for(r=[],n=a=0,s=(o=this.nodes).length;a(this.metaFile.dirty=!1,t())).catch((function(t){return e(__e(t))}))})}update(){return new Promise((t,e)=>this.updateMeta().then(()=>this.descFile.dirty?this.descFile.write("text/plain").then(e=>(this.descFile.dirty=!1,t())).catch((function(t){return e(__e(t))})):t()).catch((function(t){return e(__e(t))})))}updateAll(){return new Promise((t,e)=>{var i,r,n,a,s,o;for(a=[],i=r=0,n=(s=this.nodes).length;r{var i;return(i=r=>0===r.length?t():r.splice(0,1)[0].updateAll().then(()=>i(r)).catch((function(t){return e(__e(t))})))(a)}).catch((function(t){return e(__e(t))}))})}toc(){var t,e,i;for(this.updateName(),t=0,e=(i=this.nodes).length;tthis.mkdirs().then(()=>this.updateAll().then(()=>t()).catch((function(t){return e(__e(t))}))).catch((function(t){return e(__e(t))})))}},Chapter:i=class extends a{constructor(t){super("Chapter",`${t.path}/c_${t.cnt}`,!0),t.add(this)}},Section:s=class extends a{constructor(t){super("Section",`${t.path}/s_${t.cnt}`,!0),t.add(this)}},File:n=class extends r{constructor(t){super("Untitle file"),this.section=t,this.hasMeta=!1,this.type="File",this.path=`${this.section.path}/f_${this.section.cnt}.md`,this.descFile=this.path.asFileHandle(),this.section.add(this)}updateAll(){return new Promise((t,e)=>this.descFile.dirty?this.descFile.write("text/plain").then(e=>(this.descFile.dirty=!1,t())).catch(t=>e(__e(t))):t())}read(t){return new Promise((e,i)=>(this.loaded=!1,this.treepath=t,this.path=t,this.descFile=this.path.asFileHandle(),e()))}toc(){return this.updateName(),this}}}}).call(this); \ No newline at end of file diff --git a/Booklet/build/debug/package.json b/Booklet/build/debug/package.json index 50fbbd3..6f548a9 100644 --- a/Booklet/build/debug/package.json +++ b/Booklet/build/debug/package.json @@ -7,9 +7,9 @@ "author": "Xuan Sang LE", "email": "mrsang@lxsang.me" }, - "version":"0.2.4-a", + "version":"0.2.5-a", "category":"Office", "iconclass":"bi bi-journals", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"], "mimes":["dir"] } \ No newline at end of file diff --git a/Booklet/build/release/Booklet.zip b/Booklet/build/release/Booklet.zip index 8667cb3c45d62cc24adf0d8dd21eb08c551d2820..5b0f39545a73419ad2a2cfa5d125010a739e7901 100644 GIT binary patch delta 4791 zcmZ`-Wl)?;yTpULYp_7@;Fbk~1z%i)yDS9v7Yj~;E$*&iad(2ddyo);CAdpIQuWn6 z_nxXd^JiwdpL%MhdVX|Iv+lD3U?pS}Oauf3bOhWEMx6nnbrC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-(kxIKiijxG$I`Uu$x4!h4@7NRIay?dDyz#4g~L>kn+rDK_Jqpp>${ zEY+_JRGo{T#vO8riZvcC+Q=~mPUW0Wp>~>FMqdu+3zdBX6fZJf-HbK$(QAryzu(@w zBvbf(+N^=IeE|$q>GfAs#hpCy_I@6BB*dyEa)8!A`nzJ@i#~0brBq{4#e94O7`x3m zv{8Xk0nj*J0m1^_8W?EP4JmU99tz*)tv~w)*6v&`FvKH7hqQg-NZ$ zV(*#VS}X_mt}_Hbk3HmuaSXYgyb2PU8tA7~J-q-2=`I-d{~%`mHSzr;(GOdJ!J_=2 zJV+&#v`A~0DzxScRB46GeTel?4;4THy22%(Cw~wEty#J#i7K0yhxljNeeX^1W3}*)RMFSF=0|u(u<1fgi{jaj!EMvaT&rKzr1|lcZ`#D{w0mTrg^?kfHJhjNCS#!_&Eh5m{)zVsTjt0@_{x6LU&MoT%uKW8*V&k`5=CxUvSrC+FYISUzU7uN~I? z-pGrv1O0SGKd8Prb0xmCuzp@Rvm#RFVtwFAI6+mqq^HvIAt6`Qf`&I`HJv0})?F!S z{SH@M83z{(_`fm{~7Zy&i^ZJ{8xwU-%0+i%J7mu&@jsU;|}~M9{)S89RGh{SzQ@O@XrPC O@1*^!#!mCk?!N%~{II$J diff --git a/Booklet/coffees/main.coffee b/Booklet/coffees/main.coffee index 82a0d9f..00eef0a 100644 --- a/Booklet/coffees/main.coffee +++ b/Booklet/coffees/main.coffee @@ -166,7 +166,7 @@ class Booklet extends this.OS.application.BaseApplication @previewOn = false @editormux = false - @editor = new SimpleMDE + @editor = new EasyMDE element: markarea autoDownloadFontAwesome: false autofocus: true @@ -232,7 +232,7 @@ class Booklet extends this.OS.application.BaseApplication name: __("Preview"), className: "fa fa-eye no-disable", action: (e) => - SimpleMDE.togglePreview e + EasyMDE.togglePreview e #/console.log @select ".editor-preview editor-preview-active" renderMathInElement @find "mycontainer" @renderLocalElement() @@ -246,7 +246,7 @@ class Booklet extends this.OS.application.BaseApplication preview.innerHTML = html - @on "hboxchange", (e) => @resizeContent() + @on "resize", (e) => @resizeContent() @bindKey "ALT-N", () => @actionFile "#{@name}-New" @bindKey "ALT-O", () => @actionFile "#{@name}-Open" @bindKey "CTRL-S", () => @actionFile "#{@name}-Save" @@ -263,12 +263,12 @@ class Booklet extends this.OS.application.BaseApplication @currentToc.descFile.cache = @editor.value() resizeContent: () -> - children = ($ @container).children() + children = ($ ".EasyMDEContainer", @container).children() titlebar = (($ @scheme).find ".afx-window-top")[0] - toolbar = children[1] - statusbar = children[4] + toolbar = children[0] + statusbar = children[3] cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 40 - ($ children[2]).css("height", cheight + "px") + ($ children[1]).css("height", cheight + "px") menu: () -> diff --git a/Booklet/package.json b/Booklet/package.json index 50fbbd3..6f548a9 100644 --- a/Booklet/package.json +++ b/Booklet/package.json @@ -7,9 +7,9 @@ "author": "Xuan Sang LE", "email": "mrsang@lxsang.me" }, - "version":"0.2.4-a", + "version":"0.2.5-a", "category":"Office", "iconclass":"bi bi-journals", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"], + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"], "mimes":["dir"] } \ No newline at end of file diff --git a/packages.json b/packages.json index 80318ae..c75cf7f 100644 --- a/packages.json +++ b/packages.json @@ -95,8 +95,8 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/Blogger/README.md", "category": "Internet", "author": "Xuan Sang LE", - "version": "0.2.8-a", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"],"mimes":["none"], + "version": "0.2.9-a", + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"],"mimes":["none"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/Blogger/build/release/Blogger.zip" }, { @@ -105,8 +105,8 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/Booklet/README.md", "category": "Office", "author": "Xuan Sang LE", - "version": "0.2.4-a", - "dependencies": ["SimpleMDE@1.11.2-r","Katex@0.11.1-r"],"mimes":["dir"], + "version": "0.2.5-a", + "dependencies": ["SimpleMDE@2.18.0-r","Katex@0.11.1-r"],"mimes":["dir"], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/Booklet/build/release/Booklet.zip" }, {