1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-06 15:26:34 +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
3 changed files with 69 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
*.log *.log
.next/ .next/
.vscode/ .vscode/
.idea/
build/ build/
dist/ dist/
lib/ lib/

View File

@@ -795,7 +795,7 @@ export const NodeTransforms = {
match: editor.isInline(element) match: editor.isInline(element)
? n => Editor.isBlock(editor, n) ? n => Editor.isBlock(editor, n)
: n => Editor.isEditor(n), : n => Editor.isEditor(n),
mode: 'highest', mode: 'lowest',
voids, 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>
)