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} />}
|
renderLeaf={props => <Leaf {...props} />}
|
||||||
placeholder="Enter some text..."
|
placeholder="Enter some text..."
|
||||||
onDOMBeforeInput={(event: InputEvent) => {
|
onDOMBeforeInput={(event: InputEvent) => {
|
||||||
event.preventDefault()
|
|
||||||
switch (event.inputType) {
|
switch (event.inputType) {
|
||||||
case 'formatBold':
|
case 'formatBold':
|
||||||
|
event.preventDefault()
|
||||||
return toggleFormat(editor, 'bold')
|
return toggleFormat(editor, 'bold')
|
||||||
case 'formatItalic':
|
case 'formatItalic':
|
||||||
|
event.preventDefault()
|
||||||
return toggleFormat(editor, 'italic')
|
return toggleFormat(editor, 'italic')
|
||||||
case 'formatUnderline':
|
case 'formatUnderline':
|
||||||
|
event.preventDefault()
|
||||||
return toggleFormat(editor, 'underlined')
|
return toggleFormat(editor, 'underlined')
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
Reference in New Issue
Block a user