Skip to content

Commit

Permalink
Update App.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
tiavina-mika committed Oct 9, 2024
1 parent 55d5a67 commit 4326c87
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ const tabs = [
'Async initial value',
'React Hook Form',
'Read without editor',
'Upload image'
'Upload image',
'Code block'
];

const mentions = [
Expand Down Expand Up @@ -166,6 +167,16 @@ const htmlToParse = `
</pre>
`;

const code = `
<pre><code class="language-typescript">export const suggestIndex = (query: string, data: Article[]) =&gt; {
const suggestions = data.filter((item: Article) =&gt; {
const maxDistance = item.title.length - leven(query.toLocaleLowerCase(), item.title.toLocaleLowerCase());
return maxDistance &gt;= 6;
});
return suggestions;
};</code></pre><p></p>
`;

const App = () => {
const [tab, setTab] = useState<number>(0);
const [asyncDefaultValue, setAsyncDefaultValue] = useState<string>('');
Expand Down Expand Up @@ -229,7 +240,7 @@ const App = () => {
/>
</div>
{/* Simple input */}
{tab === 0 && <TextEditor placeholder='Type something here...' />}
{tab === 0 && <TextEditor placeholder='Type something here...' onChange={v => console.log(v)} />}

{/* Select toolbar */}
{tab === 1 && (
Expand Down Expand Up @@ -302,6 +313,13 @@ const App = () => {
}}
/>
)}

{/* With code */}
{tab === 11 && (
<TextEditor
content={code}
/>
)}
</Container>
</Box>
</ThemeProvider>
Expand Down

0 comments on commit 4326c87

Please sign in to comment.