1
0
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:
aeneasr
2016-11-18 11:41:57 +01:00
parent a4cbceddf4
commit 68d26cdf79
3 changed files with 76 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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