1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 01:50:06 +02:00

Check if inline ancestor exists before using it in wrapInlineAtRange (#2374)

This commit is contained in:
Dundercover
2018-11-05 05:58:45 +01:00
committed by Ian Storm Taylor
parent 24af6113dc
commit 220dd476e3
2 changed files with 31 additions and 0 deletions

View File

@@ -1268,6 +1268,10 @@ Commands.wrapInlineAtRange = (editor, range, inline) => {
// Wrapping an inline void
const inlineParent = document.getClosestInline(start.key)
if (!inlineParent) {
return
}
if (!editor.isVoid(inlineParent)) {
return
}

View File

@@ -0,0 +1,27 @@
/** @jsx h */
import h from '../../../helpers/h'
export default function(editor) {
editor.wrapInline('hashtag')
}
export const input = (
<value>
<document>
<paragraph>
w<cursor />d
</paragraph>
</document>
</value>
)
export const output = (
<value>
<document>
<paragraph>
w<cursor />d
</paragraph>
</document>
</value>
)