Skip to content

Commit 5526ea4

Browse files
authored
fix: invalid selection when tapping placeholder text (singerdmx#2062)
1 parent ab004b8 commit 5526ea4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/src/editor/editor.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'package:flutter/rendering.dart';
1010
import 'package:flutter/services.dart';
1111

1212
import '../common/utils/platform.dart';
13+
import '../document/attribute.dart';
1314
import '../document/document.dart';
1415
import '../document/nodes/container.dart' as container_node;
1516
import '../document/nodes/leaf.dart';
@@ -985,6 +986,13 @@ class RenderEditor extends RenderEditableContainerBox
985986
start: localWord.start + nodeOffset,
986987
end: localWord.end + nodeOffset,
987988
);
989+
990+
// Don't change selection if the selected word is a placeholder.
991+
if (child.container.style.attributes
992+
.containsKey(Attribute.placeholder.key)) {
993+
return;
994+
}
995+
988996
if (position.offset - word.start <= 1 && word.end != position.offset) {
989997
_handleSelectionChange(
990998
TextSelection.collapsed(offset: word.start),

0 commit comments

Comments
 (0)