mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
added tiptap support to gpt assistant modal (yet to be tested)
This commit is contained in:
parent
c2a4cdfebb
commit
579051db31
@ -1,4 +1,4 @@
|
||||
import { useEffect, useState, forwardRef, useRef } from "react";
|
||||
import React, { useEffect, useState, forwardRef, useRef } from "react";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import dynamic from "next/dynamic";
|
||||
@ -15,6 +15,7 @@ import useUserAuth from "hooks/use-user-auth";
|
||||
import { Input, PrimaryButton, SecondaryButton } from "components/ui";
|
||||
|
||||
import { IIssue, IPageBlock } from "types";
|
||||
import Tiptap, { ITiptapRichTextEditor } from "components/tiptap";
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
handleClose: () => void;
|
||||
@ -44,6 +45,14 @@ type FormData = {
|
||||
//
|
||||
// WrappedRemirrorRichTextEditor.displayName = "WrappedRemirrorRichTextEditor";
|
||||
|
||||
const TiptapEditor = React.forwardRef<
|
||||
ITiptapRichTextEditor,
|
||||
ITiptapRichTextEditor
|
||||
>((props, ref) => <Tiptap {...props} forwardedRef={ref} />);
|
||||
|
||||
TiptapEditor.displayName = "TiptapEditor";
|
||||
|
||||
|
||||
export const GptAssistantModal: React.FC<Props> = ({
|
||||
isOpen,
|
||||
handleClose,
|
||||
@ -146,13 +155,20 @@ export const GptAssistantModal: React.FC<Props> = ({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`absolute ${inset} z-20 w-full space-y-4 rounded-[10px] border border-custom-border-200 bg-custom-background-100 p-4 shadow ${
|
||||
isOpen ? "block" : "hidden"
|
||||
className={`absolute ${inset} z-20 w-full space-y-4 rounded-[10px] border border-custom-border-200 bg-custom-background-100 p-4 shadow ${isOpen ? "block" : "hidden"
|
||||
}`}
|
||||
>
|
||||
{/* {((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && ( */}
|
||||
{/* <div className="remirror-section text-sm"> */}
|
||||
{/* Content: */}
|
||||
{((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
|
||||
<div className="remirror-section text-sm">
|
||||
Content:
|
||||
<TiptapEditor
|
||||
value={htmlContent ?? `<p>${content}</p>`}
|
||||
customClassName="-m-3"
|
||||
noBorder
|
||||
borderOnFocus={false}
|
||||
editable={false}
|
||||
ref={editorRef}
|
||||
/>
|
||||
{/* <WrappedRemirrorRichTextEditor */}
|
||||
{/* value={htmlContent ?? <p>{content}</p>} */}
|
||||
{/* customClassName="-m-3" */}
|
||||
@ -161,18 +177,26 @@ export const GptAssistantModal: React.FC<Props> = ({
|
||||
{/* editable={false} */}
|
||||
{/* ref={editorRef} */}
|
||||
{/* /> */}
|
||||
{/* </div> */}
|
||||
{/* )} */}
|
||||
</div>
|
||||
)}
|
||||
{response !== "" && (
|
||||
<div className="page-block-section text-sm">
|
||||
Response:
|
||||
<RemirrorRichTextEditor
|
||||
<Tiptap
|
||||
value={`<p>${response}</p>`}
|
||||
customClassName="-mx-3 -my-3"
|
||||
noBorder
|
||||
borderOnFocus={false}
|
||||
editable={false}
|
||||
/>
|
||||
|
||||
{/* <RemirrorRichTextEditor */}
|
||||
{/* value={`<p>${response}</p>`} */}
|
||||
{/* customClassName="-mx-3 -my-3" */}
|
||||
{/* noBorder */}
|
||||
{/* borderOnFocus={false} */}
|
||||
{/* editable={false} */}
|
||||
{/* /> */}
|
||||
</div>
|
||||
)}
|
||||
{invalidResponse && (
|
||||
@ -185,8 +209,7 @@ export const GptAssistantModal: React.FC<Props> = ({
|
||||
type="text"
|
||||
name="task"
|
||||
register={register}
|
||||
placeholder={`${
|
||||
content && content !== ""
|
||||
placeholder={`${content && content !== ""
|
||||
? "Tell AI what action to perform on this content..."
|
||||
: "Ask AI anything..."
|
||||
}`}
|
||||
|
Loading…
Reference in New Issue
Block a user