Skip to content

Commit 04cfb78

Browse files
committed
fix: fix properties handling in all transform commands
1 parent 178b970 commit 04cfb78

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils/logseq.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ export async function transformBlocksTreeByReplacing(
210210
return null // blocks removal cannot be used
211211

212212
const transformedBlocks = transformChildrenCallback(root.children as BlockEntity[])
213+
walkBlockTree({content: '', children: transformedBlocks as IBatchBlock[]}, (b, level) => {
214+
b.properties = PropertiesUtils.fromCamelCaseAll(b.properties ?? {})
215+
})
213216

214217
// root is the first block in page
215218
if (root.left.id === root.page.id) {
@@ -218,15 +221,16 @@ export async function transformBlocksTreeByReplacing(
218221

219222
// logseq bug: cannot use sibling next to root to insert whole tree to a page
220223
// so insert root of a tree separately from children
224+
const properties = PropertiesUtils.fromCamelCaseAll(root.properties)
221225
let prepended = await logseq.Editor.insertBlock(
222226
page!.uuid, root.content,
223-
{properties: root.properties, before: true, customUUID: root.uuid},
227+
{properties, before: true, customUUID: root.uuid},
224228
)
225229
if (!prepended) {
226230
// logseq bug: for empty pages need to change `before: true → false`
227231
prepended = (await logseq.Editor.insertBlock(
228232
page!.uuid, root.content,
229-
{properties: root.properties, before: false, customUUID: root.uuid},
233+
{properties, before: false, customUUID: root.uuid},
230234
))!
231235
}
232236

0 commit comments

Comments
 (0)