diff --git a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/default_text_operations/format_rich_text_style.dart b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/default_text_operations/format_rich_text_style.dart index 0229d2270f..93ef3ebea9 100644 --- a/frontend/app_flowy/packages/appflowy_editor/lib/src/service/default_text_operations/format_rich_text_style.dart +++ b/frontend/app_flowy/packages/appflowy_editor/lib/src/service/default_text_operations/format_rich_text_style.dart @@ -108,7 +108,16 @@ bool formatTextNodes(EditorState editorState, Attributes attributes) { newAttributes[globalStyleKey] = null; } } - newAttributes.addAll(attributes); + + // if an attribute already exists in the node, it should be removed instead + for (final entry in attributes.entries) { + if (textNode.attributes.containsKey(entry.key) && + textNode.attributes[entry.key] == entry.value) { + // attribute is not added to the node new attributes + } else { + newAttributes.addEntries([entry]); + } + } transaction ..updateNode( textNode,