mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(react): owned attributes not showing up the first time
This commit is contained in:
parent
0450cd080d
commit
40e4d236f4
@ -83,12 +83,13 @@ interface AttributeEditorProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function AttributeEditor({ note, componentId, notePath, ntxId, hidden }: AttributeEditorProps) {
|
export default function AttributeEditor({ note, componentId, notePath, ntxId, hidden }: AttributeEditorProps) {
|
||||||
|
const [ currentValue, setCurrentValue ] = useState("");
|
||||||
const [ state, setState ] = useState<"normal" | "showHelpTooltip" | "showAttributeDetail">();
|
const [ state, setState ] = useState<"normal" | "showHelpTooltip" | "showAttributeDetail">();
|
||||||
const [ error, setError ] = useState<unknown>();
|
const [ error, setError ] = useState<unknown>();
|
||||||
const [ needsSaving, setNeedsSaving ] = useState(false);
|
const [ needsSaving, setNeedsSaving ] = useState(false);
|
||||||
|
|
||||||
const lastSavedContent = useRef<string>();
|
const lastSavedContent = useRef<string>();
|
||||||
const currentValueRef = useRef("");
|
const currentValueRef = useRef(currentValue);
|
||||||
const wrapperRef = useRef<HTMLDivElement>(null);
|
const wrapperRef = useRef<HTMLDivElement>(null);
|
||||||
const editorRef = useRef<CKEditorApi>();
|
const editorRef = useRef<CKEditorApi>();
|
||||||
|
|
||||||
@ -126,6 +127,7 @@ export default function AttributeEditor({ note, componentId, notePath, ntxId, hi
|
|||||||
}
|
}
|
||||||
|
|
||||||
editorRef.current?.setText(htmlAttrs);
|
editorRef.current?.setText(htmlAttrs);
|
||||||
|
setCurrentValue(htmlAttrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseAttributes() {
|
function parseAttributes() {
|
||||||
@ -289,7 +291,7 @@ export default function AttributeEditor({ note, componentId, notePath, ntxId, hi
|
|||||||
className="attribute-list-editor"
|
className="attribute-list-editor"
|
||||||
tabIndex={200}
|
tabIndex={200}
|
||||||
editor={CKEditorAttributeEditor}
|
editor={CKEditorAttributeEditor}
|
||||||
currentValue="" // handled imperatively
|
currentValue={currentValue}
|
||||||
config={{
|
config={{
|
||||||
toolbar: { items: [] },
|
toolbar: { items: [] },
|
||||||
placeholder: t("attribute_editor.placeholder"),
|
placeholder: t("attribute_editor.placeholder"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user