diff --git a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx index 36c0f6dcf..6a8981431 100644 --- a/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx +++ b/apps/client/src/widgets/ribbon/components/AttributeEditor.tsx @@ -96,16 +96,16 @@ export default function AttributeEditor({ note, componentId }: { note: FNote, co // attrs are not resorted if position changes after the initial load ownedAttributes.sort((a, b) => a.position - b.position); - let htmlAttrs = (await attribute_renderer.renderAttributes(ownedAttributes, true)).html(); + let htmlAttrs = getPreprocessedData("
" + (await attribute_renderer.renderAttributes(ownedAttributes, true)).html() + "
"); + + if (saved) { + lastSavedContent.current = htmlAttrs; + setNeedsSaving(false); + } if (htmlAttrs.length > 0) { htmlAttrs += " "; - } - - if (saved) { - lastSavedContent.current = currentValueRef.current; - setNeedsSaving(false); - } + } 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) => {