mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-19 06:18:16 +01:00
Fix check list example (#3232)
* Fix check list example * Fix lint errors
This commit is contained in:
parent
75e5015cc5
commit
31df397930
@ -1,5 +1,12 @@
|
||||
import React, { useMemo, useCallback } from 'react'
|
||||
import { Slate, Editable, withReact, useEditor, useReadOnly } from 'slate-react'
|
||||
import {
|
||||
Slate,
|
||||
Editable,
|
||||
withReact,
|
||||
useEditor,
|
||||
useReadOnly,
|
||||
ReactEditor,
|
||||
} from 'slate-react'
|
||||
import { Editor, Range, Point, createEditor } from 'slate'
|
||||
import { css } from 'emotion'
|
||||
import { withHistory } from 'slate-history'
|
||||
@ -96,8 +103,12 @@ const CheckListItemElement = ({ attributes, children, element }) => {
|
||||
type="checkbox"
|
||||
checked={checked}
|
||||
onChange={event => {
|
||||
const path = editor.findPath(element)
|
||||
editor.setNodes({ checked: event.target.checked }, { at: path })
|
||||
const path = ReactEditor.findPath(editor, element)
|
||||
Editor.setNodes(
|
||||
editor,
|
||||
{ checked: event.target.checked },
|
||||
{ at: path }
|
||||
)
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user