mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: filter the empty delta
This commit is contained in:
parent
0424c14c7d
commit
ba05aa137e
@ -417,7 +417,8 @@ class Delta extends Iterable<TextOperation> {
|
||||
|
||||
// Optimization if rest of other is just retain
|
||||
if (!otherIter.hasNext &&
|
||||
delta._operations[delta._operations.length - 1] == newOp) {
|
||||
delta._operations.isNotEmpty &&
|
||||
delta._operations.last == newOp) {
|
||||
final rest = Delta(thisIter.rest());
|
||||
return (delta + rest)..chop();
|
||||
}
|
||||
|
@ -203,6 +203,9 @@ class TransactionBuilder {
|
||||
for (var i = 0; i < operations.length; i++) {
|
||||
op = transformOperation(operations[i], op);
|
||||
}
|
||||
if (op is TextEditOperation && op.delta.isEmpty) {
|
||||
return;
|
||||
}
|
||||
operations.add(op);
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ FlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
|
||||
);
|
||||
TransactionBuilder(editorState)
|
||||
..insertNode(
|
||||
textNode.path,
|
||||
textNode.path.next,
|
||||
TextNode.empty(),
|
||||
)
|
||||
..afterSelection = afterSelection
|
||||
|
Loading…
Reference in New Issue
Block a user