mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
chore(react/ribbon): fix save icon displayed when it shouldn't
This commit is contained in:
parent
e8ae5486c8
commit
168d25c020
@ -96,16 +96,16 @@ export default function AttributeEditor({ note, componentId }: { note: FNote, co
|
|||||||
// attrs are not resorted if position changes after the initial load
|
// attrs are not resorted if position changes after the initial load
|
||||||
ownedAttributes.sort((a, b) => a.position - b.position);
|
ownedAttributes.sort((a, b) => a.position - b.position);
|
||||||
|
|
||||||
let htmlAttrs = (await attribute_renderer.renderAttributes(ownedAttributes, true)).html();
|
let htmlAttrs = getPreprocessedData("<p>" + (await attribute_renderer.renderAttributes(ownedAttributes, true)).html() + "</p>");
|
||||||
|
|
||||||
|
if (saved) {
|
||||||
|
lastSavedContent.current = htmlAttrs;
|
||||||
|
setNeedsSaving(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (htmlAttrs.length > 0) {
|
if (htmlAttrs.length > 0) {
|
||||||
htmlAttrs += " ";
|
htmlAttrs += " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saved) {
|
|
||||||
lastSavedContent.current = currentValueRef.current;
|
|
||||||
setNeedsSaving(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
setInitialValue(htmlAttrs);
|
setInitialValue(htmlAttrs);
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ export default function AttributeEditor({ note, componentId }: { note: FNote, co
|
|||||||
}}
|
}}
|
||||||
onChange={(currentValue) => {
|
onChange={(currentValue) => {
|
||||||
currentValueRef.current = currentValue ?? "";
|
currentValueRef.current = currentValue ?? "";
|
||||||
setNeedsSaving(lastSavedContent.current !== currentValue);
|
setNeedsSaving((lastSavedContent.current ?? "").trimEnd() !== getPreprocessedData(currentValue ?? "").trimEnd());
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
}}
|
}}
|
||||||
onClick={(e, pos) => {
|
onClick={(e, pos) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user