mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-30 20:10:24 +02:00
Fix check list example (#3232)
* Fix check list example * Fix lint errors
This commit is contained in:
committed by
Ian Storm Taylor
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>
|
||||
|
Reference in New Issue
Block a user