1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-15 10:52:34 +02:00

Fix failing unhangRange test case with inlines (#4814)

* Add failing unhangRange test case

* Fix failing inline case?

* fix lint
This commit is contained in:
Bryan Haakman 2022-01-28 17:33:20 +01:00 committed by GitHub
parent 6ef6454e44
commit 01dc0c57b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -1656,7 +1656,7 @@ export const Editor: EditorInterface = {
match: n => Editor.isBlock(editor, n),
})
const blockPath = endBlock ? endBlock[1] : []
const first = Editor.start(editor, [])
const first = Editor.start(editor, start)
const before = { anchor: first, focus: end }
let skip = true

View File

@ -0,0 +1,34 @@
/** @jsx jsx */
import { Editor } from 'slate'
import { jsx } from '../../..'
export const input = (
<editor>
<block>
<text>Block before</text>
</block>
<block>
<text>
<anchor />
Some text before{' '}
</text>
<inline void>
<focus />
</inline>
<text />
</block>
<block>
<text>Another block</text>
</block>
</editor>
)
export const test = editor => {
const range = Editor.unhangRange(editor, editor.selection)
return range
}
export const output = {
anchor: { path: [1, 0], offset: 0 },
focus: { path: [1, 1, 0], offset: 0 },
}