Skip to content

Commit b24842d

Browse files
authored
Merge pull request #12 from omnivore-app/update-existing-article-blocks
Remove the existing article blocks and insert new one if it is updated
2 parents 9c4167a + 19f70f2 commit b24842d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ const fetchOmnivore = async (
124124
date:: ${new Date(savedAt).toDateString()}
125125
> ${description}`
126126

127+
// remove existing block for the same article
128+
const existingBlocks = await logseq.DB.q<BlockEntity>(`"${slug}"`)
129+
if (existingBlocks && existingBlocks.length > 0) {
130+
console.log(existingBlocks)
131+
for (const block of existingBlocks) {
132+
await logseq.Editor.removeBlock(block.uuid)
133+
}
134+
}
135+
127136
const articleBlock = await logseq.Editor.insertBlock(
128137
targetBlock.uuid,
129138
content,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logseq-omnivore",
3-
"version": "1.4.2",
3+
"version": "1.4.3",
44
"description": "Import Omnivore highlights and articles into Logseq.",
55
"main": "dist/index.html",
66
"targets": {

0 commit comments

Comments
 (0)