-
-
\ No newline at end of file
diff --git a/Blogger/build/debug/main.js b/Blogger/build/debug/main.js
index 985e4f6..719622c 100644
--- a/Blogger/build/debug/main.js
+++ b/Blogger/build/debug/main.js
@@ -1 +1,1180 @@
-(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