mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-16 12:14:14 +02:00
This reverts commit 9cf2f4eea2
.
This commit is contained in:
@@ -69,7 +69,7 @@ const CheckListsExample = () => {
|
|||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withChecklists(withHistory(createEditor()))),
|
() => withChecklists(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ const CodeHighlightingExample = () => {
|
|||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const [language, setLanguage] = useState('html')
|
const [language, setLanguage] = useState('html')
|
||||||
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
|
|
||||||
// decorate function depends on the language selected
|
// decorate function depends on the language selected
|
||||||
const decorate = useCallback(
|
const decorate = useCallback(
|
||||||
@@ -99,7 +99,7 @@ const Leaf = ({ attributes, children, leaf }) => {
|
|||||||
${leaf.comment &&
|
${leaf.comment &&
|
||||||
css`
|
css`
|
||||||
color: slategray;
|
color: slategray;
|
||||||
`}
|
`}
|
||||||
|
|
||||||
${(leaf.operator || leaf.url) &&
|
${(leaf.operator || leaf.url) &&
|
||||||
css`
|
css`
|
||||||
|
@@ -5,7 +5,7 @@ import { withHistory } from 'slate-history'
|
|||||||
|
|
||||||
const PlainTextExample = () => {
|
const PlainTextExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
<Editable
|
<Editable
|
||||||
|
@@ -11,7 +11,7 @@ import { EditableVoidElement } from './custom-types'
|
|||||||
const EditableVoidsExample = () => {
|
const EditableVoidsExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withEditableVoids(withHistory(createEditor()))),
|
() => withEditableVoids(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@ import {
|
|||||||
|
|
||||||
const EmbedsExample = () => {
|
const EmbedsExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withEmbeds(createEditor())), [])
|
const editor = useMemo(() => withEmbeds(withReact(createEditor())), [])
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
<Editable
|
<Editable
|
||||||
|
@@ -65,7 +65,7 @@ const ForcedLayoutExample = () => {
|
|||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withLayout(withHistory(createEditor()))),
|
() => withLayout(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
|
@@ -16,7 +16,7 @@ import { Button, Icon, Menu, Portal } from '../components'
|
|||||||
|
|
||||||
const HoveringMenuExample = () => {
|
const HoveringMenuExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
|
@@ -21,7 +21,7 @@ const IFrameExample = () => {
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
|
|
||||||
const handleBlur = useCallback(() => ReactEditor.deselect(editor), [editor])
|
const handleBlur = useCallback(() => ReactEditor.deselect(editor), [editor])
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ import { ImageElement } from './custom-types'
|
|||||||
const ImagesExample = () => {
|
const ImagesExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withImages(withReact(withHistory(createEditor()))),
|
() => withImages(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ import { Button, Icon, Toolbar } from '../components'
|
|||||||
const LinkExample = () => {
|
const LinkExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withLinks(withReact(withHistory(createEditor()))),
|
() => withLinks(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ import { css } from 'emotion'
|
|||||||
const MarkdownPreviewExample = () => {
|
const MarkdownPreviewExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
const decorate = useCallback(([node, path]) => {
|
const decorate = useCallback(([node, path]) => {
|
||||||
const ranges = []
|
const ranges = []
|
||||||
|
|
||||||
|
@@ -29,7 +29,7 @@ const MarkdownShortcutsExample = () => {
|
|||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withShortcuts(withHistory(createEditor()))),
|
() => withShortcuts(withReact(withHistory(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
|
@@ -21,7 +21,7 @@ const MentionExample = () => {
|
|||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withMentions(withHistory(createEditor()))),
|
() => withMentions(withReact(withHistory(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ import { withHistory } from 'slate-history'
|
|||||||
|
|
||||||
const PlainTextExample = () => {
|
const PlainTextExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
<Editable placeholder="Enter some plain text..." />
|
<Editable placeholder="Enter some plain text..." />
|
||||||
|
@@ -25,7 +25,7 @@ const RichTextExample = () => {
|
|||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
|
@@ -50,7 +50,7 @@ const ScrollIntoViewExample = () => {
|
|||||||
|
|
||||||
const PlainTextEditor = () => {
|
const PlainTextEditor = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
<Editable placeholder="Enter some plain text..." />
|
<Editable placeholder="Enter some plain text..." />
|
||||||
|
@@ -9,7 +9,7 @@ import { Icon, Toolbar } from '../components'
|
|||||||
const SearchHighlightingExample = () => {
|
const SearchHighlightingExample = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const [search, setSearch] = useState<string | undefined>()
|
const [search, setSearch] = useState<string | undefined>()
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
const decorate = useCallback(
|
const decorate = useCallback(
|
||||||
([node, path]) => {
|
([node, path]) => {
|
||||||
const ranges = []
|
const ranges = []
|
||||||
|
@@ -29,7 +29,7 @@ const ShadowDOM = () => {
|
|||||||
|
|
||||||
const ShadowEditor = () => {
|
const ShadowEditor = () => {
|
||||||
const [value, setValue] = useState<Descendant[]>(initialValue)
|
const [value, setValue] = useState<Descendant[]>(initialValue)
|
||||||
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
|
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
|
||||||
|
@@ -15,7 +15,7 @@ const TablesExample = () => {
|
|||||||
const renderElement = useCallback(props => <Element {...props} />, [])
|
const renderElement = useCallback(props => <Element {...props} />, [])
|
||||||
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
|
||||||
const editor = useMemo(
|
const editor = useMemo(
|
||||||
() => withReact(withTables(withHistory(createEditor()))),
|
() => withTables(withHistory(withReact(createEditor()))),
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user