updateNode method
update the node attributes at the given selection.
If the Selection is not passed in, use the current selection.
Implementation
Future<void> updateNode(
Selection? selection,
Node Function(
Node node,
) nodeBuilder, {
Map? selectionExtraInfo,
}) async {
selection ??= this.selection;
selection = selection?.normalized;
if (selection == null) {
return;
}
final nodes = getNodesInSelection(selection);
if (nodes.isEmpty) {
return;
}
final transaction = this.transaction;
for (final node in nodes) {
transaction.updateNode(node, nodeBuilder(node).attributes);
}
transaction.afterSelection = transaction.beforeSelection;
transaction.selectionExtraInfo = selectionExtraInfo;
return apply(transaction);
}