1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-29 18:09:49 +02:00

Fix missing break in last example (#2629)

In the last chunk of code, it was missing the `break` (or `return`). So, if used as is, the bold key will toggle the `code` feature as well.
This commit is contained in:
Mate Paiva
2019-03-06 21:45:08 +00:00
committed by Ian Storm Taylor
parent 646ff2a80f
commit bd7ee85c9b

View File

@@ -146,11 +146,13 @@ class App extends React.Component {
case 'b': {
event.preventDefault()
editor.toggleMark('bold')
break
}
case '`': {
const isCode = editor.value.blocks.some(block => block.type == 'code')
event.preventDefault()
editor.setBlocks(isCode ? 'paragraph' : 'code')
break
}
default: {
return next()