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>")) && ( {((content && content !== "") || (htmlContent && htmlContent !== "<p></p>")) && (
<div id="tiptap-container" className="remirror-section text-sm"> <div id="tiptap-container" className="text-sm">
Content: Content:
<TiptapEditor <TiptapEditor
value={htmlContent ?? `<p>${content}</p>`} value={htmlContent ?? `<p>${content}</p>`}

View File

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

View File

@ -115,7 +115,7 @@ const Tiptap = (props: ITiptapRichTextEditor) => {
}, 500); }, 500);
}, 1000); }, 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' ${noBorder ? '' : 'border border-custom-border-200'
} ${borderOnFocus ? 'focus:border border-custom-border-300' : 'focus:border-0' } ${borderOnFocus ? 'focus:border border-custom-border-300' : 'focus:border-0'
} ${customClassName}`; } ${customClassName}`;