mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 10:51:44 +02:00
fix: automatically inserts an empty text node after inserting an image (#5598)
* fix: automatically inserts an empty text node after inserting an image Fixes #5597 * Update site/examples/images.tsx * Update site/examples/images.tsx * Update site/examples/images.tsx --------- Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
@@ -82,6 +82,10 @@ const insertImage = (editor, url) => {
|
|||||||
const text = { text: '' }
|
const text = { text: '' }
|
||||||
const image: ImageElement = { type: 'image', url, children: [text] }
|
const image: ImageElement = { type: 'image', url, children: [text] }
|
||||||
Transforms.insertNodes(editor, image)
|
Transforms.insertNodes(editor, image)
|
||||||
|
Transforms.insertNodes(editor, {
|
||||||
|
type: 'paragraph',
|
||||||
|
children: [{ text: '' }],
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const Element = props => {
|
const Element = props => {
|
||||||
|
Reference in New Issue
Block a user