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
chore(react/ribbon): fix save icon displayed when it shouldn't
Elian Doran168d25c0207a
diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsxindex 36c0f6dcfe..6a89814312 100644--- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx+++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx@@ -96,17 +96,17 @@ export default function AttributeEditor({ note, componentId }: { note: FNote, co// attrs are not resorted if position changes after the initial loadownedAttributes.sort((a, b) => a.position - b.position);- let htmlAttrs = (await attribute_renderer.renderAttributes(ownedAttributes, true)).html();-- if (htmlAttrs.length > 0) {- htmlAttrs += " ";- }+ let htmlAttrs = getPreprocessedData("<p>" + (await attribute_renderer.renderAttributes(ownedAttributes, true)).html() + "</p>");if (saved) {- lastSavedContent.current = currentValueRef.current;+ lastSavedContent.current = htmlAttrs;setNeedsSaving(false);}+ if (htmlAttrs.length > 0) {+ htmlAttrs += " ";+ }+setInitialValue(htmlAttrs);}@@ -164,7 +164,7 @@ export default function AttributeEditor({ note, componentId }: { note: FNote, co}}onChange={(currentValue) => {currentValueRef.current = currentValue ?? "";- setNeedsSaving(lastSavedContent.current !== currentValue);+ setNeedsSaving((lastSavedContent.current ?? "").trimEnd() !== getPreprocessedData(currentValue ?? "").trimEnd());setError(undefined);}}onClick={(e, pos) => {