diff --git a/index.ts b/index.ts index 01ae96c..4ad4fb0 100644 --- a/index.ts +++ b/index.ts @@ -124,6 +124,15 @@ const fetchOmnivore = async ( date:: ${new Date(savedAt).toDateString()} > ${description}` + // remove existing block for the same article + const existingBlocks = await logseq.DB.q(`"${slug}"`) + if (existingBlocks && existingBlocks.length > 0) { + console.log(existingBlocks) + for (const block of existingBlocks) { + await logseq.Editor.removeBlock(block.uuid) + } + } + const articleBlock = await logseq.Editor.insertBlock( targetBlock.uuid, content, diff --git a/package.json b/package.json index 425bc56..a46acd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "logseq-omnivore", - "version": "1.4.2", + "version": "1.4.3", "description": "Import Omnivore highlights and articles into Logseq.", "main": "dist/index.html", "targets": {