-
Notifications
You must be signed in to change notification settings - Fork 12
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
66 additions
and
11 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 |
---|---|---|
@@ -1,15 +1,30 @@ | ||
import { EditorProvider } from '@tiptap/react' | ||
import React from 'react' | ||
import { EditorContent, EditorProvider, useEditor } from '@tiptap/react' | ||
import React, { useEffect } from 'react' | ||
import StarterKit from '@tiptap/starter-kit' | ||
import { EnterIcon } from '@radix-ui/react-icons' | ||
|
||
export const AiBlockEditor = ({ content }) => { | ||
const extensions = [ | ||
StarterKit, | ||
] | ||
const editor = useEditor({ | ||
extensions, | ||
content: content, | ||
editorProps: { | ||
attributes: { | ||
class: 'prose', | ||
}, | ||
}, | ||
}) | ||
|
||
return ( | ||
<EditorProvider extensions={extensions} content={content}> | ||
</EditorProvider> | ||
<div className={"ai-block-editor-block"}> | ||
<EditorContent editor={editor} className={"ai-block-editor"}/> | ||
{editor && <div className={'ai-block-actions'}> | ||
<button>Go<EnterIcon/></button> | ||
<button>Cancel <span>esc</span></button> | ||
</div>} | ||
</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
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
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