mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 18:09:49 +02:00
Check if inline ancestor exists before using it in wrapInlineAtRange (#2374)
This commit is contained in:
committed by
Ian Storm Taylor
parent
24af6113dc
commit
220dd476e3
@@ -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
|
||||
}
|
||||
|
@@ -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>
|
||||
)
|
Reference in New Issue
Block a user