fix: ai response not coming when using 'AI' button (#1091)

* fix: ai response not comming for page

* fix: ai response not coming when using 'AI' button
This commit is contained in:
Dakshesh Jain 2023-05-19 20:33:35 +05:30 committed by GitHub
parent ab273f6be3
commit d9642eee82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -365,10 +365,15 @@ export const CreateUpdateBlockInline: React.FC<Props> = ({
content={watch("description_html")} content={watch("description_html")}
htmlContent={watch("description_html")} htmlContent={watch("description_html")}
onResponse={(response) => { onResponse={(response) => {
if (data && handleAiAssistance) handleAiAssistance(response); if (data && handleAiAssistance) {
else { handleAiAssistance(response);
editorRef.current?.setEditorValue(
`${watch("description_html")}<p>${response}</p>` ?? ""
);
} else {
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") ?? "");
} }
}} }}