File tree 6 files changed +82
-1
lines changed
6 files changed +82
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { memo } from "react" ;
2
+ import { Tiptap } from "./Tiptap" ;
3
+
4
+ interface EditorProps {
5
+ account : string
6
+ }
7
+
8
+ // eslint-disable-next-line react/display-name
9
+ export const Editor = memo < EditorProps > ( ( { account} ) => {
10
+ return (
11
+ < div style = { { width : '720px' } } >
12
+ < input placeholder = "Give a title" type = "text" className = "border-0 outline-0 text-5xl" />
13
+ < div className = "my-4" >
14
+ Account: { account }
15
+ </ div >
16
+ < Tiptap />
17
+ </ div >
18
+ )
19
+ } )
Original file line number Diff line number Diff line change
1
+ export const Layout = ( ) => {
2
+
3
+ }
Original file line number Diff line number Diff line change
1
+ import { useEditor , EditorContent } from '@tiptap/react'
2
+ import StarterKit from '@tiptap/starter-kit'
3
+ import { Paragraph } from "@tiptap/extension-paragraph" ;
4
+ import Placeholder from '@tiptap/extension-placeholder'
5
+ import { Heading } from '@tiptap/extension-heading' ;
6
+
7
+ export const Tiptap = ( ) => {
8
+ const editor = useEditor ( {
9
+ extensions : [
10
+ StarterKit ,
11
+ Paragraph . configure ( {
12
+ HTMLAttributes : {
13
+ class : 'text-neutral-800 text-lg min-h-full' ,
14
+ } ,
15
+ } ) ,
16
+ Placeholder . configure ( {
17
+ placeholder : 'Write something …' ,
18
+ } ) ,
19
+ Heading . configure ( {
20
+ levels : [ 1 , 2 , 3 ] ,
21
+ } )
22
+ ] ,
23
+ content : '' ,
24
+ editorProps : {
25
+ attributes : {
26
+ class : 'focus:outline-none text-lg' ,
27
+ } ,
28
+ } ,
29
+ } )
30
+
31
+ return (
32
+ < EditorContent editor = { editor } />
33
+ )
34
+ }
Original file line number Diff line number Diff line change 15
15
"@openzeppelin/contracts" : " ^4.4.1" ,
16
16
"@react-hookz/web" : " ^12.0.4" ,
17
17
"@textile/eth-storage" : " ^1.0.0" ,
18
+ "@tiptap/extension-heading" : " ^2.0.0-beta.25" ,
19
+ "@tiptap/extension-paragraph" : " ^2.0.0-beta.23" ,
20
+ "@tiptap/extension-placeholder" : " ^2.0.0-beta.46" ,
21
+ "@tiptap/react" : " ^2.0.0-beta.104" ,
22
+ "@tiptap/starter-kit" : " ^2.0.0-beta.168" ,
18
23
"axios" : " ^0.24.0" ,
19
24
"ethers" : " ^5.5.2" ,
20
25
"graphql-tag" : " ^2.12.6" ,
Original file line number Diff line number Diff line change
1
+ import { Editor } from "../components/Editor" ;
2
+
3
+ export default function CreateDraft ( ) {
4
+ const account = 'testaccout'
5
+ return (
6
+ < div className = "flex justify-center py-16 min-h-screen" >
7
+ < Editor account = { account } />
8
+ </ div >
9
+ )
10
+ }
Original file line number Diff line number Diff line change 6
6
.current {
7
7
text-decoration : underline # FF3028 ;
8
8
font-weight : bold;
9
- }
9
+ }
10
+
11
+ h1 {
12
+ @apply text-4xl;
13
+ }
14
+ h2 {
15
+ @apply text-3xl;
16
+ }
17
+ h3 {
18
+ @apply text-2xl;
19
+ }
You can’t perform that action at this time.
0 commit comments