mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: remove attribute if it already exists on the node
This commit is contained in:
parent
cc6bf3cc1e
commit
5d2ff8e07c
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user