mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-14 03:03:58 +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:
@@ -1656,7 +1656,7 @@ export const Editor: EditorInterface = {
|
|||||||
match: n => Editor.isBlock(editor, n),
|
match: n => Editor.isBlock(editor, n),
|
||||||
})
|
})
|
||||||
const blockPath = endBlock ? endBlock[1] : []
|
const blockPath = endBlock ? endBlock[1] : []
|
||||||
const first = Editor.start(editor, [])
|
const first = Editor.start(editor, start)
|
||||||
const before = { anchor: first, focus: end }
|
const before = { anchor: first, focus: end }
|
||||||
let skip = true
|
let skip = true
|
||||||
|
|
||||||
|
@@ -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 },
|
||||||
|
}
|
Reference in New Issue
Block a user