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

Commit b8528e9

Browse files
committed
now options are not added to config
1 parent 809ecd2 commit b8528e9

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/components/ColorPicker.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { castHslToString } from "./styles/ColumnWidthStyle";
66
export function ColorPicker(colorPickerProps: ColorPickerProps) {
77
const { view, options, option, columnKey } = colorPickerProps;
88
const [colorState, setColorState] = React.useState(option.backgroundColor);
9-
const [labelState, setLabelState] = React.useState(option.label);
109
const [showColorPicker, setShowColorPicker] = React.useState(false);
1110
/**
1211
* Manage color picker
@@ -18,14 +17,15 @@ export function ColorPicker(colorPickerProps: ColorPickerProps) {
1817
setColorState(castHslToString(color.hsl));
1918
option.backgroundColor = castHslToString(color.hsl);
2019
}
20+
2121
async function handleChangeComplete(
2222
color: ColorResult,
2323
event: React.ChangeEvent<HTMLInputElement>
2424
) {
2525
handleChange(color, event);
2626
setShowColorPicker(false);
2727
// Persist changes
28-
await view.diskConfig.updateColumnConfig(columnKey, {
28+
await view.diskConfig.updateColumnProperties(columnKey, {
2929
options: options,
3030
});
3131
}
@@ -36,7 +36,7 @@ export function ColorPicker(colorPickerProps: ColorPickerProps) {
3636
onClick={() => setShowColorPicker(!showColorPicker)}
3737
style={{ backgroundColor: colorState, padding: "5px" }}
3838
>
39-
{labelState}
39+
{option.label}
4040
</span>
4141
{showColorPicker && (
4242
<SketchPicker

src/components/modals/handlers/MediaDimensionsHandler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ import { AbstractColumnHandler } from "components/modals/handlers/AbstractColumn
33
import { ColumnHandlerResponse } from "cdm/ModalSettingsModel";
44

55
export class MediaDimensionsHandler extends AbstractColumnHandler {
6-
settingTitle: string = 'Choose dimensions of embeded media';
6+
settingTitle: string = 'Dimensions of embeded media';
77
handle(columnHandlerResponse: ColumnHandlerResponse): ColumnHandlerResponse {
88
const { column, containerEl, view, columnSettingsManager } = columnHandlerResponse;
99
const dbSettings = view.plugin.settings;
1010
const { config } = column
1111
if (config.enable_media_view) {
1212
// Check if media_settings is enabled
1313
new Setting(containerEl)
14+
.setName(this.settingTitle)
15+
.setDesc("Choose dimensions of embeded media (heigthxwidth)")
1416
.addText(text => {
1517
text.setPlaceholder("Height")
1618
.setValue(config.media_height.toString())

src/components/modals/handlers/SelectedColumnOptionsHandler.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
2424
backgroundColor: randomColor(),
2525
});
2626
// Persist changes
27-
view.diskConfig.updateColumnConfig(column.key, {
27+
view.diskConfig.updateColumnProperties(column.key, {
2828
options: options,
2929
});
3030
// Force refresh of settings
@@ -39,7 +39,7 @@ export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
3939
.addText((text) => {
4040
text
4141
.setPlaceholder("label of option")
42-
.setValue("")
42+
.setValue(newLabel)
4343
.onChange(async (value: string): Promise<void> => {
4444
newLabel = value;
4545
});

src/services/DatabaseInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default class DatabaseInfo {
8989
* @param columnId
9090
* @param properties
9191
*/
92-
async updateColumnProperties<P extends keyof DatabaseColumn>(columnId: string, properties: Record<string, P>): Promise<void> {
92+
async updateColumnProperties(columnId: string, properties: Partial<DatabaseColumn>): Promise<void> {
9393
const colToUpdate = this.yaml.columns[columnId];
9494
for (const key in properties) {
9595
colToUpdate[key] = properties[key];

0 commit comments

Comments
 (0)