mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-01 21:10:14 +02:00
Fixed triple click workaround breaking void elements selection (#5451)
* Fixed tripple click workaround breaking void selection * Add changesets * Fix ts error * Make code style more consistent
This commit is contained in:
5
.changeset/popular-shrimps-give.md
Normal file
5
.changeset/popular-shrimps-give.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed occasional crashes when selecting void elements in Chrome
|
@@ -869,7 +869,8 @@ export const ReactEditor: ReactEditorInterface = {
|
|||||||
// will cause `toSlatePoint` to throw an error. (2023/03/07)
|
// will cause `toSlatePoint` to throw an error. (2023/03/07)
|
||||||
if (
|
if (
|
||||||
'getAttribute' in focusNode &&
|
'getAttribute' in focusNode &&
|
||||||
(focusNode as HTMLElement).getAttribute('contenteditable') === 'false'
|
(focusNode as HTMLElement).getAttribute('contenteditable') === 'false' &&
|
||||||
|
(focusNode as HTMLElement).getAttribute('data-slate-void') !== 'true'
|
||||||
) {
|
) {
|
||||||
focusNode = anchorNode
|
focusNode = anchorNode
|
||||||
focusOffset = anchorNode.textContent?.length || 0
|
focusOffset = anchorNode.textContent?.length || 0
|
||||||
|
Reference in New Issue
Block a user