Various AT Protocol integrations with obsidian
20
fork

Configure Feed

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

open edit modal from view

+10 -23
+2 -1
src/components/cardDetailModal.ts
··· 2 2 import type AtmospherePlugin from "../main"; 3 3 import { createSembleNote, deleteRecord } from "../lib"; 4 4 import type { ATBookmarkItem } from "../sources/types"; 5 + import { EditItemModal } from "./editItemModal"; 5 6 6 7 export class CardDetailModal extends Modal { 7 8 plugin: AtmospherePlugin; ··· 55 56 setIcon(editBtn, "pencil"); 56 57 editBtn.addEventListener("click", () => { 57 58 this.close(); 58 - this.item.openEditModal(this.onSuccess); 59 + new EditItemModal(this.plugin, this.item, this.onSuccess).open(); 59 60 }); 60 61 } 61 62 }
+6 -6
src/components/editItemModal.ts
··· 64 64 65 65 const canCollect = this.item.canAddToCollections(); 66 66 const [sembleColls, sembleAssocs, marginColls, marginAssocs, availableTags] = await Promise.all([ 67 - canCollect ? this.sembleSource.getAvailableCollections!() : Promise.resolve([]), 68 - canCollect ? this.sembleSource.getCollectionAssociations!() : Promise.resolve([]), 69 - canCollect ? this.marginSource.getAvailableCollections!() : Promise.resolve([]), 70 - canCollect ? this.marginSource.getCollectionAssociations!() : Promise.resolve([]), 67 + canCollect ? this.sembleSource.getAvailableCollections() : Promise.resolve([]), 68 + canCollect ? this.sembleSource.getCollectionAssociations() : Promise.resolve([]), 69 + canCollect ? this.marginSource.getAvailableCollections() : Promise.resolve([]), 70 + canCollect ? this.marginSource.getCollectionAssociations() : Promise.resolve([]), 71 71 this.itemSource.getAvilableTags?.() ?? Promise.resolve(undefined), 72 72 ]); 73 73 ··· 258 258 for (const state of toRemove) { 259 259 if (state.linkUri) { 260 260 const source = state.source === "semble" ? this.sembleSource : this.marginSource; 261 - await source.removeFromCollection!(state.linkUri); 261 + await source.removeFromCollection(state.linkUri); 262 262 } 263 263 } 264 264 265 265 for (const state of toAdd) { 266 266 const source = state.source === "semble" ? this.sembleSource : this.marginSource; 267 - await source.addToCollection!(this.item.getUri(), this.item.getCid(), state.uri); 267 + await source.addToCollection(this.item.getUri(), this.item.getCid(), state.uri); 268 268 } 269 269 270 270 if (toAdd.length > 0) messages.push(`Added to ${toAdd.length} collection${toAdd.length > 1 ? "s" : ""}`);
-4
src/sources/community.ts
··· 58 58 return false; 59 59 } 60 60 61 - openEditModal(onSuccess?: () => void): void { 62 - const { EditItemModal } = require("../components/editItemModal"); 63 - new EditItemModal(this.plugin, this, onSuccess).open(); 64 - } 65 61 66 62 getTitle(): string | undefined { 67 63 const enriched = this.record.value.enriched;
-4
src/sources/margin.ts
··· 55 55 return true; 56 56 } 57 57 58 - openEditModal(onSuccess?: () => void): void { 59 - const { EditItemModal } = require("../components/editItemModal"); 60 - new EditItemModal(this.plugin, this, onSuccess).open(); 61 - } 62 58 63 59 getTitle(): string | undefined { 64 60 return this.record.value.title || undefined;
-4
src/sources/semble.ts
··· 57 57 return true; 58 58 } 59 59 60 - openEditModal(onSuccess?: () => void): void { 61 - const { EditItemModal } = require("../components/editItemModal"); 62 - new EditItemModal(this.plugin, this, onSuccess).open(); 63 - } 64 60 65 61 getTitle(): string | undefined { 66 62 const card = this.record.value;
-1
src/sources/types.ts
··· 5 5 canAddTags(): boolean; 6 6 canAddToCollections(): boolean; 7 7 canEdit(): boolean; 8 - openEditModal(onSuccess?: () => void): void; 9 8 getUri(): string; 10 9 getCid(): string; 11 10 getCreatedAt(): string;
+2 -3
src/views/bookmarks.ts
··· 1 1 import { ItemView, WorkspaceLeaf, setIcon, Menu, SearchComponent } from "obsidian"; 2 2 import type AtmospherePlugin from "../main"; 3 3 import { CardDetailModal } from "../components/cardDetailModal"; 4 + import { EditItemModal } from "../components/editItemModal"; 4 5 import { CreateCollectionModal } from "../components/createCollectionModal"; 5 6 import { CreateTagModal } from "../components/createTagModal"; 6 7 import type { ATBookmarkItem, DataSource, SourceFilter } from "../sources/types"; ··· 427 428 setIcon(editBtn, "more-vertical"); 428 429 editBtn.addEventListener("click", (e) => { 429 430 e.stopPropagation(); 430 - item.openEditModal(() => { 431 - void this.refresh(); 432 - }); 431 + new EditItemModal(this.plugin, item, () => void this.refresh()).open(); 433 432 }); 434 433 } 435 434