mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 04:04:06 +02:00
Add break in the Switch statement for Custom Formatting Walkthrough (#2550)
The Custom Formatting Walkthrough does not work as expected. When Ctrl + B is pressed it applies both Bold and Code styles to the content. This is because of the case statement running beyond the Bold case due to the absence of a break keyword.
This commit is contained in:
@@ -72,12 +72,14 @@ class App extends React.Component {
|
||||
case 'b': {
|
||||
event.preventDefault()
|
||||
editor.addMark('bold')
|
||||
break
|
||||
}
|
||||
// When "`" is pressed, keep our existing code block logic.
|
||||
case '`': {
|
||||
const isCode = editor.value.blocks.some(block => block.type == 'code')
|
||||
event.preventDefault()
|
||||
editor.setBlocks(isCode ? 'paragraph' : 'code')
|
||||
break
|
||||
}
|
||||
// Otherwise, let other plugins handle it.
|
||||
default: {
|
||||
|
Reference in New Issue
Block a user