diff --git a/packages/slate/src/changes/at-range.js b/packages/slate/src/changes/at-range.js index c195b5396..88378c840 100644 --- a/packages/slate/src/changes/at-range.js +++ b/packages/slate/src/changes/at-range.js @@ -1351,7 +1351,7 @@ Changes.wrapInlineAtRange = (change, range, inline, options = {}) => { const startNode = inline.regenerateKey() const endNode = inline.regenerateKey() - change.insertNodeByKey(startBlock.key, startIndex - 1, startNode, { normalize: false }) + change.insertNodeByKey(startBlock.key, startIndex + 1, startNode, { normalize: false }) change.insertNodeByKey(endBlock.key, endIndex, endNode, { normalize: false }) startInlines.forEach((child, i) => { diff --git a/packages/slate/test/history/undo/wrap-inline-across-blocks.js b/packages/slate/test/history/undo/wrap-inline-across-blocks.js new file mode 100644 index 000000000..0b406fd93 --- /dev/null +++ b/packages/slate/test/history/undo/wrap-inline-across-blocks.js @@ -0,0 +1,28 @@ +/** @jsx h */ + +import h from '../../helpers/h' + +export default function (value) { + return value + .change() + .wrapInline('hashtag') + .value + .change() + .undo() + .value +} + +export const input = ( + + + + word + + + another + + + +) + +export const output = input