diff --git a/external/@worldbrain/memex-common b/external/@worldbrain/memex-common index af3d29d3a9..f3f1f0d264 160000 --- a/external/@worldbrain/memex-common +++ b/external/@worldbrain/memex-common @@ -1 +1 @@ -Subproject commit af3d29d3a956e9871ac18ac65e12ab2b285121c7 +Subproject commit f3f1f0d2642b6d21e32ad028cd79cbe8fd1a7d82 diff --git a/src/content-scripts/content_script/global.ts b/src/content-scripts/content_script/global.ts index f2076b398f..7c73fc195f 100644 --- a/src/content-scripts/content_script/global.ts +++ b/src/content-scripts/content_script/global.ts @@ -216,6 +216,22 @@ export async function main( } } + const deleteAnnotation = async (annotationId: string) => { + const annotation = annotationsCache.annotations.byId[annotationId] + const { localId } = annotation + + highlightRenderer.removeAnnotationHighlight({ + id: annotationId, + }) + + annotationsCache.removeAnnotation({ + unifiedId: annotation.unifiedId, + }) + if (localId != null) { + await annotationsBG.deleteAnnotation(localId) + } + } + const pageInfo = new PageInfo(params) // 1. Create a local object with promises to track each content script @@ -913,6 +929,9 @@ export async function main( instaExecutePrompt: instaExecutePrompt ?? false, }) }, + deleteAnnotation: async (annotationId: string) => { + await deleteAnnotation(annotationId) + }, createYoutubeTimestamp: async (commentText: string) => { await inPageUI.showSidebar({ action: 'youtube_timestamp', @@ -1136,6 +1155,9 @@ export async function main( fullPageUrl: originalPageURL, }) }, + deleteAnnotation: async (annotationId) => { + await annotationsFunctions.deleteAnnotation(annotationId) + }, annotationsBG, annotationsCache, contentSharingBG, diff --git a/src/in-page-ui/tooltip/content_script/interactions.ts b/src/in-page-ui/tooltip/content_script/interactions.ts index 47e561bee3..5032b5d392 100644 --- a/src/in-page-ui/tooltip/content_script/interactions.ts +++ b/src/in-page-ui/tooltip/content_script/interactions.ts @@ -87,6 +87,9 @@ export const insertTooltip = async (params: TooltipInsertDependencies) => { createHighlight: async (...args) => { return await params.createHighlight(...args) }, + deleteAnnotation: async (annotationId: string) => { + return await params.deleteAnnotation(annotationId) + }, askAI: params.askAI, getKBShortcuts: async () => { const state = await getKeyboardShortcutsState()