[WEB-438] fix: ai insertion behaviour (#3872)

* fixed ai insertion behaviour

* replaced all ai popover references to have similar behavior

* chore: removed debug statements
This commit is contained in:
M. Palanikannan 2024-03-06 20:38:57 +05:30 committed by GitHub
parent cb5198c883
commit 549f6d0943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 45 additions and 21 deletions

View file

@ -53,7 +53,7 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
membership: { currentProjectRole },
} = useUser();
const { handleSubmit, setValue, watch, getValues, control, reset } = useForm<IPage>({
const { handleSubmit, getValues, control, reset } = useForm<IPage>({
defaultValues: { name: "", description_html: "" },
});
@ -124,16 +124,13 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
const updatePage = async (formData: IPage) => {
if (!workspaceSlug || !projectId || !pageId) return;
await updateDescriptionAction(formData.description_html);
updateDescriptionAction(formData.description_html);
};
const handleAiAssistance = async (response: string) => {
if (!workspaceSlug || !projectId || !pageId) return;
const newDescription = `${watch("description_html")}<p>${response}</p>`;
setValue("description_html", newDescription);
editorRef.current?.setEditorValue(newDescription);
updateDescriptionAction(newDescription);
editorRef.current?.setEditorValueAtCursorPosition(response);
};
const actionCompleteAlert = ({