mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-23 07:22:55 +02:00
Merge branch 'master' of github.com:ianstormtaylor/slate
This commit is contained in:
23
test/transforms/fixtures/wrap-inline/twice/index.js
Normal file
23
test/transforms/fixtures/wrap-inline/twice/index.js
Normal 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
|
||||||
|
}
|
7
test/transforms/fixtures/wrap-inline/twice/input.yaml
Normal file
7
test/transforms/fixtures/wrap-inline/twice/input.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
nodes:
|
||||||
|
- kind: block
|
||||||
|
type: paragraph
|
||||||
|
nodes:
|
||||||
|
- kind: text
|
||||||
|
text: before word after
|
16
test/transforms/fixtures/wrap-inline/twice/output.yaml
Normal file
16
test/transforms/fixtures/wrap-inline/twice/output.yaml
Normal 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"
|
Reference in New Issue
Block a user