diff --git a/packages/fleather/lib/src/widgets/editor.dart b/packages/fleather/lib/src/widgets/editor.dart index 43379301..72c3a694 100644 --- a/packages/fleather/lib/src/widgets/editor.dart +++ b/packages/fleather/lib/src/widgets/editor.dart @@ -1260,7 +1260,8 @@ class RawEditorState extends EditorState plainText: selection.textInside(textEditingValue.text), delta: controller.document .toDelta() - .slice(selection.baseOffset, selection.extentOffset), + .slice(math.min(selection.baseOffset, selection.extentOffset), + math.max(selection.baseOffset, selection.extentOffset)), )); }