Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 95aa43a

Browse files
committed
minor bugs
1 parent 8a1f86d commit 95aa43a

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

src/components/Table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export function Table(tableData: TableDataType) {
236236
},
237237
onColumnOrderChange: setColumnOrder,
238238
// Hack to force react-table to use all columns when filtering
239-
getColumnCanGlobalFilter: (column) => true,
239+
getColumnCanGlobalFilter: () => true,
240240
globalFilterFn: globalDatabaseFilterFn(configInfo.getLocalSettings()),
241241
meta: {
242242
tableState: tableStore,

src/components/cellTypes/TextCell.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ const TextCell = (props: CellComponentProps) => {
4949
};
5050

5151
const persistChange = (changedValue: string) => {
52-
dataActions.updateCell(
53-
row.index,
54-
column.columnDef as TableColumn,
55-
changedValue.trim(),
56-
columnsInfo.getAllColumns(),
57-
configInfo.getLocalSettings()
58-
);
52+
if (changedValue !== undefined && changedValue !== textCell) {
53+
dataActions.updateCell(
54+
row.index,
55+
column.columnDef as TableColumn,
56+
changedValue.trim(),
57+
columnsInfo.getAllColumns(),
58+
configInfo.getLocalSettings()
59+
);
60+
}
5961
setDirtyCell(false);
6062
};
6163

src/components/reducers/TableFilterFlavours.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ export const globalDatabaseFilterFn: (ddbbConfig: LocalSettings) => FilterFn<Row
1414
if (value === undefined) {
1515
return false;
1616
}
17-
const sanitized = DataviewService.parseLiteral(value, InputType.MARKDOWN, ddbbConfig, true);
18-
return sanitized.toString().toLowerCase().includes(filterValue.toLowerCase())
17+
const sanitized = DataviewService.parseLiteral(value, InputType.MARKDOWN, ddbbConfig, true).toString().toLowerCase();
18+
filterValue = filterValue.toLowerCase();
19+
return sanitized.includes(filterValue) || searchRegex(sanitized, filterValue);
20+
}
21+
22+
function searchRegex(sanitized: string, filterValue: string): boolean {
23+
try {
24+
const regex = new RegExp(filterValue);
25+
return regex.test(sanitized);
26+
} catch (e) {
27+
return false;
28+
}
1929
}

0 commit comments

Comments
 (0)