Skip to content

Commit

Permalink
Docs: fix Ctrl-` backticks issue on 03-defining-custom-elements page (i…
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenColEvol authored Nov 29, 2022
1 parent 66fbc0a commit d1f90eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/walkthroughs/03-defining-custom-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const DefaultElement = props => {
}
```

Okay, but now we'll need a way for the user to actually turn a block into a code block. So let's change our `onKeyDown` function to add a ``Ctrl-``` shortcut that does just that:
Okay, but now we'll need a way for the user to actually turn a block into a code block. So let's change our `onKeyDown` function to add a `` Ctrl-` `` shortcut that does just that:

```jsx
// Import the `Editor` and `Transforms` helpers from Slate.
Expand Down Expand Up @@ -175,9 +175,9 @@ const DefaultElement = props => {
}
```

Now, if you press ``Ctrl-``` the block your cursor is in should turn into a code block! Magic!
Now, if you press `` Ctrl-` `` the block your cursor is in should turn into a code block! Magic!

But we forgot one thing. When you hit ``Ctrl-``` again, it should change the code block back into a paragraph. To do that, we'll need to add a bit of logic to change the type we set based on whether any of the currently selected blocks are already a code block:
But we forgot one thing. When you hit `` Ctrl-` `` again, it should change the code block back into a paragraph. To do that, we'll need to add a bit of logic to change the type we set based on whether any of the currently selected blocks are already a code block:

```jsx
const initialValue = [
Expand Down Expand Up @@ -224,4 +224,4 @@ const App = () => {
}
```

And there you have it! If you press ``Ctrl-``` while inside a code block, it should turn back into a paragraph!
And there you have it! If you press `` Ctrl-` `` while inside a code block, it should turn back into a paragraph!

0 comments on commit d1f90eb

Please sign in to comment.