mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-29 11:18:25 +01:00
fix the bug of user can't use 'mod + a' to select or delete all nodes when use image(void) element (#5344)
Co-authored-by: linqirong <609413692@qq.com>
This commit is contained in:
parent
2a0a530931
commit
ee7eac4331
@ -1,6 +1,7 @@
|
||||
import React, { useMemo } from 'react'
|
||||
import imageExtensions from 'image-extensions'
|
||||
import isUrl from 'is-url'
|
||||
import isHotkey from 'is-hotkey'
|
||||
import { Transforms, createEditor, Descendant } from 'slate'
|
||||
import {
|
||||
Slate,
|
||||
@ -29,6 +30,12 @@ const ImagesExample = () => {
|
||||
<InsertImageButton />
|
||||
</Toolbar>
|
||||
<Editable
|
||||
onKeyDown={event => {
|
||||
if (isHotkey('mod+a', event)) {
|
||||
event.preventDefault()
|
||||
Transforms.select(editor, [])
|
||||
}
|
||||
}}
|
||||
renderElement={props => <Element {...props} />}
|
||||
placeholder="Enter some text..."
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user