mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-11 09:43:58 +02:00
Adjust cursor position when on selection collapse for RTL direction (#5567)
* fix: adjust edge on collapse RTL selection * style: fix linting issue * chore: add changeset
This commit is contained in:
5
.changeset/unlucky-paws-allow.md
Normal file
5
.changeset/unlucky-paws-allow.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Fix cursor position on selection collapse for RTL direction
|
@@ -1501,7 +1501,9 @@ export const Editable = (props: EditableProps) => {
|
||||
if (selection && Range.isCollapsed(selection)) {
|
||||
Transforms.move(editor, { reverse: !isRTL })
|
||||
} else {
|
||||
Transforms.collapse(editor, { edge: 'start' })
|
||||
Transforms.collapse(editor, {
|
||||
edge: isRTL ? 'end' : 'start',
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
@@ -1513,7 +1515,9 @@ export const Editable = (props: EditableProps) => {
|
||||
if (selection && Range.isCollapsed(selection)) {
|
||||
Transforms.move(editor, { reverse: isRTL })
|
||||
} else {
|
||||
Transforms.collapse(editor, { edge: 'end' })
|
||||
Transforms.collapse(editor, {
|
||||
edge: isRTL ? 'start' : 'end',
|
||||
})
|
||||
}
|
||||
|
||||
return
|
||||
|
Reference in New Issue
Block a user