Skip to content

Commit

Permalink
Always keep natural order of selection boundaries
Browse files Browse the repository at this point in the history
when setting clipboard data
  • Loading branch information
amantoux committed Aug 11, 2024
1 parent e7c7a9a commit 6dd68a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/fleather/lib/src/widgets/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1258,9 +1258,9 @@ class RawEditorState extends EditorState
final TextSelection selection = textEditingValue.selection;
widget.clipboardManager.setData(FleatherClipboardData(
plainText: selection.textInside(textEditingValue.text),
delta: controller.document
.toDelta()
.slice(selection.baseOffset, selection.extentOffset),
delta: controller.document.toDelta().slice(
math.min(selection.baseOffset, selection.extentOffset),
math.max(selection.baseOffset, selection.extentOffset)),
));
}

Expand Down

0 comments on commit 6dd68a7

Please sign in to comment.