Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(quick_edit): seamless transition between color changes
Elian Doran453349be26d8
diff --git a/apps/client/src/services/css_class_manager.ts b/apps/client/src/services/css_class_manager.tsindex b28b24b238..4c0c0f3608 100644--- a/apps/client/src/services/css_class_manager.ts+++ b/apps/client/src/services/css_class_manager.ts@@ -38,7 +38,7 @@ function createClassForColor(colorString: string | null) {registeredClasses.add(className);}- return className;+ return `color ${className}`;}function parseColor(color: string) {diff --git a/apps/client/src/stylesheets/theme-next-dark.css b/apps/client/src/stylesheets/theme-next-dark.cssindex 51db2bc27e..117eeb8b7d 100644--- a/apps/client/src/stylesheets/theme-next-dark.css+++ b/apps/client/src/stylesheets/theme-next-dark.css@@ -300,7 +300,7 @@ body .todo-list input[type="checkbox"]:not(:checked):before {border-color: var(--muted-text-color) !important;}-.tinted-quick-edit-dialog {+.quick-edit-dialog-wrapper.color {--modal-background-color: hsl(var(--custom-color-hue), 8.8%, 11.2%);--modal-border-color: hsl(var(--custom-color-hue), 9.4%, 25.1%);--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 13.2%, 20.8%);diff --git a/apps/client/src/stylesheets/theme-next-light.css b/apps/client/src/stylesheets/theme-next-light.cssindex 66e3538c69..a3fc26e93a 100644--- a/apps/client/src/stylesheets/theme-next-light.css+++ b/apps/client/src/stylesheets/theme-next-light.css@@ -276,7 +276,7 @@--custom-bg-color: hsl(var(--custom-color-hue), 37%, 89%, 1);}-.tinted-quick-edit-dialog {+.quick-edit-dialog-wrapper.color {--modal-background-color: hsl(var(--custom-color-hue), 56%, 96%);--modal-border-color: hsl(var(--custom-color-hue), 33%, 41%);--promoted-attribute-card-background-color: hsl(var(--custom-color-hue), 40%, 88%);diff --git a/apps/client/src/widgets/dialogs/PopupEditor.tsx b/apps/client/src/widgets/dialogs/PopupEditor.tsxindex 143ac20b0d..1a065c05fc 100644--- a/apps/client/src/widgets/dialogs/PopupEditor.tsx+++ b/apps/client/src/widgets/dialogs/PopupEditor.tsx@@ -89,18 +89,10 @@ export default function PopupEditor() {export function DialogWrapper({ children }: { children: ComponentChildren }) {const { note } = useNoteContext();const wrapperRef = useRef<HTMLDivElement>(null);- const [ hasTint, setHasTint ] = useState(false);- const [ color ] = useNoteLabel(note, "color");-- // Apply the tinted-dialog class only if the custom color CSS class specifies a hue- useEffect(() => {- if (!wrapperRef.current) return;- const customHue = getComputedStyle(wrapperRef.current).getPropertyValue("--custom-color-hue");- setHasTint(!!customHue);- }, [ note, color ]);+ useNoteLabel(note, "color"); // to update color classreturn (- <div ref={wrapperRef} class={`quick-edit-dialog-wrapper ${note?.getColorClass() ?? ""} ${hasTint ? "tinted-quick-edit-dialog" : ""}`}>+ <div ref={wrapperRef} class={`quick-edit-dialog-wrapper ${note?.getColorClass() ?? ""}`}>{children}</div>)