Skip to content

Commit e63f767

Browse files
committed
feat: auto-dismiss collapsed handle on Android if no interaction occurs (#7088)
* feat: support auto-dismiss collapsed handle on Android * fix: hit test area of collasepd handle is too big * chore: upgrade appflowy_editor * fix: simple table issues on mobile * feat: highlight cell after insertion * test: text color and cell background color test * fix: sign_in_page_settings_test
1 parent 8826e47 commit e63f767

File tree

10 files changed

+493
-4
lines changed

10 files changed

+493
-4
lines changed

Diff for: frontend/appflowy_flutter/integration_test/desktop/settings/sign_in_page_settings_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void main() {
6767

6868
// open settings page to check the result
6969
await tester.tapButton(settingsButton);
70+
await tester.pumpAndSettle(const Duration(milliseconds: 250));
7071

7172
// check the server type
7273
expect(

Diff for: frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart

+4
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage>
505505
Position(path: lastNode.path),
506506
);
507507
}
508+
509+
transaction.customSelectionType = SelectionType.inline;
510+
transaction.reason = SelectionUpdateReason.uiEvent;
511+
508512
await editorState.apply(transaction);
509513
}
510514

Diff for: frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/simple_table/simple_table_operations/simple_table_map_operation.dart

+241
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ extension TableMapOperation on Node {
104104
comparator: (iKey, index) => iKey >= index,
105105
);
106106

107+
final rowBoldAttributes = _remapSource(
108+
this.rowBoldAttributes,
109+
index,
110+
comparator: (iKey, index) => iKey >= index,
111+
);
112+
113+
final rowTextColors = _remapSource(
114+
this.rowTextColors,
115+
index,
116+
comparator: (iKey, index) => iKey >= index,
117+
);
118+
107119
return attributes
108120
.mergeValues(
109121
SimpleTableBlockKeys.rowColors,
@@ -112,6 +124,14 @@ extension TableMapOperation on Node {
112124
.mergeValues(
113125
SimpleTableBlockKeys.rowAligns,
114126
rowAligns,
127+
)
128+
.mergeValues(
129+
SimpleTableBlockKeys.rowBoldAttributes,
130+
rowBoldAttributes,
131+
)
132+
.mergeValues(
133+
SimpleTableBlockKeys.rowTextColors,
134+
rowTextColors,
115135
);
116136
} catch (e) {
117137
Log.warn('Failed to map row insertion attributes: $e');
@@ -167,6 +187,18 @@ extension TableMapOperation on Node {
167187
comparator: (iKey, index) => iKey >= index,
168188
);
169189

190+
final columnBoldAttributes = _remapSource(
191+
this.columnBoldAttributes,
192+
index,
193+
comparator: (iKey, index) => iKey >= index,
194+
);
195+
196+
final columnTextColors = _remapSource(
197+
this.columnTextColors,
198+
index,
199+
comparator: (iKey, index) => iKey >= index,
200+
);
201+
170202
final bool distributeColumnWidthsEvenly =
171203
attributes[SimpleTableBlockKeys.distributeColumnWidthsEvenly] ??
172204
false;
@@ -189,6 +221,14 @@ extension TableMapOperation on Node {
189221
.mergeValues(
190222
SimpleTableBlockKeys.columnWidths,
191223
columnWidths,
224+
)
225+
.mergeValues(
226+
SimpleTableBlockKeys.columnBoldAttributes,
227+
columnBoldAttributes,
228+
)
229+
.mergeValues(
230+
SimpleTableBlockKeys.columnTextColors,
231+
columnTextColors,
192232
);
193233
} catch (e) {
194234
Log.warn('Failed to map row insertion attributes: $e');
@@ -238,6 +278,18 @@ extension TableMapOperation on Node {
238278
index,
239279
);
240280

281+
final (rowBoldAttributes, duplicatedRowBoldAttribute) =
282+
_findDuplicatedEntryAndRemap(
283+
this.rowBoldAttributes,
284+
index,
285+
);
286+
287+
final (rowTextColors, duplicatedRowTextColor) =
288+
_findDuplicatedEntryAndRemap(
289+
this.rowTextColors,
290+
index,
291+
);
292+
241293
return attributes
242294
.mergeValues(
243295
SimpleTableBlockKeys.rowColors,
@@ -248,6 +300,16 @@ extension TableMapOperation on Node {
248300
SimpleTableBlockKeys.rowAligns,
249301
rowAligns,
250302
duplicatedEntry: duplicatedRowAlign,
303+
)
304+
.mergeValues(
305+
SimpleTableBlockKeys.rowBoldAttributes,
306+
rowBoldAttributes,
307+
duplicatedEntry: duplicatedRowBoldAttribute,
308+
)
309+
.mergeValues(
310+
SimpleTableBlockKeys.rowTextColors,
311+
rowTextColors,
312+
duplicatedEntry: duplicatedRowTextColor,
251313
);
252314
} catch (e) {
253315
Log.warn('Failed to map row insertion attributes: $e');
@@ -304,6 +366,18 @@ extension TableMapOperation on Node {
304366
index,
305367
);
306368

369+
final (columnBoldAttributes, duplicatedColumnBoldAttribute) =
370+
_findDuplicatedEntryAndRemap(
371+
this.columnBoldAttributes,
372+
index,
373+
);
374+
375+
final (columnTextColors, duplicatedColumnTextColor) =
376+
_findDuplicatedEntryAndRemap(
377+
this.columnTextColors,
378+
index,
379+
);
380+
307381
return attributes
308382
.mergeValues(
309383
SimpleTableBlockKeys.columnColors,
@@ -319,6 +393,16 @@ extension TableMapOperation on Node {
319393
SimpleTableBlockKeys.columnWidths,
320394
columnWidths,
321395
duplicatedEntry: duplicatedColumnWidth,
396+
)
397+
.mergeValues(
398+
SimpleTableBlockKeys.columnBoldAttributes,
399+
columnBoldAttributes,
400+
duplicatedEntry: duplicatedColumnBoldAttribute,
401+
)
402+
.mergeValues(
403+
SimpleTableBlockKeys.columnTextColors,
404+
columnTextColors,
405+
duplicatedEntry: duplicatedColumnTextColor,
322406
);
323407
} catch (e) {
324408
Log.warn('Failed to map column duplication attributes: $e');
@@ -364,13 +448,15 @@ extension TableMapOperation on Node {
364448
comparator: (iKey, index) => iKey > index,
365449
filterIndex: index,
366450
);
451+
367452
final columnAligns = _remapSource(
368453
this.columnAligns,
369454
index,
370455
increment: false,
371456
comparator: (iKey, index) => iKey > index,
372457
filterIndex: index,
373458
);
459+
374460
final columnWidths = _remapSource(
375461
this.columnWidths,
376462
index,
@@ -379,6 +465,22 @@ extension TableMapOperation on Node {
379465
filterIndex: index,
380466
);
381467

468+
final columnBoldAttributes = _remapSource(
469+
this.columnBoldAttributes,
470+
index,
471+
increment: false,
472+
comparator: (iKey, index) => iKey > index,
473+
filterIndex: index,
474+
);
475+
476+
final columnTextColors = _remapSource(
477+
this.columnTextColors,
478+
index,
479+
increment: false,
480+
comparator: (iKey, index) => iKey > index,
481+
filterIndex: index,
482+
);
483+
382484
return attributes
383485
.mergeValues(
384486
SimpleTableBlockKeys.columnColors,
@@ -391,6 +493,14 @@ extension TableMapOperation on Node {
391493
.mergeValues(
392494
SimpleTableBlockKeys.columnWidths,
393495
columnWidths,
496+
)
497+
.mergeValues(
498+
SimpleTableBlockKeys.columnBoldAttributes,
499+
columnBoldAttributes,
500+
)
501+
.mergeValues(
502+
SimpleTableBlockKeys.columnTextColors,
503+
columnTextColors,
394504
);
395505
} catch (e) {
396506
Log.warn('Failed to map column deletion attributes: $e');
@@ -443,6 +553,22 @@ extension TableMapOperation on Node {
443553
filterIndex: index,
444554
);
445555

556+
final rowBoldAttributes = _remapSource(
557+
this.rowBoldAttributes,
558+
index,
559+
increment: false,
560+
comparator: (iKey, index) => iKey > index,
561+
filterIndex: index,
562+
);
563+
564+
final rowTextColors = _remapSource(
565+
this.rowTextColors,
566+
index,
567+
increment: false,
568+
comparator: (iKey, index) => iKey > index,
569+
filterIndex: index,
570+
);
571+
446572
return attributes
447573
.mergeValues(
448574
SimpleTableBlockKeys.rowColors,
@@ -451,6 +577,14 @@ extension TableMapOperation on Node {
451577
.mergeValues(
452578
SimpleTableBlockKeys.rowAligns,
453579
rowAligns,
580+
)
581+
.mergeValues(
582+
SimpleTableBlockKeys.rowBoldAttributes,
583+
rowBoldAttributes,
584+
)
585+
.mergeValues(
586+
SimpleTableBlockKeys.rowTextColors,
587+
rowTextColors,
454588
);
455589
} catch (e) {
456590
Log.warn('Failed to map row deletion attributes: $e');
@@ -531,6 +665,10 @@ extension TableMapOperation on Node {
531665
final duplicatedColumnColor = this.columnColors[fromIndex.toString()];
532666
final duplicatedColumnAlign = this.columnAligns[fromIndex.toString()];
533667
final duplicatedColumnWidth = this.columnWidths[fromIndex.toString()];
668+
final duplicatedColumnBoldAttribute =
669+
this.columnBoldAttributes[fromIndex.toString()];
670+
final duplicatedColumnTextColor =
671+
this.columnTextColors[fromIndex.toString()];
534672

535673
/// Case 1: fromIndex > toIndex
536674
/// Before:
@@ -619,6 +757,34 @@ extension TableMapOperation on Node {
619757
filterIndex: fromIndex,
620758
);
621759

760+
final columnBoldAttributes = _remapSource(
761+
this.columnBoldAttributes,
762+
fromIndex,
763+
increment: fromIndex > toIndex,
764+
comparator: (iKey, index) {
765+
if (fromIndex > toIndex) {
766+
return iKey < fromIndex && iKey >= toIndex;
767+
} else {
768+
return iKey > fromIndex && iKey <= toIndex;
769+
}
770+
},
771+
filterIndex: fromIndex,
772+
);
773+
774+
final columnTextColors = _remapSource(
775+
this.columnTextColors,
776+
fromIndex,
777+
increment: fromIndex > toIndex,
778+
comparator: (iKey, index) {
779+
if (fromIndex > toIndex) {
780+
return iKey < fromIndex && iKey >= toIndex;
781+
} else {
782+
return iKey > fromIndex && iKey <= toIndex;
783+
}
784+
},
785+
filterIndex: fromIndex,
786+
);
787+
622788
return attributes
623789
.mergeValues(
624790
SimpleTableBlockKeys.columnColors,
@@ -652,6 +818,28 @@ extension TableMapOperation on Node {
652818
)
653819
: null,
654820
removeNullValue: true,
821+
)
822+
.mergeValues(
823+
SimpleTableBlockKeys.columnBoldAttributes,
824+
columnBoldAttributes,
825+
duplicatedEntry: duplicatedColumnBoldAttribute != null
826+
? MapEntry(
827+
toIndex.toString(),
828+
duplicatedColumnBoldAttribute,
829+
)
830+
: null,
831+
removeNullValue: true,
832+
)
833+
.mergeValues(
834+
SimpleTableBlockKeys.columnTextColors,
835+
columnTextColors,
836+
duplicatedEntry: duplicatedColumnTextColor != null
837+
? MapEntry(
838+
toIndex.toString(),
839+
duplicatedColumnTextColor,
840+
)
841+
: null,
842+
removeNullValue: true,
655843
);
656844
} catch (e) {
657845
Log.warn('Failed to map column deletion attributes: $e');
@@ -667,6 +855,9 @@ extension TableMapOperation on Node {
667855
try {
668856
final duplicatedRowColor = this.rowColors[fromIndex.toString()];
669857
final duplicatedRowAlign = this.rowAligns[fromIndex.toString()];
858+
final duplicatedRowBoldAttribute =
859+
this.rowBoldAttributes[fromIndex.toString()];
860+
final duplicatedRowTextColor = this.rowTextColors[fromIndex.toString()];
670861

671862
/// Example:
672863
/// Case 1: fromIndex > toIndex
@@ -742,6 +933,34 @@ extension TableMapOperation on Node {
742933
filterIndex: fromIndex,
743934
);
744935

936+
final rowBoldAttributes = _remapSource(
937+
this.rowBoldAttributes,
938+
fromIndex,
939+
increment: fromIndex > toIndex,
940+
comparator: (iKey, index) {
941+
if (fromIndex > toIndex) {
942+
return iKey < fromIndex && iKey >= toIndex;
943+
} else {
944+
return iKey > fromIndex && iKey <= toIndex;
945+
}
946+
},
947+
filterIndex: fromIndex,
948+
);
949+
950+
final rowTextColors = _remapSource(
951+
this.rowTextColors,
952+
fromIndex,
953+
increment: fromIndex > toIndex,
954+
comparator: (iKey, index) {
955+
if (fromIndex > toIndex) {
956+
return iKey < fromIndex && iKey >= toIndex;
957+
} else {
958+
return iKey > fromIndex && iKey <= toIndex;
959+
}
960+
},
961+
filterIndex: fromIndex,
962+
);
963+
745964
return attributes
746965
.mergeValues(
747966
SimpleTableBlockKeys.rowColors,
@@ -764,6 +983,28 @@ extension TableMapOperation on Node {
764983
)
765984
: null,
766985
removeNullValue: true,
986+
)
987+
.mergeValues(
988+
SimpleTableBlockKeys.rowBoldAttributes,
989+
rowBoldAttributes,
990+
duplicatedEntry: duplicatedRowBoldAttribute != null
991+
? MapEntry(
992+
toIndex.toString(),
993+
duplicatedRowBoldAttribute,
994+
)
995+
: null,
996+
removeNullValue: true,
997+
)
998+
.mergeValues(
999+
SimpleTableBlockKeys.rowTextColors,
1000+
rowTextColors,
1001+
duplicatedEntry: duplicatedRowTextColor != null
1002+
? MapEntry(
1003+
toIndex.toString(),
1004+
duplicatedRowTextColor,
1005+
)
1006+
: null,
1007+
removeNullValue: true,
7671008
);
7681009
} catch (e) {
7691010
Log.warn('Failed to map row reordering attributes: $e');

0 commit comments

Comments
 (0)