From 1e9b7726926bbb725c86f7f7ac655a8ecc74b864 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 24 Aug 2025 20:25:11 +0300 Subject: [PATCH] chore(react/ribbon): fix cannot set style when switching attributes --- .../src/widgets/ribbon/components/AttributeEditor.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx index 14d96f6be..d01216022 100644 --- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx +++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx @@ -1,4 +1,4 @@ -import { useContext, useEffect, useMemo, useRef, useState } from "preact/hooks" +import { useEffect, useMemo, useRef, useState } from "preact/hooks"; import { AttributeEditor as CKEditorAttributeEditor, MentionFeed, ModelElement, ModelNode, ModelPosition } from "@triliumnext/ckeditor5"; import { t } from "../../../services/i18n"; import server from "../../../services/server"; @@ -12,8 +12,6 @@ import AttributeDetailWidget from "../../attribute_widgets/attribute_detail"; import attribute_parser, { Attribute } from "../../../services/attribute_parser"; import ActionButton from "../../react/ActionButton"; import { escapeQuotes } from "../../../services/utils"; -import { ParentComponent } from "../../react/react_utils"; -import Component from "../../../components/component"; import link from "../../../services/link"; import froca from "../../../services/froca"; import contextMenu from "../../../menus/context_menu"; @@ -144,7 +142,11 @@ export default function AttributeEditor({ note, componentId, notePath, ntxId }: // blink the attribute text to give a visual hint that save has been executed if (wrapperRef.current) { wrapperRef.current.style.opacity = "0"; - setTimeout(() => wrapperRef.current!.style.opacity = "1", 100); + setTimeout(() => { + if (wrapperRef.current) { + wrapperRef.current.style.opacity = "1" + } + }, 100); } }