diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f2ff4..dd00ac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### v2.0.2 - Added option button to jump directly to plugin options (thanks to Aleksander Machniak) +- Added function to paste selected text from browser, converted automatically to Markdown with [Turndown](https://github.com/domchristie/turndown) +- Added support for Markdownload [Browser Extension](https://github.com/deathau/markdownload) + - YAML header autofills all supported fields (title, author, date, source and more) ### v2.0.1 - Remove ToC button in edit mode diff --git a/js/notes.js b/js/notes.js index 1c383fa..faaa3bb 100644 --- a/js/notes.js +++ b/js/notes.js @@ -1,13 +1,13 @@ /** * Roundcube Notes Plugin * - * @version 2.0.1 + * @version 2.0.2 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 */ $(document).ready(function(){ - var tagify = new Tagify(document.querySelector('#ntags'), { + var tagify = new Tagify(document.querySelector('#ntags'), { whitelist:[], dropdown : { classname : "color-blue", @@ -40,7 +40,9 @@ $(document).ready(function(){ spellChecker: false, autofocus: true, status: false, - promptURLs: true, + promptURLs: true, + inputStyle: 'contenteditable', + nativeSpellcheck: true, //sideBySideFullscreen: false, renderingConfig: { codeSyntaxHighlighting: true, @@ -65,8 +67,7 @@ $(document).ready(function(){ }, 'table', '|', 'preview', 'side-by-side', 'fullscreen', 'guide', '|' ], - - }); + }); document.querySelectorAll('#filelist li a').forEach(function(note){ note.addEventListener('click',function(){ @@ -81,7 +82,7 @@ $(document).ready(function(){ if('ttags' in e.data && e.data.ttags == '') tagify.removeAllTags(); if('editor' in e.data && e.data.editor == 'new') { if(estate.value == 's') { - mde.togglePreview(); + mde.togglePreview(); estate.value = 'e'; } mde.value(""); @@ -93,6 +94,11 @@ $(document).ready(function(){ document.querySelector('#main_area .editor-toolbar').style.display = 'block'; document.querySelector('.EasyMDEContainer').style = 'display: block'; mde.value(''); + editor1.style = 'display: none;' + document.getElementById('author').value = ''; + document.getElementById('date').value = ''; + document.getElementById('source').value = ''; + document.querySelector('#main_area .EasyMDEContainer').addEventListener('paste', pasteParse, false); } else { let toolbar = document.createElement('div'); toolbar.id = 'atoolbar'; @@ -112,7 +118,7 @@ $(document).ready(function(){ } if('editor' in e.data && e.data.editor == 'edit') { if(estate.value == 's') { - mde.togglePreview(); + mde.togglePreview(); estate.value = 'e'; } @@ -175,6 +181,45 @@ $(document).ready(function(){ new rcube_splitter({ id:'notessplitter', p1:'#sidebar', p2:'#main', orientation:'v', relative:true, start:400, min:250, size:12 }).init(); + function pasteParse(event) { + const pastedText = event.clipboardData.getData('text'); + const pastedHTML = event.clipboardData.getData('text/html'); + let textArr = pastedText.split('\n'); + if(textArr[0] == '---') { + let cstart = pastedText.indexOf('---',4) + 3; + for(var i = 1; i < 10; i++) { + if(textArr[i] == '---') break; + console.log(textArr[i]); + let yentry = textArr[i].split(':'); + if(yentry[0] == 'title') document.getElementById('note_name').value = yentry[1].trim(); + if(yentry[0] == 'tags') tagify.addTags(yentry[1]); + if(yentry[0] == 'author') document.getElementById('author').value = yentry[1].trim(); + if(yentry[0] == 'date') document.getElementById('date').value = yentry.slice(1).join(':').trim(); + if(yentry[0] == 'source') document.getElementById('source').value = yentry.slice(1).join(':').trim(); + } + mde.value(pastedText.substr(cstart).trim()); + } + + if(pastedHTML) { + var options = { + headingStyle: 'atx', + hr: '-', + bulletListMarker: '-', + codeBlockStyle: 'fenced', + fence: '```', + emDelimiter: '*', + strongDelimiter: '**', + linkStyle: 'inlined', + linkReferenceStyle: 'full', + collapseMultipleWhitespaces: true, + preformattedCode: true, + }; + var turndownService = new window.TurndownService(options); + turndownService.keep(['kbd', 'ins']); + mde.value(turndownService.turndown(pastedHTML)); + } + } + function firstNote() { showNote(document.getElementById('filelist').firstElementChild.classList[0]); } @@ -238,7 +283,6 @@ $(document).ready(function(){ }, success: function(data){ var note = JSON.parse(data); - if(document.getElementById('bcontent')) document.getElementById('bcontent').remove(); document.querySelector('.EasyMDEContainer').classList.remove('EasyMDEContainerH'); if(document.getElementById('tocdiv')) document.getElementById('tocdiv').remove(); @@ -251,6 +295,9 @@ $(document).ready(function(){ document.getElementById('headerTitle').innerText = note.notename; document.getElementById('fname').value = note.filename; + document.getElementById('author').value = note.author; + document.getElementById('date').value = note.date; + document.getElementById('source').value = note.source; tagify.setReadonly(true); tagify.removeAllTags(); @@ -377,6 +424,9 @@ $(document).ready(function(){ ntags: tArr, editor1: mde.value(), ftype: fname.substr(extb), + author: document.getElementById('author').value, + date: document.getElementById('date').value, + source: document.getElementById('source').value, }, success: function(response){ if(response == '') { diff --git a/js/notes.min.js b/js/notes.min.js index 496afc8..ce4df6f 100644 --- a/js/notes.min.js +++ b/js/notes.min.js @@ -1,9 +1,9 @@ /** * Roundcube Notes Plugin * - * @version 2.0.1 + * @version 2.0.2 * @author Offerel * @copyright Copyright (c) 2021, Offerel * @license GNU General Public License, version 3 */ -$(document).ready((function(){var tagify=new Tagify(document.querySelector("#ntags"),{whitelist:[],dropdown:{classname:"color-blue",enabled:0,maxItems:0,position:"text",closeOnSelect:!1,highlightFirst:!0},trim:!0,duplicates:!1,enforceWhitelist:!1,delimiters:",|;| ",placeholder:"Tags"});$.ajax({type:"POST",url:"notes.php",data:{action:"getTags"},success:function(data){tagify.settings.whitelist=JSON.parse(data)}});var mde=new EasyMDE({element:document.getElementById("editor1"),autoDownloadFontAwesome:!1,autofocus:!0,spellChecker:!1,autofocus:!0,status:!1,promptURLs:!0,renderingConfig:{codeSyntaxHighlighting:!0},toolbar:[{name:"Save",action:saveFile,className:"fa fa-floppy-o",title:"Save"},"|","undo","redo","|","bold","italic","strikethrough","clean-block","|","heading","heading-smaller","heading-bigger","|","code","quote","unordered-list","ordered-list","|","link",{name:"Image",action:uplInsertImage,className:"fa fa-picture-o",title:"Add image from URL"},{name:"Image",action:uplLocalImage,className:"fa fa-file-image-o",title:"Upload and insert local image"},"table","|","preview","side-by-side","fullscreen","guide","|"]});function firstNote(){showNote(document.getElementById("filelist").firstElementChild.classList[0])}function sbfile(){let tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"sbfile",name:document.getElementById("note_name").value,fname:document.getElementById("fname").value,tags:tArr,content:document.getElementById("editor1").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response)}})}function showNote(id){document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),document.getElementById("tbutton")&&document.getElementById("tbutton").remove();let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),document.getElementById("save_button").style.display="none";for(var elements=document.getElementsByClassName("selected");elements.length>0;)elements[0].classList.remove("selected");document.getElementById(id).classList.add("selected"),window.parent.document.getElementById("editnote").classList.remove("disabled"),window.parent.document.getElementById("deletenote").classList.remove("disabled"),window.parent.document.getElementById("sendnote").classList.remove("disabled");var fname=document.getElementById("entry"+id).value;$.ajax({type:"POST",url:"notes.php",data:{action:"showNote",filename:fname,id:id},success:function(data){var note=JSON.parse(data);document.getElementById("bcontent")&&document.getElementById("bcontent").remove(),document.querySelector(".EasyMDEContainer").classList.remove("EasyMDEContainerH"),document.getElementById("tocdiv")&&document.getElementById("tocdiv").remove();let headerTitle=document.createElement("span");if(headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),document.querySelector("#main_header #note_name")&&document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),document.getElementById("headerTitle").innerText=note.notename,document.getElementById("fname").value=note.filename,tagify.setReadonly(!0),tagify.removeAllTags(),tagify.addTags(note.tags),document.querySelector(".EasyMDEContainer").style="display: block;",document.getElementById("editor1").style="display none;",mde.value(note.content),document.getElementById("editor1").value=note.content,"text"==note.mime_type.substr(0,4)){"e"==document.getElementById("estate").value&&(document.getElementById("estate").value="s",mde.togglePreview());var headings=document.querySelectorAll("h1, h2, h3, h4, h5, h6");if(headings.length>0){let tbutton=document.createElement("button");tbutton.id="tbutton",tbutton.innerText="ToC",document.getElementById("main_header").appendChild(tbutton);let tocdiv=document.createElement("div");tocdiv.id="tocdiv";let o=0,a=0,list="c%";headings.forEach((function(element){a=element.tagName.substr(1,1),list=o"):o>a?list.replace("c%",'
  • '+element.innerText+"
  • c%"):list.replace("c%",'
  • '+element.innerText+"
  • c%"),o=a})),list=list.replace("c%",""),tocdiv.innerHTML=list,tbutton.addEventListener("click",(function(e){e.preventDefault(),tocdiv.classList.toggle("tdhidden")})),document.querySelector(".EasyMDEContainer").appendChild(tocdiv),document.querySelectorAll("#tocdiv a").forEach((function(elem){elem.addEventListener("click",(function(){tocdiv.classList.toggle("tdhidden")}))}))}}else{let bcontent=document.createElement("object");bcontent.data="data:"+note.mime_type+";base64,"+note.content,bcontent.type=note.mime_type,bcontent.id="bcontent",note.mime_type.includes("pdf")&&(bcontent.style="width: 100%; height: 100%;"),document.querySelector(".EasyMDEContainer").classList.add("EasyMDEContainerH"),document.getElementById("main_area").appendChild(bcontent),document.getElementById("editor1").style="display: none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove()}document.getElementById("db-spinner").parentNode.removeChild(loader)}})}function simage(){for(var allowed_extensions=new Array("jpg","jpeg","png"),file_extension=document.getElementById("localimg").value.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension){var file_data=$("#localimg").prop("files")[0],formData=new FormData;return formData.append("localFile",file_data),$.ajax({type:"POST",url:"notes.php",dataType:"text",cache:!1,contentType:!1,processData:!1,data:formData,success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}}),!0}return alert("Unsupported file format"),!1}function saveFile(editor){let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader);let fname=document.getElementById("fname").value,extb=fname.lastIndexOf(".")+1,tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"editNote",note_name:document.getElementById("note_name").value,fname:fname,ntags:tArr,editor1:mde.value(),ftype:fname.substr(extb)},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response),loader.remove()}})}function uplLocalImage(){document.getElementById("localimg").click()}function uplInsertImage(){var imageURL=prompt("URL of the image","");if(!imageURL)return!1;$.ajax({type:"POST",url:"notes.php",data:{action:"uplImage",imageURL:imageURL},success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}})}function searchList(){var input,filter,ul,li,a,i;for(filter=(input=document.getElementById("notesearch")).value.toUpperCase(),li=(ul=document.getElementById("filelist")).getElementsByTagName("li"),i=0;i-1?li[i].style.display="":li[i].style.display="none"}document.querySelectorAll("#filelist li a").forEach((function(note){note.addEventListener("click",(function(){showNote(note.parentElement.id),tagify.setReadonly(!0)}))})),window.addEventListener("message",e=>{let estate=document.getElementById("estate");if("tstate"in e.data&&tagify.setReadonly(e.data.tstate),"ttags"in e.data&&""==e.data.ttags&&tagify.removeAllTags(),"editor"in e.data&&"new"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e"),mde.value(""),document.getElementById("fname").value="";let editor1=document.getElementById("editor1");if(editor1.value="","md"==e.data.format)document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector(".EasyMDEContainer").style="display: block",mde.value("");else{let toolbar=document.createElement("div");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor1.parentNode.insertBefore(toolbar,editor1),document.querySelector(".EasyMDEContainer").style="display: none",editor1.style="display: block"}}if("editor"in e.data&&"edit"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e");let file=document.getElementById("fname").value.split("."),format=file[file.length-1];switch(document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),format){case"md":document.querySelector(".EasyMDEContainer").style="display: block;",document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector("#editor1").style="display: none;";break;default:let toolbar=document.createElement("div"),editor=document.getElementById("editor1");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor.parentNode.insertBefore(toolbar,editor),document.querySelector(".EasyMDEContainer").style="display: none",editor.style="display: block",document.getElementById("bcontent")&&(document.getElementById("editor1").style="display: none")}}}),document.addEventListener("keyup",event=>{if("Escape"==event.key&&"e"==document.getElementById("estate").value){mde.togglePreview(),document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("estate").value="s";let headerTitle=document.createElement("span");headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),headerTitle.innerText=document.getElementById("note_name").value,document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),tagify.setReadonly(!0)}}),document.getElementById("notesearch").addEventListener("keyup",searchList,!1),document.getElementById("save_button").addEventListener("click",(function(){document.getElementById("metah").submit()})),document.getElementById("localimg").addEventListener("change",simage,!1),new rcube_splitter({id:"notessplitter",p1:"#sidebar",p2:"#main",orientation:"v",relative:!0,start:400,min:250,size:12}).init(),firstNote()})); \ No newline at end of file +$(document).ready((function(){var tagify=new Tagify(document.querySelector("#ntags"),{whitelist:[],dropdown:{classname:"color-blue",enabled:0,maxItems:0,position:"text",closeOnSelect:!1,highlightFirst:!0},trim:!0,duplicates:!1,enforceWhitelist:!1,delimiters:",|;| ",placeholder:"Tags"});$.ajax({type:"POST",url:"notes.php",data:{action:"getTags"},success:function(data){tagify.settings.whitelist=JSON.parse(data)}});var mde=new EasyMDE({element:document.getElementById("editor1"),autoDownloadFontAwesome:!1,autofocus:!0,spellChecker:!1,autofocus:!0,status:!1,promptURLs:!0,inputStyle:"contenteditable",nativeSpellcheck:!0,renderingConfig:{codeSyntaxHighlighting:!0},toolbar:[{name:"Save",action:saveFile,className:"fa fa-floppy-o",title:"Save"},"|","undo","redo","|","bold","italic","strikethrough","clean-block","|","heading","heading-smaller","heading-bigger","|","code","quote","unordered-list","ordered-list","|","link",{name:"Image",action:uplInsertImage,className:"fa fa-picture-o",title:"Add image from URL"},{name:"Image",action:uplLocalImage,className:"fa fa-file-image-o",title:"Upload and insert local image"},"table","|","preview","side-by-side","fullscreen","guide","|"]});function pasteParse(event){const pastedText=event.clipboardData.getData("text"),pastedHTML=event.clipboardData.getData("text/html");let textArr=pastedText.split("\n");if("---"==textArr[0]){let cstart=pastedText.indexOf("---",4)+3;for(var i=1;i<10&&"---"!=textArr[i];i++){console.log(textArr[i]);let yentry=textArr[i].split(":");"title"==yentry[0]&&(document.getElementById("note_name").value=yentry[1].trim()),"tags"==yentry[0]&&tagify.addTags(yentry[1]),"author"==yentry[0]&&(document.getElementById("author").value=yentry[1].trim()),"date"==yentry[0]&&(document.getElementById("date").value=yentry.slice(1).join(":").trim()),"source"==yentry[0]&&(document.getElementById("source").value=yentry.slice(1).join(":").trim())}mde.value(pastedText.substr(cstart).trim())}if(pastedHTML){var options={headingStyle:"atx",hr:"-",bulletListMarker:"-",codeBlockStyle:"fenced",fence:"```",emDelimiter:"*",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",collapseMultipleWhitespaces:!0,preformattedCode:!0},turndownService=new window.TurndownService(options);turndownService.keep(["kbd","ins"]),mde.value(turndownService.turndown(pastedHTML))}}function firstNote(){showNote(document.getElementById("filelist").firstElementChild.classList[0])}function sbfile(){let tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"sbfile",name:document.getElementById("note_name").value,fname:document.getElementById("fname").value,tags:tArr,content:document.getElementById("editor1").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response)}})}function showNote(id){document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),document.getElementById("tbutton")&&document.getElementById("tbutton").remove();let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader),document.getElementById("save_button").style.display="none";for(var elements=document.getElementsByClassName("selected");elements.length>0;)elements[0].classList.remove("selected");document.getElementById(id).classList.add("selected"),window.parent.document.getElementById("editnote").classList.remove("disabled"),window.parent.document.getElementById("deletenote").classList.remove("disabled"),window.parent.document.getElementById("sendnote").classList.remove("disabled");var fname=document.getElementById("entry"+id).value;$.ajax({type:"POST",url:"notes.php",data:{action:"showNote",filename:fname,id:id},success:function(data){var note=JSON.parse(data);document.getElementById("bcontent")&&document.getElementById("bcontent").remove(),document.querySelector(".EasyMDEContainer").classList.remove("EasyMDEContainerH"),document.getElementById("tocdiv")&&document.getElementById("tocdiv").remove();let headerTitle=document.createElement("span");if(headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),document.querySelector("#main_header #note_name")&&document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),document.getElementById("headerTitle").innerText=note.notename,document.getElementById("fname").value=note.filename,document.getElementById("author").value=note.author,document.getElementById("date").value=note.date,document.getElementById("source").value=note.source,tagify.setReadonly(!0),tagify.removeAllTags(),tagify.addTags(note.tags),document.querySelector(".EasyMDEContainer").style="display: block;",document.getElementById("editor1").style="display none;",mde.value(note.content),document.getElementById("editor1").value=note.content,"text"==note.mime_type.substr(0,4)){"e"==document.getElementById("estate").value&&(document.getElementById("estate").value="s",mde.togglePreview());var headings=document.querySelectorAll("h1, h2, h3, h4, h5, h6");if(headings.length>0){let tbutton=document.createElement("button");tbutton.id="tbutton",tbutton.innerText="ToC",document.getElementById("main_header").appendChild(tbutton);let tocdiv=document.createElement("div");tocdiv.id="tocdiv";let o=0,a=0,list="c%";headings.forEach((function(element){a=element.tagName.substr(1,1),list=o"):o>a?list.replace("c%",'
  • '+element.innerText+"
  • c%"):list.replace("c%",'
  • '+element.innerText+"
  • c%"),o=a})),list=list.replace("c%",""),tocdiv.innerHTML=list,tbutton.addEventListener("click",(function(e){e.preventDefault(),tocdiv.classList.toggle("tdhidden")})),document.querySelector(".EasyMDEContainer").appendChild(tocdiv),document.querySelectorAll("#tocdiv a").forEach((function(elem){elem.addEventListener("click",(function(){tocdiv.classList.toggle("tdhidden")}))}))}}else{let bcontent=document.createElement("object");bcontent.data="data:"+note.mime_type+";base64,"+note.content,bcontent.type=note.mime_type,bcontent.id="bcontent",note.mime_type.includes("pdf")&&(bcontent.style="width: 100%; height: 100%;"),document.querySelector(".EasyMDEContainer").classList.add("EasyMDEContainerH"),document.getElementById("main_area").appendChild(bcontent),document.getElementById("editor1").style="display: none",document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove()}document.getElementById("db-spinner").parentNode.removeChild(loader)}})}function simage(){for(var allowed_extensions=new Array("jpg","jpeg","png"),file_extension=document.getElementById("localimg").value.split(".").pop().toLowerCase(),i=0;i<=allowed_extensions.length;i++)if(allowed_extensions[i]==file_extension){var file_data=$("#localimg").prop("files")[0],formData=new FormData;return formData.append("localFile",file_data),$.ajax({type:"POST",url:"notes.php",dataType:"text",cache:!1,contentType:!1,processData:!1,data:formData,success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}}),!0}return alert("Unsupported file format"),!1}function saveFile(editor){let loader=document.createElement("div");loader.classList.add("db-spinner"),loader.id="db-spinner",document.getElementById("main").appendChild(loader);let fname=document.getElementById("fname").value,extb=fname.lastIndexOf(".")+1,tags=tagify.value,tArr=[];for(let tag in tags)tArr.push(tags[tag].value);$.ajax({type:"POST",url:"notes.php",data:{action:"editNote",note_name:document.getElementById("note_name").value,fname:fname,ntags:tArr,editor1:mde.value(),ftype:fname.substr(extb),author:document.getElementById("author").value,date:document.getElementById("date").value,source:document.getElementById("source").value},success:function(response){""==response?(console.log("Note saved successfully"),location.reload()):alert(response),loader.remove()}})}function uplLocalImage(){document.getElementById("localimg").click()}function uplInsertImage(){var imageURL=prompt("URL of the image","");if(!imageURL)return!1;$.ajax({type:"POST",url:"notes.php",data:{action:"uplImage",imageURL:imageURL},success:function(data){pos=mde.codemirror.getCursor(),mde.codemirror.setSelection(pos,pos),mde.codemirror.replaceSelection("![]("+data+")")}})}function searchList(){var input,filter,ul,li,a,i;for(filter=(input=document.getElementById("notesearch")).value.toUpperCase(),li=(ul=document.getElementById("filelist")).getElementsByTagName("li"),i=0;i-1?li[i].style.display="":li[i].style.display="none"}document.querySelectorAll("#filelist li a").forEach((function(note){note.addEventListener("click",(function(){showNote(note.parentElement.id),tagify.setReadonly(!0)}))})),window.addEventListener("message",e=>{let estate=document.getElementById("estate");if("tstate"in e.data&&tagify.setReadonly(e.data.tstate),"ttags"in e.data&&""==e.data.ttags&&tagify.removeAllTags(),"editor"in e.data&&"new"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e"),mde.value(""),document.getElementById("fname").value="";let editor1=document.getElementById("editor1");if(editor1.value="","md"==e.data.format)document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector(".EasyMDEContainer").style="display: block",mde.value(""),editor1.style="display: none;",document.getElementById("author").value="",document.getElementById("date").value="",document.getElementById("source").value="",document.querySelector("#main_area .EasyMDEContainer").addEventListener("paste",pasteParse,!1);else{let toolbar=document.createElement("div");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor1.parentNode.insertBefore(toolbar,editor1),document.querySelector(".EasyMDEContainer").style="display: none",editor1.style="display: block"}}if("editor"in e.data&&"edit"==e.data.editor){"s"==estate.value&&(mde.togglePreview(),estate.value="e");let file=document.getElementById("fname").value.split("."),format=file[file.length-1];switch(document.getElementById("atoolbar")&&document.getElementById("atoolbar").remove(),format){case"md":document.querySelector(".EasyMDEContainer").style="display: block;",document.querySelector("#main_area .editor-toolbar").style.display="block",document.querySelector("#editor1").style="display: none;";break;default:let toolbar=document.createElement("div"),editor=document.getElementById("editor1");toolbar.id="atoolbar";let bSave=document.createElement("li");bSave.id="bSave",bSave.classList.add("fa","fa-floppy-o"),bSave.addEventListener("click",sbfile,!1),toolbar.appendChild(bSave);let bSeperator=document.createElement("i");bSeperator.classList.add("separator"),toolbar.appendChild(bSeperator),editor.parentNode.insertBefore(toolbar,editor),document.querySelector(".EasyMDEContainer").style="display: none",editor.style="display: block",document.getElementById("bcontent")&&(document.getElementById("editor1").style="display: none")}}}),document.addEventListener("keyup",event=>{if("Escape"==event.key&&"e"==document.getElementById("estate").value){mde.togglePreview(),document.querySelector("#main_area .editor-toolbar").style.display="none",document.getElementById("estate").value="s";let headerTitle=document.createElement("span");headerTitle.id="headerTitle",headerTitle.classList.add("headerTitle"),headerTitle.innerText=document.getElementById("note_name").value,document.querySelector("#main_header #note_name").replaceWith(headerTitle),document.querySelector("tags").classList.remove("edit"),tagify.setReadonly(!0)}}),document.getElementById("notesearch").addEventListener("keyup",searchList,!1),document.getElementById("save_button").addEventListener("click",(function(){document.getElementById("metah").submit()})),document.getElementById("localimg").addEventListener("change",simage,!1),new rcube_splitter({id:"notessplitter",p1:"#sidebar",p2:"#main",orientation:"v",relative:!0,start:400,min:250,size:12}).init(),firstNote()})); \ No newline at end of file diff --git a/js/turndown/turndown.js b/js/turndown/turndown.js new file mode 100644 index 0000000..716ff22 --- /dev/null +++ b/js/turndown/turndown.js @@ -0,0 +1,932 @@ +var TurndownService = (function () { +'use strict'; + +function extend (destination) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (source.hasOwnProperty(key)) destination[key] = source[key]; + } + } + return destination +} + +function repeat (character, count) { + return Array(count + 1).join(character) +} + +var blockElements = [ + 'address', 'article', 'aside', 'audio', 'blockquote', 'body', 'canvas', + 'center', 'dd', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption', + 'figure', 'footer', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', + 'header', 'hgroup', 'hr', 'html', 'isindex', 'li', 'main', 'menu', 'nav', + 'noframes', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table', + 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul' +]; + +function isBlock (node) { + return blockElements.indexOf(node.nodeName.toLowerCase()) !== -1 +} + +var voidElements = [ + 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', + 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr' +]; + +function isVoid (node) { + return voidElements.indexOf(node.nodeName.toLowerCase()) !== -1 +} + +var voidSelector = voidElements.join(); +function hasVoid (node) { + return node.querySelector && node.querySelector(voidSelector) +} + +var rules = {}; + +rules.paragraph = { + filter: 'p', + + replacement: function (content) { + return '\n\n' + content + '\n\n' + } +}; + +rules.lineBreak = { + filter: 'br', + + replacement: function (content, node, options) { + return options.br + '\n' + } +}; + +rules.heading = { + filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'], + + replacement: function (content, node, options) { + var hLevel = Number(node.nodeName.charAt(1)); + + if (options.headingStyle === 'setext' && hLevel < 3) { + var underline = repeat((hLevel === 1 ? '=' : '-'), content.length); + return ( + '\n\n' + content + '\n' + underline + '\n\n' + ) + } else { + return '\n\n' + repeat('#', hLevel) + ' ' + content + '\n\n' + } + } +}; + +rules.blockquote = { + filter: 'blockquote', + + replacement: function (content) { + content = content.replace(/^\n+|\n+$/g, ''); + content = content.replace(/^/gm, '> '); + return '\n\n' + content + '\n\n' + } +}; + +rules.list = { + filter: ['ul', 'ol'], + + replacement: function (content, node) { + var parent = node.parentNode; + if (parent.nodeName === 'LI' && parent.lastElementChild === node) { + return '\n' + content + } else { + return '\n\n' + content + '\n\n' + } + } +}; + +rules.listItem = { + filter: 'li', + + replacement: function (content, node, options) { + content = content + .replace(/^\n+/, '') // remove leading newlines + .replace(/\n+$/, '\n') // replace trailing newlines with just a single one + .replace(/\n/gm, '\n '); // indent + var prefix = options.bulletListMarker + ' '; + var parent = node.parentNode; + if (parent.nodeName === 'OL') { + var start = parent.getAttribute('start'); + var index = Array.prototype.indexOf.call(parent.children, node); + prefix = (start ? Number(start) + index : index + 1) + '. '; + } + return ( + prefix + content + (node.nextSibling && !/\n$/.test(content) ? '\n' : '') + ) + } +}; + +rules.indentedCodeBlock = { + filter: function (node, options) { + return ( + options.codeBlockStyle === 'indented' && + node.nodeName === 'PRE' && + node.firstChild && + node.firstChild.nodeName === 'CODE' + ) + }, + + replacement: function (content, node, options) { + return ( + '\n\n ' + + node.firstChild.textContent.replace(/\n/g, '\n ') + + '\n\n' + ) + } +}; + +rules.fencedCodeBlock = { + filter: function (node, options) { + return ( + options.codeBlockStyle === 'fenced' && + node.nodeName === 'PRE' && + node.firstChild && + node.firstChild.nodeName === 'CODE' + ) + }, + + replacement: function (content, node, options) { + var className = node.firstChild.className || ''; + var language = (className.match(/language-(\S+)/) || [null, ''])[1]; + + return ( + '\n\n' + options.fence + language + '\n' + + node.firstChild.textContent + + '\n' + options.fence + '\n\n' + ) + } +}; + +rules.horizontalRule = { + filter: 'hr', + + replacement: function (content, node, options) { + return '\n\n' + options.hr + '\n\n' + } +}; + +rules.inlineLink = { + filter: function (node, options) { + return ( + options.linkStyle === 'inlined' && + node.nodeName === 'A' && + node.getAttribute('href') + ) + }, + + replacement: function (content, node) { + var href = node.getAttribute('href'); + var title = node.title ? ' "' + node.title + '"' : ''; + return '[' + content + '](' + href + title + ')' + } +}; + +rules.referenceLink = { + filter: function (node, options) { + return ( + options.linkStyle === 'referenced' && + node.nodeName === 'A' && + node.getAttribute('href') + ) + }, + + replacement: function (content, node, options) { + var href = node.getAttribute('href'); + var title = node.title ? ' "' + node.title + '"' : ''; + var replacement; + var reference; + + switch (options.linkReferenceStyle) { + case 'collapsed': + replacement = '[' + content + '][]'; + reference = '[' + content + ']: ' + href + title; + break + case 'shortcut': + replacement = '[' + content + ']'; + reference = '[' + content + ']: ' + href + title; + break + default: + var id = this.references.length + 1; + replacement = '[' + content + '][' + id + ']'; + reference = '[' + id + ']: ' + href + title; + } + + this.references.push(reference); + return replacement + }, + + references: [], + + append: function (options) { + var references = ''; + if (this.references.length) { + references = '\n\n' + this.references.join('\n') + '\n\n'; + this.references = []; // Reset references + } + return references + } +}; + +rules.emphasis = { + filter: ['em', 'i'], + + replacement: function (content, node, options) { + if (!content.trim()) return '' + return options.emDelimiter + content + options.emDelimiter + } +}; + +rules.strong = { + filter: ['strong', 'b'], + + replacement: function (content, node, options) { + if (!content.trim()) return '' + return options.strongDelimiter + content + options.strongDelimiter + } +}; + +rules.code = { + filter: function (node) { + var hasSiblings = node.previousSibling || node.nextSibling; + var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings; + + return node.nodeName === 'CODE' && !isCodeBlock + }, + + replacement: function (content) { + if (!content.trim()) return '' + + var delimiter = '`'; + var leadingSpace = ''; + var trailingSpace = ''; + var matches = content.match(/`+/gm); + if (matches) { + if (/^`/.test(content)) leadingSpace = ' '; + if (/`$/.test(content)) trailingSpace = ' '; + while (matches.indexOf(delimiter) !== -1) delimiter = delimiter + '`'; + } + + return delimiter + leadingSpace + content + trailingSpace + delimiter + } +}; + +rules.image = { + filter: 'img', + + replacement: function (content, node) { + var alt = node.alt || ''; + var src = node.getAttribute('src') || ''; + var title = node.title || ''; + var titlePart = title ? ' "' + title + '"' : ''; + return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : '' + } +}; + +/** + * Manages a collection of rules used to convert HTML to Markdown + */ + +function Rules (options) { + this.options = options; + this._keep = []; + this._remove = []; + + this.blankRule = { + replacement: options.blankReplacement + }; + + this.keepReplacement = options.keepReplacement; + + this.defaultRule = { + replacement: options.defaultReplacement + }; + + this.array = []; + for (var key in options.rules) this.array.push(options.rules[key]); +} + +Rules.prototype = { + add: function (key, rule) { + this.array.unshift(rule); + }, + + keep: function (filter) { + this._keep.unshift({ + filter: filter, + replacement: this.keepReplacement + }); + }, + + remove: function (filter) { + this._remove.unshift({ + filter: filter, + replacement: function () { + return '' + } + }); + }, + + forNode: function (node) { + if (node.isBlank) return this.blankRule + var rule; + + if ((rule = findRule(this.array, node, this.options))) return rule + if ((rule = findRule(this._keep, node, this.options))) return rule + if ((rule = findRule(this._remove, node, this.options))) return rule + + return this.defaultRule + }, + + forEach: function (fn) { + for (var i = 0; i < this.array.length; i++) fn(this.array[i], i); + } +}; + +function findRule (rules, node, options) { + for (var i = 0; i < rules.length; i++) { + var rule = rules[i]; + if (filterValue(rule, node, options)) return rule + } + return void 0 +} + +function filterValue (rule, node, options) { + var filter = rule.filter; + if (typeof filter === 'string') { + if (filter === node.nodeName.toLowerCase()) return true + } else if (Array.isArray(filter)) { + if (filter.indexOf(node.nodeName.toLowerCase()) > -1) return true + } else if (typeof filter === 'function') { + if (filter.call(rule, node, options)) return true + } else { + throw new TypeError('`filter` needs to be a string, array, or function') + } +} + +/** + * The collapseWhitespace function is adapted from collapse-whitespace + * by Luc Thevenard. + * + * The MIT License (MIT) + * + * Copyright (c) 2014 Luc Thevenard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * collapseWhitespace(options) removes extraneous whitespace from an the given element. + * + * @param {Object} options + */ +function collapseWhitespace (options) { + var element = options.element; + var isBlock = options.isBlock; + var isVoid = options.isVoid; + var isPre = options.isPre || function (node) { + return node.nodeName === 'PRE' + }; + + if (!element.firstChild || isPre(element)) return + + var prevText = null; + var prevVoid = false; + + var prev = null; + var node = next(prev, element, isPre); + + while (node !== element) { + if (node.nodeType === 3 || node.nodeType === 4) { // Node.TEXT_NODE or Node.CDATA_SECTION_NODE + var text = node.data.replace(/[ \r\n\t]+/g, ' '); + + if ((!prevText || / $/.test(prevText.data)) && + !prevVoid && text[0] === ' ') { + text = text.substr(1); + } + + // `text` might be empty at this point. + if (!text) { + node = remove(node); + continue + } + + node.data = text; + + prevText = node; + } else if (node.nodeType === 1) { // Node.ELEMENT_NODE + if (isBlock(node) || node.nodeName === 'BR') { + if (prevText) { + prevText.data = prevText.data.replace(/ $/, ''); + } + + prevText = null; + prevVoid = false; + } else if (isVoid(node)) { + // Avoid trimming space around non-block, non-BR void elements. + prevText = null; + prevVoid = true; + } + } else { + node = remove(node); + continue + } + + var nextNode = next(prev, node, isPre); + prev = node; + node = nextNode; + } + + if (prevText) { + prevText.data = prevText.data.replace(/ $/, ''); + if (!prevText.data) { + remove(prevText); + } + } +} + +/** + * remove(node) removes the given node from the DOM and returns the + * next node in the sequence. + * + * @param {Node} node + * @return {Node} node + */ +function remove (node) { + var next = node.nextSibling || node.parentNode; + + node.parentNode.removeChild(node); + + return next +} + +/** + * next(prev, current, isPre) returns the next node in the sequence, given the + * current and previous nodes. + * + * @param {Node} prev + * @param {Node} current + * @param {Function} isPre + * @return {Node} + */ +function next (prev, current, isPre) { + if ((prev && prev.parentNode === current) || isPre(current)) { + return current.nextSibling || current.parentNode + } + + return current.firstChild || current.nextSibling || current.parentNode +} + +/* + * Set up window for Node.js + */ + +var root = (typeof window !== 'undefined' ? window : {}); + +/* + * Parsing HTML strings + */ + +function canParseHTMLNatively () { + var Parser = root.DOMParser; + var canParse = false; + + // Adapted from https://gist.github.com/1129031 + // Firefox/Opera/IE throw errors on unsupported types + try { + // WebKit returns null on unsupported types + if (new Parser().parseFromString('', 'text/html')) { + canParse = true; + } + } catch (e) {} + + return canParse +} + +function createHTMLParser () { + var Parser = function () {}; + + { + if (shouldUseActiveX()) { + Parser.prototype.parseFromString = function (string) { + var doc = new window.ActiveXObject('htmlfile'); + doc.designMode = 'on'; // disable on-page scripts + doc.open(); + doc.write(string); + doc.close(); + return doc + }; + } else { + Parser.prototype.parseFromString = function (string) { + var doc = document.implementation.createHTMLDocument(''); + doc.open(); + doc.write(string); + doc.close(); + return doc + }; + } + } + return Parser +} + +function shouldUseActiveX () { + var useActiveX = false; + try { + document.implementation.createHTMLDocument('').open(); + } catch (e) { + if (window.ActiveXObject) useActiveX = true; + } + return useActiveX +} + +var HTMLParser = canParseHTMLNatively() ? root.DOMParser : createHTMLParser(); + +function RootNode (input) { + var root; + if (typeof input === 'string') { + var doc = htmlParser().parseFromString( + // DOM parsers arrange elements in the and . + // Wrapping in a custom element ensures elements are reliably arranged in + // a single element. + '' + input + '', + 'text/html' + ); + root = doc.getElementById('turndown-root'); + } else { + root = input.cloneNode(true); + } + collapseWhitespace({ + element: root, + isBlock: isBlock, + isVoid: isVoid + }); + + return root +} + +var _htmlParser; +function htmlParser () { + _htmlParser = _htmlParser || new HTMLParser(); + return _htmlParser +} + +function Node (node) { + node.isBlock = isBlock(node); + node.isCode = node.nodeName.toLowerCase() === 'code' || node.parentNode.isCode; + node.isBlank = isBlank(node); + node.flankingWhitespace = flankingWhitespace(node); + return node +} + +function isBlank (node) { + return ( + ['A', 'TH', 'TD'].indexOf(node.nodeName) === -1 && + /^\s*$/i.test(node.textContent) && + !isVoid(node) && + !hasVoid(node) + ) +} + +function flankingWhitespace (node) { + var leading = ''; + var trailing = ''; + + if (!node.isBlock) { + var hasLeading = /^[ \r\n\t]/.test(node.textContent); + var hasTrailing = /[ \r\n\t]$/.test(node.textContent); + + if (hasLeading && !isFlankedByWhitespace('left', node)) { + leading = ' '; + } + if (hasTrailing && !isFlankedByWhitespace('right', node)) { + trailing = ' '; + } + } + + return { leading: leading, trailing: trailing } +} + +function isFlankedByWhitespace (side, node) { + var sibling; + var regExp; + var isFlanked; + + if (side === 'left') { + sibling = node.previousSibling; + regExp = / $/; + } else { + sibling = node.nextSibling; + regExp = /^ /; + } + + if (sibling) { + if (sibling.nodeType === 3) { + isFlanked = regExp.test(sibling.nodeValue); + } else if (sibling.nodeType === 1 && !isBlock(sibling)) { + isFlanked = regExp.test(sibling.textContent); + } + } + return isFlanked +} + +var reduce = Array.prototype.reduce; +var leadingNewLinesRegExp = /^\n*/; +var trailingNewLinesRegExp = /\n*$/; + +function TurndownService (options) { + if (!(this instanceof TurndownService)) return new TurndownService(options) + + var defaults = { + rules: rules, + headingStyle: 'setext', + hr: '* * *', + bulletListMarker: '*', + codeBlockStyle: 'indented', + fence: '```', + emDelimiter: '_', + strongDelimiter: '**', + linkStyle: 'inlined', + linkReferenceStyle: 'full', + br: ' ', + blankReplacement: function (content, node) { + return node.isBlock ? '\n\n' : '' + }, + keepReplacement: function (content, node) { + return node.isBlock ? '\n\n' + node.outerHTML + '\n\n' : node.outerHTML + }, + defaultReplacement: function (content, node) { + return node.isBlock ? '\n\n' + content + '\n\n' : content + } + }; + this.options = extend({}, defaults, options); + this.rules = new Rules(this.options); +} + +TurndownService.prototype = { + /** + * The entry point for converting a string or DOM node to Markdown + * @public + * @param {String|HTMLElement} input The string or DOM node to convert + * @returns A Markdown representation of the input + * @type String + */ + + turndown: function (input) { + if (!canConvert(input)) { + throw new TypeError( + input + ' is not a string, or an element/document/fragment node.' + ) + } + + if (input === '') return '' + + var output = process.call(this, new RootNode(input)); + return postProcess.call(this, output) + }, + + /** + * Add one or more plugins + * @public + * @param {Function|Array} plugin The plugin or array of plugins to add + * @returns The Turndown instance for chaining + * @type Object + */ + + use: function (plugin) { + if (Array.isArray(plugin)) { + for (var i = 0; i < plugin.length; i++) this.use(plugin[i]); + } else if (typeof plugin === 'function') { + plugin(this); + } else { + throw new TypeError('plugin must be a Function or an Array of Functions') + } + return this + }, + + /** + * Adds a rule + * @public + * @param {String} key The unique key of the rule + * @param {Object} rule The rule + * @returns The Turndown instance for chaining + * @type Object + */ + + addRule: function (key, rule) { + this.rules.add(key, rule); + return this + }, + + /** + * Keep a node (as HTML) that matches the filter + * @public + * @param {String|Array|Function} filter The unique key of the rule + * @returns The Turndown instance for chaining + * @type Object + */ + + keep: function (filter) { + this.rules.keep(filter); + return this + }, + + /** + * Remove a node that matches the filter + * @public + * @param {String|Array|Function} filter The unique key of the rule + * @returns The Turndown instance for chaining + * @type Object + */ + + remove: function (filter) { + this.rules.remove(filter); + return this + }, + + /** + * Escapes Markdown syntax + * @public + * @param {String} string The string to escape + * @returns A string with Markdown syntax escaped + * @type String + */ + + escape: function (string) { + return ( + string + // Escape backslash escapes! + .replace(/\\(\S)/g, '\\\\$1') + + // Escape headings + .replace(/^(#{1,6} )/gm, '\\$1') + + // Escape hr + .replace(/^([-*_] *){3,}$/gm, function (match, character) { + return match.split(character).join('\\' + character) + }) + + // Escape ol bullet points + .replace(/^(\W* {0,3})(\d+)\. /gm, '$1$2\\. ') + + // Escape ul bullet points + .replace(/^([^\\\w]*)[*+-] /gm, function (match) { + return match.replace(/([*+-])/g, '\\$1') + }) + + // Escape blockquote indents + .replace(/^(\W* {0,3})> /gm, '$1\\> ') + + // Escape em/strong * + .replace(/\*+(?![*\s\W]).+?\*+/g, function (match) { + return match.replace(/\*/g, '\\*') + }) + + // Escape em/strong _ + .replace(/_+(?![_\s\W]).+?_+/g, function (match) { + return match.replace(/_/g, '\\_') + }) + + // Escape code _ + .replace(/`+(?![`\s\W]).+?`+/g, function (match) { + return match.replace(/`/g, '\\`') + }) + + // Escape link brackets + .replace(/[\[\]]/g, '\\$&') // eslint-disable-line no-useless-escape + ) + } +}; + +/** + * Reduces a DOM node down to its Markdown string equivalent + * @private + * @param {HTMLElement} parentNode The node to convert + * @returns A Markdown representation of the node + * @type String + */ + +function process (parentNode) { + var self = this; + return reduce.call(parentNode.childNodes, function (output, node) { + node = new Node(node); + + var replacement = ''; + if (node.nodeType === 3) { + replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue); + } else if (node.nodeType === 1) { + replacement = replacementForNode.call(self, node); + } + + return join(output, replacement) + }, '') +} + +/** + * Appends strings as each rule requires and trims the output + * @private + * @param {String} output The conversion output + * @returns A trimmed version of the ouput + * @type String + */ + +function postProcess (output) { + var self = this; + this.rules.forEach(function (rule) { + if (typeof rule.append === 'function') { + output = join(output, rule.append(self.options)); + } + }); + + return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '') +} + +/** + * Converts an element node to its Markdown equivalent + * @private + * @param {HTMLElement} node The node to convert + * @returns A Markdown representation of the node + * @type String + */ + +function replacementForNode (node) { + var rule = this.rules.forNode(node); + var content = process.call(this, node); + var whitespace = node.flankingWhitespace; + if (whitespace.leading || whitespace.trailing) content = content.trim(); + return ( + whitespace.leading + + rule.replacement(content, node, this.options) + + whitespace.trailing + ) +} + +/** + * Determines the new lines between the current output and the replacement + * @private + * @param {String} output The current conversion output + * @param {String} replacement The string to append to the output + * @returns The whitespace to separate the current output and the replacement + * @type String + */ + +function separatingNewlines (output, replacement) { + var newlines = [ + output.match(trailingNewLinesRegExp)[0], + replacement.match(leadingNewLinesRegExp)[0] + ].sort(); + var maxNewlines = newlines[newlines.length - 1]; + return maxNewlines.length < 2 ? maxNewlines : '\n\n' +} + +function join (string1, string2) { + var separator = separatingNewlines(string1, string2); + + // Remove trailing/leading newlines and replace with separator + string1 = string1.replace(trailingNewLinesRegExp, ''); + string2 = string2.replace(leadingNewLinesRegExp, ''); + + return string1 + separator + string2 +} + +/** + * Determines whether an input can be converted + * @private + * @param {String|HTMLElement} input Describe this parameter + * @returns Describe what it returns + * @type String|Object|Array|Boolean|Number + */ + +function canConvert (input) { + return ( + input != null && ( + typeof input === 'string' || + (input.nodeType && ( + input.nodeType === 1 || input.nodeType === 9 || input.nodeType === 11 + )) + ) + ) +} + +return TurndownService; + +}()); diff --git a/js/turndown/turndown.min.js b/js/turndown/turndown.min.js new file mode 100644 index 0000000..8ea7878 --- /dev/null +++ b/js/turndown/turndown.min.js @@ -0,0 +1 @@ +var TurndownService=function(){"use strict";function extend(destination){for(var i=1;i-1)return!0}else{if("function"!=typeof filter)throw new TypeError("`filter` needs to be a string, array, or function");if(filter.call(rule,node,options))return!0}}function collapseWhitespace(options){var element=options.element,isBlock=options.isBlock,isVoid=options.isVoid,isPre=options.isPre||function(node){return"PRE"===node.nodeName};if(element.firstChild&&!isPre(element)){for(var prevText=null,prevVoid=!1,prev=null,node=next(prev,element,isPre);node!==element;){if(3===node.nodeType||4===node.nodeType){var text=node.data.replace(/[ \r\n\t]+/g," ");if(prevText&&!/ $/.test(prevText.data)||prevVoid||" "!==text[0]||(text=text.substr(1)),!text){node=remove(node);continue}node.data=text,prevText=node}else{if(1!==node.nodeType){node=remove(node);continue}isBlock(node)||"BR"===node.nodeName?(prevText&&(prevText.data=prevText.data.replace(/ $/,"")),prevText=null,prevVoid=!1):isVoid(node)&&(prevText=null,prevVoid=!0)}var nextNode=next(prev,node,isPre);prev=node,node=nextNode}prevText&&(prevText.data=prevText.data.replace(/ $/,""),prevText.data||remove(prevText))}}function remove(node){var next=node.nextSibling||node.parentNode;return node.parentNode.removeChild(node),next}function next(prev,current,isPre){return prev&&prev.parentNode===current||isPre(current)?current.nextSibling||current.parentNode:current.firstChild||current.nextSibling||current.parentNode}rules.paragraph={filter:"p",replacement:function(content){return"\n\n"+content+"\n\n"}},rules.lineBreak={filter:"br",replacement:function(content,node,options){return options.br+"\n"}},rules.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(content,node,options){var hLevel=Number(node.nodeName.charAt(1)),underline;return"setext"===options.headingStyle&&hLevel<3?"\n\n"+content+"\n"+repeat(1===hLevel?"=":"-",content.length)+"\n\n":"\n\n"+repeat("#",hLevel)+" "+content+"\n\n"}},rules.blockquote={filter:"blockquote",replacement:function(content){return"\n\n"+(content=(content=content.replace(/^\n+|\n+$/g,"")).replace(/^/gm,"> "))+"\n\n"}},rules.list={filter:["ul","ol"],replacement:function(content,node){var parent=node.parentNode;return"LI"===parent.nodeName&&parent.lastElementChild===node?"\n"+content:"\n\n"+content+"\n\n"}},rules.listItem={filter:"li",replacement:function(content,node,options){content=content.replace(/^\n+/,"").replace(/\n+$/,"\n").replace(/\n/gm,"\n ");var prefix=options.bulletListMarker+" ",parent=node.parentNode;if("OL"===parent.nodeName){var start=parent.getAttribute("start"),index=Array.prototype.indexOf.call(parent.children,node);prefix=(start?Number(start)+index:index+1)+". "}return prefix+content+(node.nextSibling&&!/\n$/.test(content)?"\n":"")}},rules.indentedCodeBlock={filter:function(node,options){return"indented"===options.codeBlockStyle&&"PRE"===node.nodeName&&node.firstChild&&"CODE"===node.firstChild.nodeName},replacement:function(content,node,options){return"\n\n "+node.firstChild.textContent.replace(/\n/g,"\n ")+"\n\n"}},rules.fencedCodeBlock={filter:function(node,options){return"fenced"===options.codeBlockStyle&&"PRE"===node.nodeName&&node.firstChild&&"CODE"===node.firstChild.nodeName},replacement:function(content,node,options){var className,language=((node.firstChild.className||"").match(/language-(\S+)/)||[null,""])[1];return"\n\n"+options.fence+language+"\n"+node.firstChild.textContent+"\n"+options.fence+"\n\n"}},rules.horizontalRule={filter:"hr",replacement:function(content,node,options){return"\n\n"+options.hr+"\n\n"}},rules.inlineLink={filter:function(node,options){return"inlined"===options.linkStyle&&"A"===node.nodeName&&node.getAttribute("href")},replacement:function(content,node){var href,title;return"["+content+"]("+node.getAttribute("href")+(node.title?' "'+node.title+'"':"")+")"}},rules.referenceLink={filter:function(node,options){return"referenced"===options.linkStyle&&"A"===node.nodeName&&node.getAttribute("href")},replacement:function(content,node,options){var href=node.getAttribute("href"),title=node.title?' "'+node.title+'"':"",replacement,reference;switch(options.linkReferenceStyle){case"collapsed":replacement="["+content+"][]",reference="["+content+"]: "+href+title;break;case"shortcut":replacement="["+content+"]",reference="["+content+"]: "+href+title;break;default:var id=this.references.length+1;replacement="["+content+"]["+id+"]",reference="["+id+"]: "+href+title}return this.references.push(reference),replacement},references:[],append:function(options){var references="";return this.references.length&&(references="\n\n"+this.references.join("\n")+"\n\n",this.references=[]),references}},rules.emphasis={filter:["em","i"],replacement:function(content,node,options){return content.trim()?options.emDelimiter+content+options.emDelimiter:""}},rules.strong={filter:["strong","b"],replacement:function(content,node,options){return content.trim()?options.strongDelimiter+content+options.strongDelimiter:""}},rules.code={filter:function(node){var hasSiblings=node.previousSibling||node.nextSibling,isCodeBlock="PRE"===node.parentNode.nodeName&&!hasSiblings;return"CODE"===node.nodeName&&!isCodeBlock},replacement:function(content){if(!content.trim())return"";var delimiter="`",leadingSpace="",trailingSpace="",matches=content.match(/`+/gm);if(matches)for(/^`/.test(content)&&(leadingSpace=" "),/`$/.test(content)&&(trailingSpace=" ");-1!==matches.indexOf(delimiter);)delimiter+="`";return delimiter+leadingSpace+content+trailingSpace+delimiter}},rules.image={filter:"img",replacement:function(content,node){var alt=node.alt||"",src=node.getAttribute("src")||"",title=node.title||"",titlePart;return src?"!["+alt+"]("+src+(title?' "'+title+'"':"")+")":""}},Rules.prototype={add:function(key,rule){this.array.unshift(rule)},keep:function(filter){this._keep.unshift({filter:filter,replacement:this.keepReplacement})},remove:function(filter){this._remove.unshift({filter:filter,replacement:function(){return""}})},forNode:function(node){return node.isBlank?this.blankRule:(rule=findRule(this.array,node,this.options))?rule:(rule=findRule(this._keep,node,this.options))?rule:(rule=findRule(this._remove,node,this.options))?rule:this.defaultRule;var rule},forEach:function(fn){for(var i=0;i'+input+"","text/html").getElementById("turndown-root"):root=input.cloneNode(!0);return collapseWhitespace({element:root,isBlock:isBlock,isVoid:isVoid}),root}function htmlParser(){return _htmlParser=_htmlParser||new HTMLParser}function Node(node){return node.isBlock=isBlock(node),node.isCode="code"===node.nodeName.toLowerCase()||node.parentNode.isCode,node.isBlank=isBlank(node),node.flankingWhitespace=flankingWhitespace(node),node}function isBlank(node){return-1===["A","TH","TD"].indexOf(node.nodeName)&&/^\s*$/i.test(node.textContent)&&!isVoid(node)&&!hasVoid(node)}function flankingWhitespace(node){var leading="",trailing="";if(!node.isBlock){var hasLeading=/^[ \r\n\t]/.test(node.textContent),hasTrailing=/[ \r\n\t]$/.test(node.textContent);hasLeading&&!isFlankedByWhitespace("left",node)&&(leading=" "),hasTrailing&&!isFlankedByWhitespace("right",node)&&(trailing=" ")}return{leading:leading,trailing:trailing}}function isFlankedByWhitespace(side,node){var sibling,regExp,isFlanked;return"left"===side?(sibling=node.previousSibling,regExp=/ $/):(sibling=node.nextSibling,regExp=/^ /),sibling&&(3===sibling.nodeType?isFlanked=regExp.test(sibling.nodeValue):1!==sibling.nodeType||isBlock(sibling)||(isFlanked=regExp.test(sibling.textContent))),isFlanked}var reduce=Array.prototype.reduce,leadingNewLinesRegExp=/^\n*/,trailingNewLinesRegExp=/\n*$/;function TurndownService(options){if(!(this instanceof TurndownService))return new TurndownService(options);var defaults={rules:rules,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",blankReplacement:function(content,node){return node.isBlock?"\n\n":""},keepReplacement:function(content,node){return node.isBlock?"\n\n"+node.outerHTML+"\n\n":node.outerHTML},defaultReplacement:function(content,node){return node.isBlock?"\n\n"+content+"\n\n":content}};this.options=extend({},defaults,options),this.rules=new Rules(this.options)}function process(parentNode){var self=this;return reduce.call(parentNode.childNodes,(function(output,node){var replacement="";return 3===(node=new Node(node)).nodeType?replacement=node.isCode?node.nodeValue:self.escape(node.nodeValue):1===node.nodeType&&(replacement=replacementForNode.call(self,node)),join(output,replacement)}),"")}function postProcess(output){var self=this;return this.rules.forEach((function(rule){"function"==typeof rule.append&&(output=join(output,rule.append(self.options)))})),output.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function replacementForNode(node){var rule=this.rules.forNode(node),content=process.call(this,node),whitespace=node.flankingWhitespace;return(whitespace.leading||whitespace.trailing)&&(content=content.trim()),whitespace.leading+rule.replacement(content,node,this.options)+whitespace.trailing}function separatingNewlines(output,replacement){var newlines=[output.match(trailingNewLinesRegExp)[0],replacement.match(leadingNewLinesRegExp)[0]].sort(),maxNewlines=newlines[newlines.length-1];return maxNewlines.length<2?maxNewlines:"\n\n"}function join(string1,string2){var separator=separatingNewlines(string1,string2);return(string1=string1.replace(trailingNewLinesRegExp,""))+separator+(string2=string2.replace(leadingNewLinesRegExp,""))}function canConvert(input){return null!=input&&("string"==typeof input||input.nodeType&&(1===input.nodeType||9===input.nodeType||11===input.nodeType))}return TurndownService.prototype={turndown:function(input){if(!canConvert(input))throw new TypeError(input+" is not a string, or an element/document/fragment node.");if(""===input)return"";var output=process.call(this,new RootNode(input));return postProcess.call(this,output)},use:function(plugin){if(Array.isArray(plugin))for(var i=0;i /gm,"$1\\> ").replace(/\*+(?![*\s\W]).+?\*+/g,(function(match){return match.replace(/\*/g,"\\*")})).replace(/_+(?![_\s\W]).+?_+/g,(function(match){return match.replace(/_/g,"\\_")})).replace(/`+(?![`\s\W]).+?`+/g,(function(match){return match.replace(/`/g,"\\`")})).replace(/[\[\]]/g,"\\$&")}},TurndownService}(); \ No newline at end of file diff --git a/notes.php b/notes.php index 03dcc12..d12f90a 100644 --- a/notes.php +++ b/notes.php @@ -159,6 +159,9 @@ $yaml_arr = preg_split("/\r\n|\n|\r/", substr($contents,0,$yhe_pos + strlen($yh_end))); foreach($yaml_arr as $line) { if(strpos($line,"tags:") === 0) $taglist = str_replace(" ", ", ", substr($line,6)); + if(strpos($line,"author:") === 0) $author = substr($line,8); + if(strpos($line,"date:") === 0) $date = substr($line,6); + if(strpos($line,"source:") === 0) $source = substr($line,8); } } } else { @@ -174,6 +177,9 @@ 'mime_type' => $note['mime_type'], 'tags' => $taglist, 'content' => $note['content'], + 'author' => $author, + 'date' => $date, + 'source' => $source, ]; die(json_encode($noteArr)); break; @@ -188,6 +194,9 @@ case 'editNote': $note_name = ($_POST['note_name'] != "") ? filter_var($_POST['note_name'], FILTER_SANITIZE_STRING) : "new_unknown_note"; $note_tags = $_POST['ntags']; + $ndate = ($_POST['date'] != "") ? filter_var($_POST['date'], FILTER_SANITIZE_STRING) : strftime('%x %X'); + $nauthor = ($_POST['author'] != "") ? filter_var($_POST['author'], FILTER_SANITIZE_STRING) : $rcmail->user->get_username(); + $nsource = ($_POST['source'] != "") ? filter_var($_POST['source'], FILTER_SANITIZE_STRING) : ''; asort($note_tags, SORT_LOCALE_STRING | SORT_FLAG_CASE ); $note_content = $_POST['editor1']; $old_name = filter_var($_POST['fname'], FILTER_SANITIZE_STRING); @@ -218,9 +227,10 @@ } else { $yaml_new[] = $yh_begin; if(strlen($tags_str) > 6) $yaml_new[] = $tags_str; - $yaml_new[] = "title: ".$note_name; - $yaml_new[] = "date: ".strftime('%x %X'); - $yaml_new[] = "author: ".$rcmail->user->get_username(); + if(strlen($note_name) > 3) $yaml_new[] = "title: ".$note_name; + if(strlen($ndate) > 3) $yaml_new[] = "date: ".$ndate; + if(strlen($nauthor) > 3) $yaml_new[] = "author: ".$nauthor; + if(strlen($nsource) > 3) $yaml_new[] = "source: ".$nsource; $yaml_new[] = $yh_end; $note_content = implode("\r\n", $yaml_new)."\r\n".$note_content; } @@ -230,9 +240,8 @@ $new_name = $note_name.$tags_str.".".$note_type; } $notes_path = $rcmail->config->get('notes_basepath', false).$rcmail->user->get_username().$rcmail->config->get('notes_folder', false); - if(file_exists($notes_path.$old_name)) { - if($old_name != $new_name) - if(!rename($notes_path.$old_name, $notes_path.$new_name)) die('Could not rename file.'); + if(file_exists($notes_path.$old_name && $old_name != '')) { + if($old_name != $new_name) if(!rename($notes_path.$old_name, $notes_path.$new_name)) die('Could not rename file.'); } elseif ($old_name != "") { error_log('PrimitiveNotes: Note not found, can\`t save note.'); die('Note not found, can\`t save note.'); @@ -421,11 +430,13 @@ function human_filesize($bytes, $decimals = 2) { + + - +
    -
    -
    -
    - -
    - -
    - -
    -
    - - - -
    + +
    +
    + +
    + +
    + +
    +
    + + + + + + + +
    +
    - diff --git a/skins/primitivenotes.css b/skins/primitivenotes.css index 6a636b6..4af57a0 100644 --- a/skins/primitivenotes.css +++ b/skins/primitivenotes.css @@ -160,9 +160,12 @@ object { border-radius: 0!important; } .main_header { - height: 100px; - background: #efefef; - width: 100%} + height: 100px; + background: #efefef; + width: 100%; + top: 0; + position: sticky; +} .main_header input { width: calc(100% - 20px); padding: 0; @@ -173,8 +176,8 @@ object { } .main_area { position: absolute; - top: 80px; - height: calc(100% - 74px); + top: 90px; + height: calc(100% - 90px); width: 100%; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; @@ -240,14 +243,14 @@ object { line-height: 15px; } .filelist li { - white-space: nowrap; - padding: 3px 5px 2px 40px; - font-weight: 700; - color: #405353; - border-bottom: 1px solid #b2b8bf; - font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - height: 35px; + white-space: nowrap; + padding: 3px 5px 2px 40px; + font-weight: 700; + color: #2c363a; + border-bottom: 1px solid #f1f3f4; + font-family: "Lucida Grande",Verdana,Arial,Helvetica,sans-serif; + font-size: 12px; + height: 35px; } .filelist a:hover span#taglist { display: block; @@ -282,8 +285,7 @@ object { background: #fff url(images/unknown-icon.png) 5px 7px/27px no-repeat; } .selected, .selected a, .selected span { - background-color: #4c9dc3!important; - color: #fff!important; + background-color: #ebf9ff !important; } .selected span.fsize { background: #13aff8!important; @@ -299,13 +301,13 @@ object { font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; } .filelist a { - text-decoration: none!important; - color: #405353; - width: 100%; - height: 100%; - display: inline-block; - text-overflow: ellipsis; - overflow: hidden; + text-decoration: none !important; + color: #536871; + width: 100%; + height: 100%; + display: inline-block; + text-overflow: ellipsis; + overflow: hidden; } .cke_editable { cursor: text; @@ -414,6 +416,10 @@ object { .editor-preview p > img { display: initial; } +.EasyMDEContainer { + top: 0; + position: relative; +} .EasyMDEContainer .CodeMirror { position: inherit; border: 0; @@ -441,6 +447,7 @@ object { border-color: #bbb; z-index: 101; border-radius: 0; + top: 86px; } .EasyMDEContainer .CodeMirror-scroll { padding-top: 30px; @@ -458,6 +465,9 @@ object { .editor-toolbar.fullscreen { background: #f4f4f4; } +.CodeMirror pre.CodeMirror-line, .CodeMirror pre.CodeMirror-line-like { + font-size: smaller; +} .tagify { --tags-border-color: transparent !important; z-index: 100; @@ -465,10 +475,11 @@ object { font-size: .7em; font-style: italic; flex-wrap: unset !important; - top: -51px; left: 7px; border-radius: 4px; border: thin solid transparent !important; + position: absolute; + top: 50px; } .tagify[readonly]:not(.tagify--mix) .tagify__tag > div::before { box-shadow: 0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset !important; @@ -489,7 +500,6 @@ tags.edit:focus-within { } .cm-s-easymde .cm-comment { font-family: Consolas,inherit monospace; - font-size: 0.8em; } .db-spinner { width: 30px; diff --git a/skins/primitivenotes.min.css b/skins/primitivenotes.min.css index c8b44ff..b8e3139 100644 --- a/skins/primitivenotes.min.css +++ b/skins/primitivenotes.min.css @@ -1 +1 @@ -.iframebox.simplenotes_{height:100%}.uibox{border:0!important;border-radius:0}#notessplitter{display:none}body{font-size:unset;background:unset}.editor-toolbar button{border:0;background:0 0}.editor-toolbar button:hover{background:#d3d3d3}#suggest{position:absolute;background-color:#fff;border:1px solid #ccf;z-index:100;left:9px;padding:5px;top:70px;overflow:auto}#suggest div{white-space:nowrap;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;font-size:.8em}#suggest div.select{color:#fff;background-color:#36f}#suggest div.over{background-color:#9cf}object{max-width:100%;max-height:100%;width:initial;height:initial;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;z-index:10}.headerTitle{margin:10px;font-size:2em;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:5px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inherit;margin-top:0}.headerTags{margin:10px;font-size:11px;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:-20px}#content{height:100%;overflow:auto;padding:0 15px}.save_button{position:absolute;right:16px;top:14px;height:24px;width:24px;background:url(images/button_save.png) no-repeat;display:none}.save_button a{width:100%;height:100%;position:absolute}#sidebar .searchbox{position:absolute;width:350px}#sidebar .searchbox input{font-weight:400;background:#fff;height:21px;background-image:url(./../../../skins/larry/images/buttons.png);width:100%;padding:0 4px 0 24px;background-repeat:no-repeat;background-position:-7px -671px;background-size:36px}#sidebar{width:400px;position:absolute;float:left;overflow:hidden;border-radius:0;margin-right:5px;top:0;bottom:0;left:0;right:0;border-right:1px solid #d4dbde!important}#filelist_header{display:block;top:0;left:0;right:0;height:34px;padding:6px;background:#efefef;white-space:nowrap;border-bottom:1px solid #dfdfdf;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#taglist{display:none}#note_tags{border:thin solid #ced4da}.filelist{width:100%;height:calc(100% - 34px);overflow:auto;background:#dcdcdc}.cke_chrome{border:0!important}#main{position:absolute;left:0;right:0;top:0;bottom:0}.main{left:395px!important;border-radius:0!important}.main_header{height:100px;background:#efefef;width:100%}.main_header input{width:calc(100% - 20px);padding:0;margin-left:6px;margin-top:5px;padding-left:5px;border:thin solid #ced4da!important}.main_area{position:absolute;top:80px;height:calc(100% - 74px);width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff;overflow:auto}.main_area textarea{border:0;width:calc(100% - 20px);height:calc(100% - 61px);white-space:pre;padding:10px;top:35px;position:absolute;font-family:revert;border-radius:revert;resize:none;outline:0}.main_area textarea:focus{box-shadow:revert}#atoolbar{background:#efefef;border-bottom:1px solid #bbb;padding:0 10px;z-index:12;position:absolute;right:0;left:0}#atoolbar li{border-radius:4px;cursor:pointer;margin:4px 3px;padding:5px;color:#525252}#atoolbar li:hover{background:#e3e3e3}#atoolbar i.separator{display:inline;width:2px;border-left:1px solid #d9d9d9;border-right:1px solid #fff;margin:0 5px}#filelist{margin:0;padding:0}.fsize{text-align:right;float:right;width:50px;border-radius:9px;padding:0 6px;background:#929292;position:relative;color:#fff!important;font-weight:700!important;line-height:15px}.filelist li{white-space:nowrap;padding:3px 5px 2px 40px;font-weight:700;color:#405353;border-bottom:1px solid #b2b8bf;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif;font-size:12px;height:35px}.filelist a:hover span#taglist{display:block;background:#000!important;z-index:10;position:absolute;max-width:300px;border-radius:5px;padding:5px;color:#fff;white-space:normal;margin-top:-55px;box-shadow:1px 1px 3px gray;left:10px}.filelist li.pdf{background:#fff url(images/pdf-icon.png) 5px 7px/27px no-repeat}.filelist li.html,li.htm{background:#fff url(images/html-icon.png) 5px 7px/27px no-repeat}.filelist li.jpg{background:#fff url(images/jpg-icon.png) 5px 7px/27px no-repeat}.filelist li.md{background:#fff url(images/md-icon.png) 5px 7px/27px no-repeat}.filelist li.txt{background:#fff url(images/txt-icon.png) 5px 7px/27px no-repeat}.filelist li{background:#fff url(images/unknown-icon.png) 5px 7px/27px no-repeat}.selected,.selected a,.selected span{background-color:#4c9dc3!important;color:#fff!important}.selected span.fsize{background:#13aff8!important}.filelist li:hover{background-color:#e8eaf6;text-decoration:none!important}.filelist a>span{color:#666;font-weight:400;font-size:11px;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif}.filelist a{text-decoration:none!important;color:#405353;width:100%;height:100%;display:inline-block;text-overflow:ellipsis;overflow:hidden}.cke_editable{cursor:text;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif}.editor-preview blockquote,.editor-preview-side blockquote{color:#3c763d;background-color:rgba(66,185,131,.1);padding:0;margin:15px 0;border-left:4px solid #42b983;margin-left:auto;margin-right:auto}.editor-preview blockquote p,.editor-preview-side blockquote p{padding:5px}.editor-preview code{overflow-x:auto;scrollbar-width:thin;margin:0 0 -5px 0;user-select:all;width:unset;background:#eed7d7;font-size:.92em;font-family:Consolas,Monaco,monospace!important;color:#e93700;padding:2px 4px;border-radius:5px;display:inline-block;white-space:pre}.editor-preview a,.editor-preview-side a{color:#42b983;text-decoration:none;font-style:normal;font-size:15px;font-weight:600}.editor-preview pre,.editor-preview-side pre{background:#f8f8f8;margin-bottom:10px;padding:7px;font-size:85%;line-height:1.45;border-radius:4px;border:thin solid #dfe2e5;overflow:hidden;margin-left:auto;margin-right:auto;padding-right:10px}.editor-preview pre code{color:unset;background:unset}.editor-preview{background:#fff;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif;color:#333;background:#fff}.editor-preview *{max-width:860px;margin-left:auto;margin-right:auto}.editor-preview table,.editor-preview-side table{border-spacing:0;border-collapse:collapse;text-shadow:1px 1px 0 #fff}.editor-preview table thead th,.editor-preview-side table thead th{background-color:#e0e0e0;border:1px solid #ddd;padding:5px}.editor-preview table tr:nth-child(2n),.editor-preview-side table tr:nth-child(2n){background:linear-gradient(to bottom,#f8f8f8 0,#f6f6f6 100%)}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.editor-preview kbd,.editor-preview-side kbd{font-family:Consolas,"Courier New",monospace;display:inline-block;border-radius:5px;padding:0 4px;margin:2px;font-size:.9em;vertical-align:text-bottom;background:#fff;color:#555;user-select:none;border-width:1px 3px 3px 1px;border-color:#ccc #aaa #888 #bbb;white-space:nowrap;border-style:solid}.editor-preview img{display:block;max-width:860px}.editor-preview p>img{display:initial}.EasyMDEContainer .CodeMirror{position:inherit;border:0}.EasyMDEContainerH{display:none!important}.editor-preview-full{position:fixed;left:395px;width:calc(100% - 396px);top:80px;height:calc(100% - 74px);padding-top:20px}.CodeMirror-vscrollbar{overflow-y:hidden}.editor-toolbar{position:fixed;width:calc(100% - 432px);background:#efefef;border:0;border-bottom:1px solid;border-color:#bbb;z-index:101;border-radius:0}.EasyMDEContainer .CodeMirror-scroll{padding-top:30px}.editor-toolbar::after{margin-top:2px}.editor-toolbar::before{margin-bottom:2px}.editor-toolbar button.active,.editor-toolbar button:hover{background:#e3e3e3;border-color:#95a5a6}.editor-toolbar.fullscreen{background:#f4f4f4}.tagify{--tags-border-color:transparent!important;z-index:100;width:calc(100% - 15px);font-size:.7em;font-style:italic;flex-wrap:unset!important;top:-51px;left:7px;border-radius:4px;border:thin solid transparent!important}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset!important}tags{overflow:auto!important}tags.edit{background:#fff;border:thin solid #ced4da!important}tags.edit:focus-within{box-shadow:0 0 5px 2px rgba(71,135,177,.9)!important;z-index:102}.tagify__tag+.tagify__input::before{display:none}.cm-s-easymde .cm-comment{font-family:Consolas,inherit monospace;font-size:.8em}.db-spinner{width:30px;height:30px;border-radius:50%;background-color:transparent;border:10px solid #2229;border-top:10px solid #03a9f4;border-bottom:100x solid #03a9f4;-webkit-animation:1s spin linear infinite;animation:1s spin linear infinite;position:absolute;top:50%;left:50%;z-index:100}@-webkit-keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#tocdiv{position:fixed;z-index:10;background:#efefef;width:300px;top:77px;right:-310px;white-space:nowrap;padding:10px 0;box-shadow:1px 3px 3px 0 rgba(50,50,50,.3);border-bottom-left-radius:5px;border-bottom-right-radius:5px;border:1px solid #bbb;border-top:0;overflow:auto;max-height:calc(100% - 140px)}#tocdiv.tdhidden{right:26px}#tbutton{position:absolute;z-index:100;top:15px;right:10px;background:#f4f4f4;border:1px solid #ced4da;border-radius:5px;cursor:pointer;color:#535252;font-size:.8em;padding:3px;outline:0;box-shadow:revert}#tocdiv ul{margin:0;padding-left:20px}#tocdiv li{list-style:none;padding-right:10px}#tocdiv a{color:#42b983;text-decoration:none;font-weight:bolder;overflow:hidden;text-overflow:ellipsis;width:100%;display:inline-block;font-size:.9em} \ No newline at end of file +.iframebox.simplenotes_{height:100%}.uibox{border:0!important;border-radius:0}#notessplitter{display:none}body{font-size:unset;background:unset}.editor-toolbar button{border:0;background:0 0}.editor-toolbar button:hover{background:#d3d3d3}#suggest{position:absolute;background-color:#fff;border:1px solid #ccf;z-index:100;left:9px;padding:5px;top:70px;overflow:auto}#suggest div{white-space:nowrap;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;font-size:.8em}#suggest div.select{color:#fff;background-color:#36f}#suggest div.over{background-color:#9cf}object{max-width:100%;max-height:100%;width:initial;height:initial;position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;z-index:10}.headerTitle{margin:10px;font-size:2em;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:5px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;display:inherit;margin-top:0}.headerTags{margin:10px;font-size:11px;font-family:'Lucida Grande',Verdana,Arial,Helvetica,sans-serif;position:relative;top:-20px}#content{height:100%;overflow:auto;padding:0 15px}.save_button{position:absolute;right:16px;top:14px;height:24px;width:24px;background:url(images/button_save.png) no-repeat;display:none}.save_button a{width:100%;height:100%;position:absolute}#sidebar .searchbox{position:absolute;width:350px}#sidebar .searchbox input{font-weight:400;background:#fff;height:21px;background-image:url(./../../../skins/larry/images/buttons.png);width:100%;padding:0 4px 0 24px;background-repeat:no-repeat;background-position:-7px -671px;background-size:36px}#sidebar{width:400px;position:absolute;float:left;overflow:hidden;border-radius:0;margin-right:5px;top:0;bottom:0;left:0;right:0;border-right:1px solid #d4dbde!important}#filelist_header{display:block;top:0;left:0;right:0;height:34px;padding:6px;background:#efefef;white-space:nowrap;border-bottom:1px solid #dfdfdf;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}#taglist{display:none}#note_tags{border:thin solid #ced4da}.filelist{width:100%;height:calc(100% - 34px);overflow:auto;background:#dcdcdc}.cke_chrome{border:0!important}#main{position:absolute;left:0;right:0;top:0;bottom:0}.main{left:395px!important;border-radius:0!important}.main_header{height:100px;background:#efefef;width:100%;top:0;position:sticky}.main_header input{width:calc(100% - 20px);padding:0;margin-left:6px;margin-top:5px;padding-left:5px;border:thin solid #ced4da!important}.main_area{position:absolute;top:90px;height:calc(100% - 90px);width:100%;border-bottom-left-radius:4px;border-bottom-right-radius:4px;background:#fff;overflow:auto}.main_area textarea{border:0;width:calc(100% - 20px);height:calc(100% - 61px);white-space:pre;padding:10px;top:35px;position:absolute;font-family:revert;border-radius:revert;resize:none;outline:0}.main_area textarea:focus{box-shadow:revert}#atoolbar{background:#efefef;border-bottom:1px solid #bbb;padding:0 10px;z-index:12;position:absolute;right:0;left:0}#atoolbar li{border-radius:4px;cursor:pointer;margin:4px 3px;padding:5px;color:#525252}#atoolbar li:hover{background:#e3e3e3}#atoolbar i.separator{display:inline;width:2px;border-left:1px solid #d9d9d9;border-right:1px solid #fff;margin:0 5px}#filelist{margin:0;padding:0}.fsize{text-align:right;float:right;width:50px;border-radius:9px;padding:0 6px;background:#929292;position:relative;color:#fff!important;font-weight:700!important;line-height:15px}.filelist li{white-space:nowrap;padding:3px 5px 2px 40px;font-weight:700;color:#2c363a;border-bottom:1px solid #f1f3f4;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif;font-size:12px;height:35px}.filelist a:hover span#taglist{display:block;background:#000!important;z-index:10;position:absolute;max-width:300px;border-radius:5px;padding:5px;color:#fff;white-space:normal;margin-top:-55px;box-shadow:1px 1px 3px gray;left:10px}.filelist li.pdf{background:#fff url(images/pdf-icon.png) 5px 7px/27px no-repeat}.filelist li.html,li.htm{background:#fff url(images/html-icon.png) 5px 7px/27px no-repeat}.filelist li.jpg{background:#fff url(images/jpg-icon.png) 5px 7px/27px no-repeat}.filelist li.md{background:#fff url(images/md-icon.png) 5px 7px/27px no-repeat}.filelist li.txt{background:#fff url(images/txt-icon.png) 5px 7px/27px no-repeat}.filelist li{background:#fff url(images/unknown-icon.png) 5px 7px/27px no-repeat}.selected,.selected a,.selected span{background-color:#ebf9ff!important}.selected span.fsize{background:#13aff8!important}.filelist li:hover{background-color:#e8eaf6;text-decoration:none!important}.filelist a>span{color:#666;font-weight:400;font-size:11px;font-family:"Lucida Grande",Verdana,Arial,Helvetica,sans-serif}.filelist a{text-decoration:none!important;color:#536871;width:100%;height:100%;display:inline-block;text-overflow:ellipsis;overflow:hidden}.cke_editable{cursor:text;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif}.editor-preview blockquote,.editor-preview-side blockquote{color:#3c763d;background-color:rgba(66,185,131,.1);padding:0;margin:15px 0;border-left:4px solid #42b983;margin-left:auto;margin-right:auto}.editor-preview blockquote p,.editor-preview-side blockquote p{padding:5px}.editor-preview code{overflow-x:auto;scrollbar-width:thin;margin:0 0 -5px 0;user-select:all;width:unset;background:#eed7d7;font-size:.92em;font-family:Consolas,Monaco,monospace!important;color:#e93700;padding:2px 4px;border-radius:5px;display:inline-block;white-space:pre}.editor-preview a,.editor-preview-side a{color:#42b983;text-decoration:none;font-style:normal;font-size:15px;font-weight:600}.editor-preview pre,.editor-preview-side pre{background:#f8f8f8;margin-bottom:10px;padding:7px;font-size:85%;line-height:1.45;border-radius:4px;border:thin solid #dfe2e5;overflow:hidden;margin-left:auto;margin-right:auto;padding-right:10px}.editor-preview pre code{color:unset;background:unset}.editor-preview{background:#fff;font-family:Helvetica Neue,Helvetica,Segoe UI,Arial,freesans,sans-serif;color:#333;background:#fff}.editor-preview *{max-width:860px;margin-left:auto;margin-right:auto}.editor-preview table,.editor-preview-side table{border-spacing:0;border-collapse:collapse;text-shadow:1px 1px 0 #fff}.editor-preview table thead th,.editor-preview-side table thead th{background-color:#e0e0e0;border:1px solid #ddd;padding:5px}.editor-preview table tr:nth-child(2n),.editor-preview-side table tr:nth-child(2n){background:linear-gradient(to bottom,#f8f8f8 0,#f6f6f6 100%)}.editor-preview table td,.editor-preview table th,.editor-preview-side table td,.editor-preview-side table th{border:1px solid #ddd;padding:5px}.editor-preview kbd,.editor-preview-side kbd{font-family:Consolas,"Courier New",monospace;display:inline-block;border-radius:5px;padding:0 4px;margin:2px;font-size:.9em;vertical-align:text-bottom;background:#fff;color:#555;user-select:none;border-width:1px 3px 3px 1px;border-color:#ccc #aaa #888 #bbb;white-space:nowrap;border-style:solid}.editor-preview img{display:block;max-width:860px}.editor-preview p>img{display:initial}.EasyMDEContainer{top:0;position:relative}.EasyMDEContainer .CodeMirror{position:inherit;border:0}.EasyMDEContainerH{display:none!important}.editor-preview-full{position:fixed;left:395px;width:calc(100% - 396px);top:80px;height:calc(100% - 74px);padding-top:20px}.CodeMirror-vscrollbar{overflow-y:hidden}.editor-toolbar{position:fixed;width:calc(100% - 432px);background:#efefef;border:0;border-bottom:1px solid;border-color:#bbb;z-index:101;border-radius:0;top:86px}.EasyMDEContainer .CodeMirror-scroll{padding-top:30px}.editor-toolbar::after{margin-top:2px}.editor-toolbar::before{margin-bottom:2px}.editor-toolbar button.active,.editor-toolbar button:hover{background:#e3e3e3;border-color:#95a5a6}.editor-toolbar.fullscreen{background:#f4f4f4}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{font-size:smaller}.tagify{--tags-border-color:transparent!important;z-index:100;width:calc(100% - 15px);font-size:.7em;font-style:italic;flex-wrap:unset!important;left:7px;border-radius:4px;border:thin solid transparent!important;position:absolute;top:50px}.tagify[readonly]:not(.tagify--mix) .tagify__tag>div::before{box-shadow:0 0 0 var(--tag-inset-shadow-size,1.1em) var(--tag-hover,#d3e2e2) inset!important}tags{overflow:auto!important}tags.edit{background:#fff;border:thin solid #ced4da!important}tags.edit:focus-within{box-shadow:0 0 5px 2px rgba(71,135,177,.9)!important;z-index:102}.tagify__tag+.tagify__input::before{display:none}.cm-s-easymde .cm-comment{font-family:Consolas,inherit monospace}.db-spinner{width:30px;height:30px;border-radius:50%;background-color:transparent;border:10px solid #2229;border-top:10px solid #03a9f4;border-bottom:100x solid #03a9f4;-webkit-animation:1s spin linear infinite;animation:1s spin linear infinite;position:absolute;top:50%;left:50%;z-index:100}@-webkit-keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}#tocdiv{position:fixed;z-index:10;background:#efefef;width:300px;top:77px;right:-310px;white-space:nowrap;padding:10px 0;box-shadow:1px 3px 3px 0 rgba(50,50,50,.3);border-bottom-left-radius:5px;border-bottom-right-radius:5px;border:1px solid #bbb;border-top:0;overflow:auto;max-height:calc(100% - 140px)}#tocdiv.tdhidden{right:26px}#tbutton{position:absolute;z-index:100;top:15px;right:10px;background:#f4f4f4;border:1px solid #ced4da;border-radius:5px;cursor:pointer;color:#535252;font-size:.8em;padding:3px;outline:0;box-shadow:revert}#tocdiv ul{margin:0;padding-left:20px}#tocdiv li{list-style:none;padding-right:10px}#tocdiv a{color:#42b983;text-decoration:none;font-weight:bolder;overflow:hidden;text-overflow:ellipsis;width:100%;display:inline-block;font-size:.9em} \ No newline at end of file