@@ -4,7 +4,7 @@ import { VaultManagerDB } from 'services/FileManagerService';
44import { LOGGER } from "services/Logger" ;
55import NoteInfo from 'services/NoteInfo' ;
66import { DatabaseCore , InputType , SourceDataTypes , UpdateRowOptions } from "helpers/Constants" ;
7- import { generateDataviewTableQuery } from 'helpers/QueryHelper' ;
7+ import { generateDataviewTableQuery , inlineRegexInFunctionOf } from 'helpers/QueryHelper' ;
88import obtainRowDatabaseFields from 'parsers/FileToRowDatabaseFields' ;
99import { parseFrontmatterFieldsToString } from 'parsers/RowDatabaseFieldsToFile' ;
1010import { DataviewService } from 'services/DataviewService' ;
@@ -261,7 +261,7 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
261261 * INLINE GROUP FUNCTIONS
262262 *******************************************************************************************/
263263 async function inlineColumnEdit ( ) : Promise < void > {
264- const inlineFieldRegex = new RegExp ( `(^ ${ columnId } [:]{2})+(.*$)` , 'gm' ) ;
264+ const inlineFieldRegex = inlineRegexInFunctionOf ( columnId ) ;
265265 if ( ! inlineFieldRegex . test ( content ) ) {
266266 await inlineAddColumn ( ) ;
267267 return ;
@@ -274,7 +274,7 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
274274 action : 'replace' ,
275275 file : file ,
276276 regexp : inlineFieldRegex ,
277- newValue : `$1 ${ DataviewService . parseLiteral ( newValue , InputType . MARKDOWN , ddbbConfig , true ) } `
277+ newValue : `$3$6$7$8 ${ DataviewService . parseLiteral ( newValue , InputType . MARKDOWN , ddbbConfig , true ) } $10$11 `
278278 } ;
279279 await VaultManagerDB . editNoteContent ( noteObject ) ;
280280 await persistFrontmatter ( ) ;
@@ -288,12 +288,12 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
288288 * group 1 is inline field checking that starts in new line
289289 * group 2 is the current value of inline field
290290 */
291- const inlineFieldRegex = new RegExp ( `(^ ${ columnId } [:]{2})+(.*$)` , 'gm' ) ;
291+ const inlineFieldRegex = inlineRegexInFunctionOf ( columnId ) ;
292292 const noteObject = {
293293 action : 'replace' ,
294294 file : file ,
295295 regexp : inlineFieldRegex ,
296- newValue : `${ newValue } ::$2 `
296+ newValue : `$6$7 $ {newValue } :: $4$9$10$11 `
297297 } ;
298298 await VaultManagerDB . editNoteContent ( noteObject ) ;
299299 await persistFrontmatter ( ) ;
@@ -316,11 +316,12 @@ export async function updateRowFile(file: TFile, columnId: string, newValue: Lit
316316 * group 1 is inline field checking that starts in new line
317317 * group 2 is the current value of inline field
318318 */
319- const inlineFieldRegex = new RegExp ( `(^ ${ columnId } [:]{2}\\s)+([\\w\\W]+?$)` , 'gm' ) ;
319+ const inlineFieldRegex = inlineRegexInFunctionOf ( columnId ) ;
320320 const noteObject = {
321- action : 'remove ' ,
321+ action : 'replace ' ,
322322 file : file ,
323- regexp : inlineFieldRegex
323+ regexp : inlineFieldRegex ,
324+ newValue : `$6$11`
324325 } ;
325326 await VaultManagerDB . editNoteContent ( noteObject ) ;
326327 }
0 commit comments