1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-19 13:41:19 +02:00

fix some doc's bug (with v0.57.1) (#3393)

* fix: code blocks's info string
this info string. should be `jsx`

* fix: editor's exec invoke
now, editor.exec() is not available in Slate v0.57.1
so, use editor.insertText() to instead it

*  refactor: delete a nerver used value

* update add new chinese translate
      update chinese translate to `v0.57.1`

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
This commit is contained in:
Xleine
2020-01-28 04:24:15 +08:00
committed by Ian Storm Taylor
parent 8202e08102
commit 217bdd611b
7 changed files with 28 additions and 38 deletions

View File

@@ -8,7 +8,7 @@ Let's use the `onKeyDown` handler to change the editor's content when we press a
Here's our app from earlier:
```js
```jsx
const App = () => {
const editor = useMemo(() => withReact(createEditor()), [])
const [value, setValue] = useState([
@@ -28,7 +28,7 @@ const App = () => {
Now we add an `onKeyDown` handler:
```js
```jsx
const App = () => {
const editor = useMemo(() => withReact(createEditor()), [])
const [value, setValue] = useState([
@@ -57,7 +57,7 @@ Now we want to make it actually change the content. For the purposes of our exam
Our `onKeyDown` handler might look like this:
```js
```jsx
const App = () => {
const editor = useMemo(() => withReact(createEditor()), [])
const [value, setValue] = useState([
@@ -74,8 +74,8 @@ const App = () => {
if (event.key === '&') {
// Prevent the ampersand character from being inserted.
event.preventDefault()
// Execute a command to insert text when the event occurs.
editor.exec({ type: 'insert_text', text: 'and' })
// Execute the `insertText` method when the event occurs.
editor.insertText("and")
}
}}
/>