File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ export class BlockContext extends Context {
284
284
public prevBlock ?: BlockContext | null
285
285
public level ?: number
286
286
287
- public children ?: ( { } | BlockContext ) [ ]
287
+ public children ?: ( string | BlockContext ) [ ]
288
288
public refs ?: { id : number } [ ]
289
289
290
290
static createFromEntity ( block : BlockEntity , args : {
@@ -322,12 +322,12 @@ export class BlockContext extends Context {
322
322
obj . level = args . level ?? 0
323
323
const rootLevel : number = obj . level
324
324
325
- obj . children = block . children ?? [ ]
326
- if ( obj . children . length > 0 ) {
327
- if ( Array . isArray ( obj . children [ 0 ] ) ) // non-tree mode: get only children count
328
- obj . children = Array ( obj . children . length ) . fill ( { } )
325
+ const children = block . children ?? [ ]
326
+ if ( children . length > 0 ) {
327
+ if ( Array . isArray ( children [ 0 ] ) ) // non-tree mode: fill only with UUIDs
328
+ obj . children = ( children as [ string , string ] [ ] ) . map ( ( [ _ , uuid ] ) => uuid )
329
329
else // tree mode
330
- obj . children = obj . children . map (
330
+ obj . children = children . map (
331
331
b => BlockContext . createFromEntity ( b as BlockEntity , {
332
332
level : rootLevel + 1 ,
333
333
page : obj . page ,
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ async function getCurrentContext(
66
66
}
67
67
68
68
let currentPage : PageEntity | null
69
- const currentBlock = await logseq . Editor . getBlock ( blockOrPageUUID )
69
+ const currentBlock = await logseq . Editor . getBlock ( blockOrPageUUID , { includeChildren : true } )
70
70
if ( currentBlock )
71
71
currentPage = await logseq . Editor . getPage ( currentBlock . page . id )
72
72
else {
Original file line number Diff line number Diff line change @@ -526,7 +526,7 @@ function blocks_uuid(context: C) {
526
526
527
527
const isHeadTemplateBlock = context . template ! . includingParent
528
528
? context . template ! . block . id === context . self ! . id
529
- : ( context . template ! . block . children ! [ 0 ] as BlockEntity ) . id === context . self ! . id
529
+ : ( context . template ! . block . children ! [ 0 ] as unknown as BlockEntity ) . id === context . self ! . id
530
530
531
531
const uuid = isHeadTemplateBlock
532
532
? context . currentBlock . uuid !
You can’t perform that action at this time.
0 commit comments