1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 12:30:11 +02:00
Files
slate/test/transforms/fixtures/at-current-range/add-mark/across-inlines/index.js
2016-12-02 15:23:58 -08:00

26 lines
496 B
JavaScript

import assert from 'assert'
export default function (state) {
const { document, selection } = state
const texts = document.getTexts()
const second = texts.get(1)
const fifth = texts.get(4)
const range = selection.merge({
anchorKey: second.key,
anchorOffset: 2,
focusKey: fifth.key,
focusOffset: 2
})
const next = state
.transform()
.moveTo(range)
.addMark('bold')
.apply()
assert.deepEqual(next.selection.toJS(), range.toJS())
return next
}