mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-31 20:40:19 +02:00
only preventDefault if the input is actually a format action (#5113)
This commit is contained in:
@@ -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')
|
||||
}
|
||||
}}
|
||||
|
Reference in New Issue
Block a user