File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export async function toggleAutoHeadingCommand(opts: {togglingBasedOnFirstBlock:
3232 if ( blocks . length === 0 )
3333 return
3434
35- const firstBlockHeading = blocks [ 0 ] . properties ?. heading
35+ const firstBlockHeading = blocks [ 0 ] . properties ?. heading || HEADING_REGEX . test ( blocks [ 0 ] . content )
3636
3737 for ( const block of blocks ) {
3838 if ( HEADING_REGEX . test ( block . content ) ) {
@@ -54,6 +54,9 @@ export async function toggleAutoHeadingCommand(opts: {togglingBasedOnFirstBlock:
5454 await logseq . Editor . upsertBlockProperty ( block . uuid , PROPERTY , true )
5555 else
5656 await logseq . Editor . removeBlockProperty ( block . uuid , PROPERTY )
57+
58+ // ensure currently edited content will be saved
59+ await logseq . Editor . updateBlock ( block . uuid , block . content )
5760 }
5861}
5962
You can’t perform that action at this time.
0 commit comments