Various AT Protocol integrations with obsidian
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle existing clipped document

+16 -1
+8
src/lib/clipper.ts
··· 80 80 } 81 81 const filePath = this.safeFilePath(doc.value.title, clipDir); 82 82 83 + const existingFile = vault.getAbstractFileByPath(filePath); 84 + if (existingFile && existingFile instanceof TFile) { 85 + const leaf = this.plugin.app.workspace.getLeaf(false); 86 + await leaf.openFile(existingFile); 87 + new Notice(`Opened existing clipped document: ${filePath}`); 88 + return; 89 + } 90 + 83 91 let content = `# ${doc.value.title}\n\n`; 84 92 85 93 if (doc.value.description) {
+8 -1
src/views/standardfeed.ts
··· 185 185 header.createEl("h3", { text: doc.value.title, cls: "standard-site-document-title" }); 186 186 187 187 let clipIcon = "book-open"; 188 - if (this.plugin.clipper.existsInClipDir(doc)) { 188 + const isClipped = this.plugin.clipper.existsInClipDir(doc); 189 + if (isClipped) { 189 190 clipIcon = "book-open-check"; 190 191 } 191 192 const clipBtn = header.createEl("span", { cls: "clickable standard-site-document-clip" }); 193 + if (isClipped) { 194 + clipBtn.addClass("mod-success"); 195 + clipBtn.setAttribute("aria-label", "Already clipped"); 196 + } else { 197 + clipBtn.setAttribute("aria-label", "Clip document"); 198 + } 192 199 setIcon(clipBtn, clipIcon); 193 200 clipBtn.addEventListener("click", (e) => { 194 201 e.stopPropagation();