-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
489 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from "react"; | ||
|
||
import TipTapWrap from "@/components/tiptap-wrap"; | ||
|
||
export default function RTE() { | ||
return ( | ||
<TipTapWrap | ||
content={` | ||
<h2> | ||
Hi there! 👋, | ||
</h2> | ||
<p> | ||
this is a <em>basic</em> example of <strong>tiptap</strong>. Sure, there are all kind of basic text styles you’d probably expect from a text editor. But wait until you see the lists: | ||
</p> | ||
<ul> | ||
<li> | ||
That’s a bullet list with one … | ||
</li> | ||
<li> | ||
… or two list items. | ||
</li> | ||
</ul> | ||
<p> | ||
Isn’t that great? And all of that is editable. But wait, there’s more. Let’s try a code block: | ||
</p> | ||
<pre><code class="language-css">body { | ||
display: none; | ||
}</code></pre> | ||
<p> | ||
I know, I know, this is impressive. It’s only the tip of the iceberg though. Give it a try and click a little bit around. Don’t forget to check the other examples too. | ||
</p> | ||
<blockquote> | ||
Wow, that’s amazing. Good work, boy! 👏 | ||
<br /> | ||
— Mom | ||
</blockquote> | ||
`} | ||
dom={{ | ||
scrollEnabled: false, | ||
}} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use dom"; | ||
|
||
import React from "react"; | ||
import { useEditor, EditorContent } from "@tiptap/react"; | ||
import StarterKit from "@tiptap/starter-kit"; | ||
|
||
export default function TipTapWrap({ | ||
content, | ||
}: { | ||
content: string; | ||
dom?: import("expo/dom").DOMProps; | ||
}) { | ||
const editor = useEditor({ | ||
extensions: [StarterKit], | ||
content, | ||
}); | ||
|
||
return ( | ||
<> | ||
<EditorContent editor={editor} /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.