diff --git a/docs/walkthroughs/04-applying-custom-formatting.md b/docs/walkthroughs/04-applying-custom-formatting.md index 5fea3c7c2..df89f965a 100644 --- a/docs/walkthroughs/04-applying-custom-formatting.md +++ b/docs/walkthroughs/04-applying-custom-formatting.md @@ -90,7 +90,9 @@ const App = () => { Transforms.setNodes( editor, { type: match ? 'paragraph' : 'code' }, - { match: n => Element.isElement(n) && Editor.isBlock(editor, n) } + { + match: n => Element.isElement(n) && Editor.isBlock(editor, n), + } ) break } @@ -178,7 +180,9 @@ const App = () => { Transforms.setNodes( editor, { type: match ? null : 'code' }, - { match: n => Element.isElement(n) && Editor.isBlock(editor, n) } + { + match: n => Element.isElement(n) && Editor.isBlock(editor, n), + } ) break } diff --git a/package.json b/package.json index 65ade27ec..291463871 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,8 @@ "@emotion/css": "^11.11.2", "@faker-js/faker": "^8.2.0", "@playwright/test": "^1.39.0", + "@types/is-hotkey": "^0.1.10", + "@types/is-url": "^1.2.32", "@types/jest": "29.5.6", "@types/lodash": "^4.14.200", "@types/mocha": "^10.0.3", diff --git a/site/examples/js/check-lists.jsx b/site/examples/js/check-lists.jsx index 6e56ed77d..36084fc80 100644 --- a/site/examples/js/check-lists.jsx +++ b/site/examples/js/check-lists.jsx @@ -121,9 +121,9 @@ const Element = props => { } } const CheckListItemElement = ({ attributes, children, element }) => { + const { checked } = element const editor = useSlateStatic() const readOnly = useReadOnly() - const { checked } = element return (
{children}
diff --git a/site/examples/js/iframe.jsx b/site/examples/js/iframe.jsx index 51fac9fd6..45d7877ad 100644 --- a/site/examples/js/iframe.jsx +++ b/site/examples/js/iframe.jsx @@ -1,9 +1,9 @@ +import isHotkey from 'is-hotkey' import React, { useCallback, useMemo, useState } from 'react' import { createPortal } from 'react-dom' -import isHotkey from 'is-hotkey' -import { Editable, withReact, useSlate, Slate, ReactEditor } from 'slate-react' import { Editor, createEditor } from 'slate' import { withHistory } from 'slate-history' +import { Editable, ReactEditor, Slate, useSlate, withReact } from 'slate-react' import { Button, Icon, Toolbar } from './components' const HOTKEYS = { @@ -93,7 +93,9 @@ const MarkButton = ({ format, icon }) => { const IFrame = ({ children, ...props }) => { const [iframeBody, setIframeBody] = useState(null) const handleLoad = e => { - setIframeBody(e.target.contentDocument.body) + const iframe = e.target + if (!iframe.contentDocument) return + setIframeBody(iframe.contentDocument.body) } return (