diff --git a/site/examples/inlines.tsx b/site/examples/inlines.tsx index 617fe86452..aba4412408 100644 --- a/site/examples/inlines.tsx +++ b/site/examples/inlines.tsx @@ -47,8 +47,16 @@ const initialValue: Descendant[] = [ children: [ { text: - 'There are two ways to add links. You can either add a link via the toolbar icon above, or if you want in on a little secret, copy a URL to your keyboard and paste it while a range of text is selected.', + 'There are two ways to add links. You can either add a link via the toolbar icon above, or if you want in on a little secret, copy a URL to your keyboard and paste it while a range of text is selected. ', }, + // The following is an example of an inline at the end of a block. + // This is an edge case that can cause issues. + { + type: 'link', + url: 'https://twitter.com/JustMissEmma/status/1448679899531726852', + children: [{ text: 'Finally, here is our favorite dog video.' }], + }, + { text: '' }, ], }, ] @@ -96,6 +104,7 @@ const InlinesExample = () => { } + renderLeaf={props => } placeholder="Enter some text..." onKeyDown={onKeyDown} /> @@ -291,6 +300,29 @@ const Element = props => { } } +const Text = props => { + const { attributes, children, leaf } = props + return ( + + {children} + + ) +} + const AddLinkButton = () => { const editor = useSlate() return (