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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
*.log
|
*.log
|
||||||
.next/
|
.next/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea/
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
lib/
|
lib/
|
||||||
|
@@ -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,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@@ -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>
|
||||||
|
)
|
Reference in New Issue
Block a user