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

Commit 080279a

Browse files
committed
Merge branch 'bug-reset-table-after-change-settings'
2 parents 4615646 + 42f39a0 commit 080279a

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

docs/docs/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 1.3.0
2+
### Shiny new things
3+
- Refactor of column setting to Obsidian modal. Now every column will have its own configuration! As a consequence, the next point were possible:
4+
- Every text column can configure its own media settings
5+
- Options of Selected type column are now persistent.
6+
- You can add new lavels even if does not exist in any cell (or delete it)
7+
- You can now select the color of the option label.
8+
### Improved
9+
- The table will be refreshed when you close either the settings modal or the new modals of the column adjustments. This will suppose a minimal performance impact with a loading time of less than a second. Its a provisional solution until the refactor of react states stategy
110
## 1.2.0
211
*Published on 2022/05/19*
312
### Shiny new things

src/DatabaseView.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ export class DatabaseView extends TextFileView implements HoverParent {
186186
}
187187
}
188188

189+
async reloadDatabase() {
190+
ReactDOM.unmountComponentAtNode(this.tableContainer);
191+
this.initDatabase();
192+
}
193+
189194
clear(): void {
190195
/*
191196
Obsidian *only* calls this after unloading a file, before loading the next.

src/Settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ export class SettingsModal extends Modal {
170170

171171
this.settingsManager.cleanUp();
172172
contentEl.empty();
173+
this.view.reloadDatabase();
173174
}
174175
}
175176

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function setOptionsOfSelectDataType(
3838
let match = options.find(
3939
(option: { label: string }) => option.label === rowValue
4040
);
41-
if (!match) {
41+
if (!match && rowValue !== undefined && rowValue !== "") {
4242
options.push({ label: rowValue, backgroundColor: randomColor() });
4343
}
4444
});

src/components/HeaderMenu.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,13 @@ const HeaderMenu = (headerMenuProps: HeaderMenuProps) => {
420420
<div style={{ padding: "4px 0px" }}>
421421
<div
422422
className="menu-item sort-button"
423-
onClick={() =>
424-
new ColumnModal(initialState.view, headerMenuProps).open()
425-
}
423+
onClick={() => {
424+
new ColumnModal(
425+
initialState.view,
426+
headerMenuProps
427+
).open();
428+
setExpanded(false);
429+
}}
426430
>
427431
<span className="svg-icon svg-text icon-margin">
428432
<AdjustmentsIcon />

src/components/modals/ColumnModal.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ export class ColumnModal extends Modal {
3030

3131
onClose() {
3232
const { contentEl } = this;
33-
handleColumnChanges(
34-
(this.headerMenuProps.headerProps as any).dataDispatch,
35-
this.headerMenuProps.headerProps.column)
3633
contentEl.empty();
34+
this.view.reloadDatabase();
3735
}
3836
}
3937
export class ColumnSettingsManager {

0 commit comments

Comments
 (0)