1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-14 18:32:01 +02:00

Update wrapNodes to use lowest mode and create passing test. (#3579)

* Update wrapNodes to use lowest mode and create passing test.

* Add .idea to .gitignore.

* Restore wrapNodes/inline/inline-across.js test.

Co-authored-by: Brent Farese <brentfarese@gmail.com>
This commit is contained in:
Brent Farese 2020-04-30 18:11:35 -04:00 committed by GitHub
parent ddef719467
commit 217b84ff1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 2 deletions

3
.gitignore vendored
View File

@ -1,10 +1,11 @@
*.log
.next/
.vscode/
.idea/
build/
dist/
lib/
node_modules/
packages/*/yarn.lock
site/out/
tmp/
tmp/

View File

@ -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,
})
)

View File

@ -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>
)