feat: support in memory transaction update (#972)

* feat: support in memory transaction update

* test: support in memory transaction update
This commit is contained in:
Lucas 2024-11-25 11:07:47 +08:00 • committed by GitHub
commit 5b3878dcc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,5 +28,22 @@ void main() async {
await editorState.apply(transaction);
expect(count, 2);
});
test('transaction stream', () async {
final editorState = EditorState.blank(
withInitialText: false,
);
var isInMemoryUpdate = false;
editorState.transactionStream.listen((event) {
isInMemoryUpdate = event.$3.inMemoryUpdate;
});
final transaction = editorState.transaction;
transaction.insertNode([0], paragraphNode(text: 'Hello World!'));
await editorState.apply(
transaction,
options: const ApplyOptions(inMemoryUpdate: true),
);
expect(isInMemoryUpdate, true);
});
});
}