浏览代码

Minor cleanup

Anatoly Pulyaevskiy 5 年前
父节点
当前提交
b53fe2cdc9

+ 4
- 0
packages/zefyr/CHANGELOG.md 查看文件

1
+## 0.9.1
2
+
3
+* Fixed: Preserve inline style when replacing formatted text from the first character (#201)
4
+
1
 ## 0.9.0
5
 ## 0.9.0
2
 
6
 
3
 * Feature: toggle inline styles (works for bold and italic)
7
 * Feature: toggle inline styles (works for bold and italic)

+ 2
- 1
packages/zefyr/lib/src/widgets/controller.dart 查看文件

124
       // some style, then we apply it to our document.
124
       // some style, then we apply it to our document.
125
       if (delta != null &&
125
       if (delta != null &&
126
           toggledStyles.isNotEmpty &&
126
           toggledStyles.isNotEmpty &&
127
-          delta.length <=2 &&
127
+          delta.isNotEmpty &&
128
+          delta.length <= 2 &&
128
           delta.last.isInsert) {
129
           delta.last.isInsert) {
129
         // Apply it.
130
         // Apply it.
130
         Delta retainDelta = Delta()
131
         Delta retainDelta = Delta()

+ 1
- 1
packages/zefyr/pubspec.yaml 查看文件

1
 name: zefyr
1
 name: zefyr
2
 description: Clean, minimalistic and collaboration-ready rich text editor for Flutter.
2
 description: Clean, minimalistic and collaboration-ready rich text editor for Flutter.
3
-version: 0.9.0
3
+version: 0.9.1
4
 author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>
4
 author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>
5
 homepage: https://github.com/memspace/zefyr
5
 homepage: https://github.com/memspace/zefyr
6
 
6
 

+ 3
- 1
packages/zefyr/test/widgets/controller_test.dart 查看文件

170
       var result = controller.getSelectionStyle();
170
       var result = controller.getSelectionStyle();
171
       expect(result.values, [NotusAttribute.bold]);
171
       expect(result.values, [NotusAttribute.bold]);
172
     });
172
     });
173
-    test('formatText with toggled style for first charater', () {
173
+
174
+    test('preserve inline format when replacing text from the first character',
175
+        () {
174
       bool notified = false;
176
       bool notified = false;
175
       controller.addListener(() {
177
       controller.addListener(() {
176
         notified = true;
178
         notified = true;