1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 23:12:52 +02:00

Merge branch 'master' of github.com:ianstormtaylor/slate

This commit is contained in:
Ian Storm Taylor
2016-07-28 11:43:48 -07:00
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import assert from 'assert'
export default function (state) {
const { document, selection } = state
const texts = document.getTexts()
const text = texts.first()
const range = selection.merge({
anchorKey: text.key,
anchorOffset: 7,
focusKey: text.key,
focusOffset: 11
})
const next = state
.transform()
.moveTo(range)
.wrapInline('inner')
.wrapInline('outer')
.apply()
return next
}

View File

@@ -0,0 +1,7 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
text: before word after

View File

@@ -0,0 +1,16 @@
nodes:
- kind: block
type: paragraph
nodes:
- kind: text
text: "before "
- kind: inline
type: outer
nodes:
- kind: inline
type: inner
nodes:
- kind: text
text: word
- kind: text
text: " after"