Skip to content

Commit

Permalink
Revert "in examples, move withReact in front of withHistory (#4604)" (#…
Browse files Browse the repository at this point in the history
…4607)

This reverts commit 9cf2f4e.
  • Loading branch information
dylans authored Oct 17, 2021
1 parent 9cf2f4e commit f1607da
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion site/examples/check-lists.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const CheckListsExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const renderElement = useCallback(props => <Element {...props} />, [])
const editor = useMemo(
() => withReact(withChecklists(withHistory(createEditor()))),
() => withChecklists(withHistory(withReact(createEditor()))),
[]
)

Expand Down
4 changes: 2 additions & 2 deletions site/examples/code-highlighting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CodeHighlightingExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const [language, setLanguage] = useState('html')
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
const decorate = useCallback(
Expand Down Expand Up @@ -99,7 +99,7 @@ const Leaf = ({ attributes, children, leaf }) => {
${leaf.comment &&
css`
color: slategray;
`}
`}
${(leaf.operator || leaf.url) &&
css`
Expand Down
2 changes: 1 addition & 1 deletion site/examples/custom-placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { withHistory } from 'slate-history'

const PlainTextExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
<Editable
Expand Down
2 changes: 1 addition & 1 deletion site/examples/editable-voids.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EditableVoidElement } from './custom-types'
const EditableVoidsExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(
() => withReact(withEditableVoids(withHistory(createEditor()))),
() => withEditableVoids(withHistory(withReact(createEditor()))),
[]
)

Expand Down
2 changes: 1 addition & 1 deletion site/examples/embeds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

const EmbedsExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withEmbeds(createEditor())), [])
const editor = useMemo(() => withEmbeds(withReact(createEditor())), [])
return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
<Editable
Expand Down
2 changes: 1 addition & 1 deletion site/examples/forced-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ForcedLayoutExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const renderElement = useCallback(props => <Element {...props} />, [])
const editor = useMemo(
() => withReact(withLayout(withHistory(createEditor()))),
() => withLayout(withHistory(withReact(createEditor()))),
[]
)
return (
Expand Down
2 changes: 1 addition & 1 deletion site/examples/hovering-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Button, Icon, Menu, Portal } from '../components'

const HoveringMenuExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])

return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
Expand Down
2 changes: 1 addition & 1 deletion site/examples/iframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const IFrameExample = () => {
[]
)
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])

Expand Down
2 changes: 1 addition & 1 deletion site/examples/images.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { ImageElement } from './custom-types'
const ImagesExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(
() => withImages(withReact(withHistory(createEditor()))),
() => withImages(withHistory(withReact(createEditor()))),
[]
)

Expand Down
2 changes: 1 addition & 1 deletion site/examples/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Button, Icon, Toolbar } from '../components'
const LinkExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(
() => withLinks(withReact(withHistory(createEditor()))),
() => withLinks(withHistory(withReact(createEditor()))),
[]
)

Expand Down
2 changes: 1 addition & 1 deletion site/examples/markdown-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { css } from 'emotion'
const MarkdownPreviewExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
const decorate = useCallback(([node, path]) => {
const ranges = []

Expand Down
2 changes: 1 addition & 1 deletion site/examples/markdown-shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MarkdownShortcutsExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const renderElement = useCallback(props => <Element {...props} />, [])
const editor = useMemo(
() => withReact(withShortcuts(withHistory(createEditor()))),
() => withShortcuts(withReact(withHistory(createEditor()))),
[]
)
return (
Expand Down
2 changes: 1 addition & 1 deletion site/examples/mentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const MentionExample = () => {
const [search, setSearch] = useState('')
const renderElement = useCallback(props => <Element {...props} />, [])
const editor = useMemo(
() => withReact(withMentions(withHistory(createEditor()))),
() => withMentions(withReact(withHistory(createEditor()))),
[]
)

Expand Down
2 changes: 1 addition & 1 deletion site/examples/plaintext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { withHistory } from 'slate-history'

const PlainTextExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
<Editable placeholder="Enter some plain text..." />
Expand Down
2 changes: 1 addition & 1 deletion site/examples/richtext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const RichTextExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const renderElement = useCallback(props => <Element {...props} />, [])
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])

return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
Expand Down
2 changes: 1 addition & 1 deletion site/examples/scroll-into-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const ScrollIntoViewExample = () => {

const PlainTextEditor = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
<Editable placeholder="Enter some plain text..." />
Expand Down
2 changes: 1 addition & 1 deletion site/examples/search-highlighting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Icon, Toolbar } from '../components'
const SearchHighlightingExample = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const [search, setSearch] = useState<string | undefined>()
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
const decorate = useCallback(
([node, path]) => {
const ranges = []
Expand Down
2 changes: 1 addition & 1 deletion site/examples/shadow-dom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ShadowDOM = () => {

const ShadowEditor = () => {
const [value, setValue] = useState<Descendant[]>(initialValue)
const editor = useMemo(() => withReact(withHistory(createEditor())), [])
const editor = useMemo(() => withHistory(withReact(createEditor())), [])

return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
Expand Down
2 changes: 1 addition & 1 deletion site/examples/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TablesExample = () => {
const renderElement = useCallback(props => <Element {...props} />, [])
const renderLeaf = useCallback(props => <Leaf {...props} />, [])
const editor = useMemo(
() => withReact(withTables(withHistory(createEditor()))),
() => withTables(withHistory(withReact(createEditor()))),
[]
)
return (
Expand Down

0 comments on commit f1607da

Please sign in to comment.