diff --git a/packages/slate/src/interfaces/editor/transforms/node.ts b/packages/slate/src/interfaces/editor/transforms/node.ts index 786ab07d9..078e42d64 100644 --- a/packages/slate/src/interfaces/editor/transforms/node.ts +++ b/packages/slate/src/interfaces/editor/transforms/node.ts @@ -800,7 +800,7 @@ export const NodeTransforms = { const range = Editor.range(editor, firstPath, lastPath) const [commonNode] = Editor.node(editor, commonPath) const depth = commonPath.length + 1 - const wrapperPath = Path.next(lastPath).slice(0, depth) + const wrapperPath = Path.next(lastPath.slice(0, depth)) const wrapper = { ...element, children: [] } Editor.insertNodes(editor, wrapper, { at: wrapperPath, voids }) diff --git a/packages/slate/test/transforms/wrapNodes/block/block-across-uneven.js b/packages/slate/test/transforms/wrapNodes/block/block-across-uneven.js new file mode 100644 index 000000000..71ba4b46f --- /dev/null +++ b/packages/slate/test/transforms/wrapNodes/block/block-across-uneven.js @@ -0,0 +1,48 @@ +/** @jsx jsx */ + +import { Editor } from 'slate' +import { jsx } from '../../..' + +export const run = editor => { + Editor.wrapNodes(editor, ) +} + +export const input = ( + + + + wo + + rd + + + + an + + other + + + + +) + +export const output = ( + + + + + wo + + rd + + + + an + + other + + + + + +)