Skip to content

Commit

Permalink
fix: remove extra asterisks generated in the article blocks when head…
Browse files Browse the repository at this point in the history
…ingBlockTitle setting is empty (#162)
  • Loading branch information
sywhb committed Nov 17, 2023
1 parent 532fa80 commit 9d14075
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,15 @@ const fetchOmnivore = async (inBackground = false) => {
}
}
if (highlightBatchBlocks.length > 0) {
const parentBlockId = existingArticleBlock.uuid
let parentBlockId = existingArticleBlock.uuid
// check if highlight title block exists
const existingHighlightBlock = await getBlockByContent(
pageName,
existingArticleBlock.uuid,
highlightsBlock.content
)
if (existingHighlightBlock) {
parentBlockId = existingHighlightBlock.uuid
// append new highlights to existing article block
for (const highlight of highlightBatchBlocks) {
// check if highlight block exists
Expand All @@ -408,6 +409,7 @@ const fetchOmnivore = async (inBackground = false) => {
highlight,
{
sibling: false,
keepUUID: true,
}
)
}
Expand All @@ -419,12 +421,13 @@ const fetchOmnivore = async (inBackground = false) => {
highlightsBlock,
{
sibling: false,
keepUUID: true,
}
)
}
}
} else {
const children = []
const children: IBatchBlock[] = []

// add content block if sync content is selected
syncContent && children.push(contentBlock)
Expand All @@ -448,6 +451,7 @@ const fetchOmnivore = async (inBackground = false) => {
await logseq.Editor.insertBatchBlock(targetBlockId, articleBatch, {
before: true,
sibling: false,
keepUUID: true,
})
}
}
Expand Down

0 comments on commit 9d14075

Please sign in to comment.