1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-26 08:34:28 +02:00

Go back to previous positions behavior (#5008)

Revert "Fix positions iteration when starting in an inline void node (#4952)"

This reverts commit 9ce0a08c2a.
This commit is contained in:
Steve Marquis
2022-05-25 16:00:24 -07:00
committed by GitHub
parent 92c5730a96
commit e9ea281595
3 changed files with 5 additions and 34 deletions

View File

@@ -0,0 +1,5 @@
---
'slate': patch
---
Revert to previous position behavior around inline voids

View File

@@ -1306,9 +1306,6 @@ export const Editor: EditorInterface = {
// then we will iterate over their content. // then we will iterate over their content.
if (!voids && editor.isVoid(node)) { if (!voids && editor.isVoid(node)) {
yield Editor.start(editor, path) yield Editor.start(editor, path)
// It's possible the start of the range we're iterating over is in a void, in which case
// we want to make sure we don't incorrectly yield the start of a subsequent text node for unit !== 'offset'
isNewBlock = false
continue continue
} }

View File

@@ -1,31 +0,0 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../../..'
export const input = (
<editor>
<block>
one
<inline void>
<text />
</inline>
two
</block>
</editor>
)
export const test = editor => {
return Array.from(
Editor.positions(editor, {
at: {
anchor: { path: [0, 1, 0], offset: 0 },
focus: { path: [0, 2], offset: 2 },
},
unit: 'character',
})
)
}
export const output = [
{ path: [0, 1, 0], offset: 0 },
{ path: [0, 2], offset: 1 },
{ path: [0, 2], offset: 2 },
]