From 206827211e1c90a9b540bfa6b6c9f56c32949ecf Mon Sep 17 00:00:00 2001 From: 702573n <59178587+702573n@users.noreply.github.com> Date: Thu, 20 Oct 2022 19:36:59 +0200 Subject: [PATCH] Update view.js --- notesList/view.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/notesList/view.js b/notesList/view.js index 26132a6..cb5880a 100644 --- a/notesList/view.js +++ b/notesList/view.js @@ -12,9 +12,6 @@ var attachmentTemplate = "
{{fileExt // Set Root Node const rootNode = dv.el("div", "", {cls: "NotesList", attr: {view: view}}); -// Remove Automatic Created Inner Span -rootNode.querySelector(".NotesList span").remove(); - // Loop Notes To Build ListView notes.forEach(function(note) { @@ -53,19 +50,22 @@ notes.forEach(function(note) { // Optimize Description app.vault.read(filePath).then(function(fileDescription) { - fileDescription = fileDescription.substring(0,300); + fileDescription = fileDescription.substring(0,500); + fileDescription = fileDescription.replace(/(\!\[\[).*(\]\])/gm, ""); + fileDescription = fileDescription.replace(/(\!\[).*(\])/gm, ""); + fileDescription = fileDescription.replace(/(\[).*(\]\().*(\))/gm, ""); fileDescription = fileDescription.replaceAll("---", ""); fileDescription = fileDescription.replaceAll("*", ""); fileDescription = fileDescription.replaceAll("|", ""); fileDescription = fileDescription.replaceAll("![", ""); fileDescription = fileDescription.replaceAll("[", ""); fileDescription = fileDescription.replaceAll("]", ""); - fileDescription = fileDescription.replaceAll("# ", ""); - fileDescription = fileDescription.replaceAll("## ", ""); - fileDescription = fileDescription.replaceAll("### ", ""); - fileDescription = fileDescription.replaceAll("#### ", ""); - fileDescription = fileDescription.replaceAll("##### ", ""); - fileDescription = fileDescription.replaceAll("###### ", ""); + fileDescription = fileDescription.replaceAll("#", ""); + fileDescription = fileDescription.replaceAll("##", ""); + fileDescription = fileDescription.replaceAll("###", ""); + fileDescription = fileDescription.replaceAll("####", ""); + fileDescription = fileDescription.replaceAll("#####", ""); + fileDescription = fileDescription.replaceAll("######", ""); fileDescription = fileDescription.replaceAll("```", ""); fileDescription = fileDescription.replaceAll(">", ""); fileDescription = fileDescription.replaceAll("<", ""); @@ -76,6 +76,6 @@ notes.forEach(function(note) { var listViewItem = noteTemplate.replace("{{filePath}}",filePathName).replace("{{fileName}}",fileName).replace("{{fileDate}}",fileDate).replace("{{fileDescription}}",fileDescription).replace("{{fileAttachments}}",fileAttachments); // Append To Root Node - rootNode.appendChild(dv.el("div", listViewItem, {cls: "listViewItem", attr: {outlinks: fileAttachmentsCounter}})); + rootNode.querySelector("span").appendChild(dv.el("div", listViewItem, {cls: "listViewItem", attr: {outlinks: fileAttachmentsCounter}})); }); });