mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: revert delta of bold
This commit is contained in:
parent
9c97a0b635
commit
8f6eb5a0d6
@ -15,7 +15,7 @@ Attributes invertAttributes(Attributes? attr, Attributes? base) {
|
||||
return memo;
|
||||
});
|
||||
return attr.keys.fold(baseInverted, (memo, key) {
|
||||
if (attr![key] != base![key] && base.containsKey(key)) {
|
||||
if (attr![key] != base![key] && !base.containsKey(key)) {
|
||||
memo[key] = null;
|
||||
}
|
||||
return memo;
|
||||
|
@ -230,14 +230,18 @@ void main() {
|
||||
expect(expected, inverted);
|
||||
expect(base.compose(delta).compose(inverted), base);
|
||||
});
|
||||
// test('retain', () {
|
||||
// final delta = Delta().retain(2).retain(3, {'bold': true});
|
||||
// final base = Delta().insert('123456');
|
||||
// final expected = Delta().retain(2).retain(3, {'bold': null});
|
||||
// final inverted = delta.invert(base);
|
||||
// expect(expected, inverted);
|
||||
// expect(base.compose(delta).compose(inverted), base);
|
||||
// });
|
||||
test('retain', () {
|
||||
final delta = Delta()
|
||||
..retain(2)
|
||||
..retain(3, {'bold': true});
|
||||
final base = Delta()..insert('123456');
|
||||
final expected = Delta()
|
||||
..retain(2)
|
||||
..retain(3, {'bold': null});
|
||||
final inverted = delta.invert(base);
|
||||
expect(expected, inverted);
|
||||
expect(base.compose(delta).compose(inverted), base);
|
||||
});
|
||||
});
|
||||
group('json', () {
|
||||
test('toJson()', () {
|
||||
|
Loading…
Reference in New Issue
Block a user