mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11:44 +02:00
added failing test case for inlines causing selection issue #432
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
|
||||
import assert from 'assert'
|
||||
|
||||
export default function (state) {
|
||||
const { document, selection } = state
|
||||
const texts = document.getTexts()
|
||||
const first = texts.first()
|
||||
const range = selection.merge({
|
||||
anchorKey: first.key,
|
||||
anchorOffset: 4,
|
||||
focusKey: first.key,
|
||||
focusOffset: 4
|
||||
})
|
||||
|
||||
const next = state
|
||||
.transform()
|
||||
.moveTo(range)
|
||||
.splitBlock()
|
||||
.apply()
|
||||
.transform()
|
||||
.deleteBackward()
|
||||
.apply()
|
||||
.transform()
|
||||
.splitBlock()
|
||||
.apply()
|
||||
|
||||
const updated = next.document.getTexts().get(1)
|
||||
|
||||
assert.deepEqual(
|
||||
next.selection.toJS(),
|
||||
range.collapseToStartOf(updated).toJS()
|
||||
)
|
||||
|
||||
return next
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: word
|
||||
- kind: inline
|
||||
type: link
|
||||
data:
|
||||
href: 'website.com'
|
||||
nodes:
|
||||
- kind: text
|
||||
text: hyperlink
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: word
|
@@ -0,0 +1,22 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: word
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: inline
|
||||
type: link
|
||||
data:
|
||||
href: 'website.com'
|
||||
nodes:
|
||||
- kind: text
|
||||
text: hyperlink
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: word
|
Reference in New Issue
Block a user