diff --git a/.gitignore b/.gitignore index e2ba75075..f03693ded 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,11 @@ *.log .next/ .vscode/ +.idea/ build/ dist/ lib/ node_modules/ packages/*/yarn.lock site/out/ -tmp/ \ No newline at end of file +tmp/ diff --git a/packages/slate/src/transforms/node.ts b/packages/slate/src/transforms/node.ts index 5d5318080..03d1e4f3f 100644 --- a/packages/slate/src/transforms/node.ts +++ b/packages/slate/src/transforms/node.ts @@ -795,7 +795,7 @@ export const NodeTransforms = { match: editor.isInline(element) ? n => Editor.isBlock(editor, n) : n => Editor.isEditor(n), - mode: 'highest', + mode: 'lowest', voids, }) ) diff --git a/packages/slate/test/transforms/wrapNodes/inline/inline-across-nested.js b/packages/slate/test/transforms/wrapNodes/inline/inline-across-nested.js new file mode 100644 index 000000000..cd84dae6d --- /dev/null +++ b/packages/slate/test/transforms/wrapNodes/inline/inline-across-nested.js @@ -0,0 +1,66 @@ +/** @jsx jsx */ + +import { Transforms } from 'slate' +import { jsx } from '../../..' + +export const run = editor => { + Transforms.wrapNodes(editor, <inline a />) +} + +export const input = ( + <editor> + <block> + <block> + <text /> + <inline> + wo + <anchor /> + rd + </inline> + <text /> + </block> + <block> + <text /> + <inline> + an + <focus /> + other + </inline> + <text /> + </block> + </block> + </editor> +) + +export const output = ( + <editor> + <block> + <block> + <text /> + <inline a> + <text /> + <inline> + wo + <anchor /> + rd + </inline> + <text /> + </inline> + <text /> + </block> + <block> + <text /> + <inline a> + <text /> + <inline> + an + <focus /> + other + </inline> + <text /> + </inline> + <text /> + </block> + </block> + </editor> +)