From 40e4d236f49aca6934779bcf2211069af1c530ef Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 27 Aug 2025 17:42:38 +0300 Subject: [PATCH] fix(react): owned attributes not showing up the first time --- .../src/widgets/ribbon/components/AttributeEditor.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx index 9c6084541..848a760e2 100644 --- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx +++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx @@ -83,12 +83,13 @@ interface AttributeEditorProps { } export default function AttributeEditor({ note, componentId, notePath, ntxId, hidden }: AttributeEditorProps) { + const [ currentValue, setCurrentValue ] = useState(""); const [ state, setState ] = useState<"normal" | "showHelpTooltip" | "showAttributeDetail">(); const [ error, setError ] = useState(); const [ needsSaving, setNeedsSaving ] = useState(false); const lastSavedContent = useRef(); - const currentValueRef = useRef(""); + const currentValueRef = useRef(currentValue); const wrapperRef = useRef(null); const editorRef = useRef(); @@ -126,6 +127,7 @@ export default function AttributeEditor({ note, componentId, notePath, ntxId, hi } editorRef.current?.setText(htmlAttrs); + setCurrentValue(htmlAttrs); } function parseAttributes() { @@ -289,7 +291,7 @@ export default function AttributeEditor({ note, componentId, notePath, ntxId, hi className="attribute-list-editor" tabIndex={200} editor={CKEditorAttributeEditor} - currentValue="" // handled imperatively + currentValue={currentValue} config={{ toolbar: { items: [] }, placeholder: t("attribute_editor.placeholder"),