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

Commit 1884854

Browse files
committed
Merge branch '96-bugcolumn-name-changes-are-not-reflected-in-files'
2 parents f8fe0d2 + 33338e8 commit 1884854

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Inconsistent name of calendar and calendar time headers fixed [ISSUE#86](https://github.com/RafaelGB/obsidian-db-folder/issues/86)
66
- Visual bug after deleting and adding the same column. The data was removed into the note but not into the table [ISSUE#83](https://github.com/RafaelGB/obsidian-db-folder/issues/83)
77
- Add column is out of draggable area now, so you cant dnd to the right [ISSUE#63](https://github.com/RafaelGB/obsidian-db-folder/issues/63)
8+
- onBlur event when changing the name of a column now works correctly [ISSUE#96](https://github.com/RafaelGB/obsidian-db-folder/issues/96)
89
## 1.6.2
910
*Published on 2022/06/02*
1011
### No longer broken

src/components/HeaderMenu.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,18 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
269269
strategy: "fixed",
270270
});
271271

272-
function persistLabelChange(newKey: string) {
272+
function persistLabelChange() {
273+
// trim label will get a valid yaml key
274+
const newKey = dbTrim(labelState);
275+
// Check if key already exists. If so, mark it as invalid
276+
if (
277+
headerMenuProps.headerProps.allColumns.find(
278+
(o: Column) => o.id === newKey
279+
)
280+
) {
281+
setLabelStateInvalid(true);
282+
return;
283+
}
273284
const futureOrder = headerMenuProps.headerProps.allColumns.map(
274285
(o: Column) => (o.id === column.id ? newKey : o.id)
275286
);
@@ -294,18 +305,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
294305
}
295306
function handleKeyDown(e: any) {
296307
if (e.key === "Enter") {
297-
// trim label will get a valid yaml key
298-
const newKey = dbTrim(labelState);
299-
// Check if key already exists. If so, mark it as invalid
300-
if (
301-
headerMenuProps.headerProps.allColumns.find(
302-
(o: Column) => o.id === newKey
303-
)
304-
) {
305-
setLabelStateInvalid(true);
306-
return;
307-
}
308-
persistLabelChange(newKey);
308+
persistLabelChange();
309309
}
310310
}
311311

@@ -322,6 +322,7 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
322322
*/
323323
function handleBlur(e: any) {
324324
e.preventDefault();
325+
persistLabelChange();
325326
}
326327

327328
function adjustWidthOfTheColumnsWhenAdd(wantedPosition: number) {

0 commit comments

Comments
 (0)