mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-17 13:38:37 +01:00
only preventDefault if the input is actually a format action (#5113)
This commit is contained in:
parent
9815bdabdd
commit
16a9292aaf
@ -23,13 +23,15 @@ const HoveringMenuExample = () => {
|
||||
renderLeaf={props => <Leaf {...props} />}
|
||||
placeholder="Enter some text..."
|
||||
onDOMBeforeInput={(event: InputEvent) => {
|
||||
event.preventDefault()
|
||||
switch (event.inputType) {
|
||||
case 'formatBold':
|
||||
event.preventDefault()
|
||||
return toggleFormat(editor, 'bold')
|
||||
case 'formatItalic':
|
||||
event.preventDefault()
|
||||
return toggleFormat(editor, 'italic')
|
||||
case 'formatUnderline':
|
||||
event.preventDefault()
|
||||
return toggleFormat(editor, 'underlined')
|
||||
}
|
||||
}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user