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

Commit d68cb79

Browse files
committed
ux of color picker improved
1 parent b8528e9 commit d68cb79

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/components/ColorPicker.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ColorPickerProps } from "cdm/StyleModel";
22
import React from "react";
33
import { ColorResult, SketchPicker } from "react-color";
4-
import { castHslToString } from "./styles/ColumnWidthStyle";
4+
import { castHslToString } from "components/styles/ColumnWidthStyle";
55

66
export function ColorPicker(colorPickerProps: ColorPickerProps) {
77
const { view, options, option, columnKey } = colorPickerProps;
@@ -23,7 +23,6 @@ export function ColorPicker(colorPickerProps: ColorPickerProps) {
2323
event: React.ChangeEvent<HTMLInputElement>
2424
) {
2525
handleChange(color, event);
26-
setShowColorPicker(false);
2726
// Persist changes
2827
await view.diskConfig.updateColumnProperties(columnKey, {
2928
options: options,
@@ -39,11 +38,13 @@ export function ColorPicker(colorPickerProps: ColorPickerProps) {
3938
{option.label}
4039
</span>
4140
{showColorPicker && (
42-
<SketchPicker
43-
color={colorState}
44-
onChange={handleChange}
45-
onChangeComplete={handleChangeComplete}
46-
/>
41+
<div onMouseLeave={() => setShowColorPicker(false)}>
42+
<SketchPicker
43+
color={colorState}
44+
onChange={handleChange}
45+
onChangeComplete={handleChangeComplete}
46+
/>
47+
</div>
4748
)}
4849
</>
4950
);

src/components/modals/handlers/SelectedColumnOptionsHandler.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ import { ColumnHandlerResponse } from "cdm/ModalSettingsModel";
22
import { ColorPickerProps } from "cdm/StyleModel";
33
import { ColorPicker } from "components/ColorPicker";
44
import { AbstractColumnHandler } from "components/modals/handlers/AbstractColumnHandler";
5-
import { castHslToString } from "components/styles/ColumnWidthStyle";
65
import { randomColor } from "helpers/Colors";
76
import { ButtonComponent, Setting } from "obsidian";
87
import React from "react";
9-
import { ColorResult } from "react-color";
108
import ReactDOM from "react-dom";
11-
import { add_button } from "settings/SettingsComponents";
129

1310
export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
1411
settingTitle: string = "Column Options";
@@ -66,7 +63,7 @@ export class SelectedColumnOptionsHandler extends AbstractColumnHandler {
6663
.onClick(async (): Promise<void> => {
6764
options.splice(index, 1);
6865
// Persist changes
69-
await view.diskConfig.updateColumnConfig(column.key, {
66+
await view.diskConfig.updateColumnProperties(column.key, {
7067
options: options,
7168
});
7269
// Force refresh of settings

0 commit comments

Comments
 (0)