1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

add more mark tests

This commit is contained in:
Ian Storm Taylor
2016-07-21 11:59:39 -07:00
parent 0ebe5b4b64
commit 035ae4451a
6 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { Mark } from '../../../../..'
export default function (state) {
const { document, selection } = state
const texts = document.getTexts()
const first = texts.first()
return state
.transform()
.moveTo({
anchorKey: first.key,
anchorOffset: 0,
focusKey: first.key,
focusOffset: 1
})
.addMark(Mark.create({
type: 'bold',
data: { key: 'value' }
}))
.apply()
}

View File

@@ -0,0 +1,8 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
ranges:
- text: word

View File

@@ -0,0 +1,13 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
ranges:
- text: w
marks:
- type: bold
data:
key: value
- text: ord

View File

@@ -0,0 +1,20 @@
export default function (state) {
const { document, selection } = state
const texts = document.getTexts()
const first = texts.first()
return state
.transform()
.moveTo({
anchorKey: first.key,
anchorOffset: 0,
focusKey: first.key,
focusOffset: 1
})
.addMark({
type: 'bold',
data: { key: 'value' }
})
.apply()
}

View File

@@ -0,0 +1,8 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
ranges:
- text: word

View File

@@ -0,0 +1,13 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
ranges:
- text: w
marks:
- type: bold
data:
key: value
- text: ord