Selaa lähdekoodia

Minor cleanup

Anatoly Pulyaevskiy 5 vuotta sitten
vanhempi
commit
b53fe2cdc9

+ 4
- 0
packages/zefyr/CHANGELOG.md Näytä tiedosto

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

+ 2
- 1
packages/zefyr/lib/src/widgets/controller.dart Näytä tiedosto

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

+ 1
- 1
packages/zefyr/pubspec.yaml Näytä tiedosto

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

+ 3
- 1
packages/zefyr/test/widgets/controller_test.dart Näytä tiedosto

@@ -170,7 +170,9 @@ void main() {
170 170
       var result = controller.getSelectionStyle();
171 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 176
       bool notified = false;
175 177
       controller.addListener(() {
176 178
         notified = true;