mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 23:12:52 +02:00
Docs fixes for 0.50.0 (#3133)
* docs: typos * docs: markdown inline code formatting https://meta.stackexchange.com/questions/82718/how-do-i-escape-a-backtick-within-in-line-code-in-markdown * docs: remove unused value, move comment, add deps to callback * docs: add deps to renderMark callback
This commit is contained in:
committed by
Ian Storm Taylor
parent
4140066c0b
commit
d457bc52b9
@@ -101,7 +101,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:
|
||||
|
||||
```js
|
||||
// Import the `Editor` helpers from Slate.
|
||||
@@ -148,9 +148,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:
|
||||
|
||||
```js
|
||||
const App = () => {
|
||||
@@ -192,4 +192,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!
|
||||
|
Reference in New Issue
Block a user