From 4326c874ce8ae9fa13e5691ed2903e46503506e6 Mon Sep 17 00:00:00 2001 From: tiavina-mika Date: Wed, 9 Oct 2024 10:23:44 +0300 Subject: [PATCH] Update App.tsx --- example/src/App.tsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/example/src/App.tsx b/example/src/App.tsx index 2856bb0..545e1ad 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -96,7 +96,8 @@ const tabs = [ 'Async initial value', 'React Hook Form', 'Read without editor', - 'Upload image' + 'Upload image', + 'Code block' ]; const mentions = [ @@ -166,6 +167,16 @@ const htmlToParse = ` `; +const code = ` +
export const suggestIndex = (query: string, data: Article[]) => {
+  const suggestions = data.filter((item: Article) => {
+    const maxDistance = item.title.length - leven(query.toLocaleLowerCase(), item.title.toLocaleLowerCase());
+    return maxDistance >= 6;
+  });
+  return suggestions;
+};

+`; + const App = () => { const [tab, setTab] = useState(0); const [asyncDefaultValue, setAsyncDefaultValue] = useState(''); @@ -229,7 +240,7 @@ const App = () => { /> {/* Simple input */} - {tab === 0 && } + {tab === 0 && console.log(v)} />} {/* Select toolbar */} {tab === 1 && ( @@ -302,6 +313,13 @@ const App = () => { }} /> )} + + {/* With code */} + {tab === 11 && ( + + )}