fixed gpt-assistant modal

This commit is contained in:
Palanikannan1437 2023-08-14 20:54:15 +05:30
parent b590cb60fd
commit cd2c632929
3 changed files with 12 additions and 4 deletions

View File

@ -145,7 +145,7 @@ export const GptAssistantModal: React.FC<Props> = ({
}`}
>
{((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
<div id="tiptap-container" className="remirror-section text-sm">
<div id="tiptap-container" className="text-sm">
Content:
<TiptapEditor
value={htmlContent ?? `<p>${content}</p>`}

View File

@ -35,9 +35,15 @@ import {
import { SparklesIcon, XMarkIcon } from "@heroicons/react/24/outline";
// types
import type { ICurrentUserResponse, IIssue, ISearchIssueResponse } from "types";
import Tiptap from "components/tiptap";
import Tiptap, { ITiptapRichTextEditor } from "components/tiptap";
// rich-text-editor
const TiptapEditor = React.forwardRef<ITiptapRichTextEditor, ITiptapRichTextEditor>(
(props, ref) => <Tiptap {...props} forwardedRef={ref} />
);
TiptapEditor.displayName = "TiptapEditor";
const defaultValues: Partial<IIssue> = {
project: "",
name: "",
@ -158,6 +164,7 @@ export const IssueForm: FC<IssueFormProps> = ({
const handleAiAssistance = async (response: string) => {
if (!workspaceSlug || !projectId) return;
console.log(response)
setValue("description", {});
setValue("description_html", `${watch("description_html")}<p>${response}</p>`);
editorRef.current?.setEditorValue(`${watch("description_html")}`);
@ -365,7 +372,8 @@ export const IssueForm: FC<IssueFormProps> = ({
if (!value && !watch("description_html")) return <></>;
return (
<Tiptap
<TiptapEditor
ref={editorRef}
debouncedUpdatesEnabled={false}
value={
!value ||

View File

@ -115,7 +115,7 @@ const Tiptap = (props: ITiptapRichTextEditor) => {
}, 500);
}, 1000);
const editorClassNames = `relative w-full max-w-screen-lg sm:rounded-lg sm:border sm:shadow-lg mt-2 p-3 relative focus:outline-none rounded-md
const editorClassNames = `relative w-full max-w-screen-lg sm:rounded-lg sm:shadow-lg mt-2 p-3 relative focus:outline-none rounded-md
${noBorder ? '' : 'border border-custom-border-200'
} ${borderOnFocus ? 'focus:border border-custom-border-300' : 'focus:border-0'
} ${customClassName}`;