@@ -232,7 +232,7 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
232232
233233 async function persistFrontmatter ( deletedColumn ?: string ) : Promise < void > {
234234 // If the frontmatter is empty, do not persist it
235- if ( Object . keys ( rowFields . frontmatter ) . length > 0 ) {
235+ if ( Object . keys ( rowFields . frontmatter ) . length > 0 || deletedColumn !== undefined ) {
236236 const frontmatterGroupRegex = contentHasFrontmatter ? / ^ - - - [ \s \S ] + ?- - - / g : / ( ^ [ \s \S ] * $ ) / g;
237237 const frontmatterFieldsText = parseFrontmatterFieldsToString ( rowFields , ddbbConfig , deletedColumn ) ;
238238 const noteObject = {
@@ -265,7 +265,7 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
265265 newValue : `$3$6$7$8 ${ DataviewService . parseLiteral ( newValue , InputType . MARKDOWN , ddbbConfig , true ) } $10$11`
266266 } ;
267267 await VaultManagerDB . editNoteContent ( noteObject ) ;
268- await persistFrontmatter ( ) ;
268+ await persistFrontmatter ( columnId ) ;
269269 }
270270
271271 async function inlineColumnKey ( ) : Promise < void > {
@@ -288,18 +288,19 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
288288 }
289289
290290 async function inlineAddColumn ( ) : Promise < void > {
291- const inlineAddRegex = new RegExp ( `(^---[\\s\\S]+?---\\n)+( [\\s\\S]+? $)` , 'g' ) ;
291+ const inlineAddRegex = contentHasFrontmatter ? new RegExp ( `(^---[\\s\\S]+?---)+([\\s\\S]*$)` , 'g' ) : new RegExp ( `(^ [\\s\\S]* $)`, 'g' ) ;
292292 const noteObject = {
293293 action : 'replace' ,
294294 file : file ,
295295 regexp : inlineAddRegex ,
296296 newValue : inline_regex_target_in_function_of (
297297 ddbbConfig . inline_new_position ,
298298 columnId ,
299- DataviewService . parseLiteral ( newValue , InputType . MARKDOWN , ddbbConfig ) . toString ( )
299+ DataviewService . parseLiteral ( newValue , InputType . MARKDOWN , ddbbConfig ) . toString ( ) ,
300+ contentHasFrontmatter
300301 )
301302 } ;
302- await persistFrontmatter ( ) ;
303+ await persistFrontmatter ( columnId ) ;
303304 await VaultManagerDB . editNoteContent ( noteObject ) ;
304305 }
305306
0 commit comments