forked from ueberdosis/tiptap
-
Notifications
You must be signed in to change notification settings - Fork 0
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
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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,46 @@ | ||
import './styles.scss' | ||
|
||
import { | ||
Paragraph as TTParagraph, | ||
} from '@tiptap/extension-paragraph' | ||
import { | ||
EditorContent, | ||
NodeViewContent, | ||
NodeViewWrapper, | ||
ReactNodeViewRenderer, useEditor, | ||
} from '@tiptap/react' | ||
import StarterKit from '@tiptap/starter-kit' | ||
|
||
const ParagraphComponent = () => ( | ||
<NodeViewWrapper className="paragraph"> | ||
<NodeViewContent className="content" as="p" /> | ||
</NodeViewWrapper> | ||
) | ||
|
||
export const Paragraph = TTParagraph.extend({ | ||
addNodeView() { | ||
return ReactNodeViewRenderer(ParagraphComponent) | ||
}, | ||
}) | ||
|
||
const Tiptap = () => { | ||
const editor = useEditor({ | ||
extensions: [ | ||
StarterKit.configure({ | ||
paragraph: false, | ||
}), | ||
Paragraph, | ||
], | ||
content: '<p>Hello World!</p>', | ||
}) | ||
|
||
return <EditorContent editor={editor} /> | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<div className="App"> | ||
<Tiptap /> | ||
</div> | ||
) | ||
} |
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,6 @@ | ||
/* Basic editor styles */ | ||
.ProseMirror { | ||
> * + * { | ||
margin-top: 0.75em; | ||
} | ||
} |