mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-25 11:50:16 +08:00
fix RichTextField text delete
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -657,6 +657,9 @@ class RichTextEditingController extends TextEditingController {
|
||||
}
|
||||
|
||||
case TextEditingDeltaNonTextUpdate e:
|
||||
if (!_isSelectionValid(e.selection, items.lastOrNull?.range.end ?? 0)) {
|
||||
return;
|
||||
}
|
||||
newSelection = e.selection;
|
||||
if (newSelection.isCollapsed) {
|
||||
final newPos = dragOffset(newSelection.base);
|
||||
@@ -689,6 +692,10 @@ class RichTextEditingController extends TextEditingController {
|
||||
}
|
||||
}
|
||||
|
||||
static bool _isSelectionValid(TextSelection selection, int length) {
|
||||
return selection.start <= length && selection.end <= length;
|
||||
}
|
||||
|
||||
TextStyle? composingStyle;
|
||||
TextStyle? richStyle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user