From cd88622fd999a6ff468dad6264dff102166fa3bb Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 11 Nov 2024 18:26:51 +0530 Subject: [PATCH] fix: intake form asset upload (#1691) --- .../components/editor/rich-text-editor.tsx | 19 +++++--------- space/ee/components/intake/create/form.tsx | 26 +++++++++++-------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/space/core/components/editor/rich-text-editor.tsx b/space/core/components/editor/rich-text-editor.tsx index 39a18f4f4c..988bca0125 100644 --- a/space/core/components/editor/rich-text-editor.tsx +++ b/space/core/components/editor/rich-text-editor.tsx @@ -1,22 +1,17 @@ import React, { forwardRef } from "react"; -// editor +// plane editor import { EditorRefApi, IMentionHighlight, IRichTextEditor, RichTextEditorWithRef } from "@plane/editor"; -// types // helpers -import { cn } from "@/helpers/common.helper"; import { getEditorFileHandlers } from "@/helpers/editor.helper"; interface RichTextEditorWrapperProps extends Omit { + anchor: string; uploadFile: (file: File) => Promise; + workspaceId: string; } export const RichTextEditor = forwardRef((props, ref) => { - const { containerClassName, uploadFile, ...rest } = props; - // store hooks - - // use-mention - - // file size + const { anchor, containerClassName, uploadFile, workspaceId, ...rest } = props; return ( ); }); diff --git a/space/ee/components/intake/create/form.tsx b/space/ee/components/intake/create/form.tsx index 0a621f8641..cece7330a3 100644 --- a/space/ee/components/intake/create/form.tsx +++ b/space/ee/components/intake/create/form.tsx @@ -1,9 +1,16 @@ +import { observer } from "mobx-react"; +// plane types import { IProject } from "@plane/types"; +// plane ui import { Button, Input } from "@plane/ui"; +// components import { ProjectLogo } from "@/components/common"; import { RichTextEditor } from "@/components/editor/rich-text-editor"; -import { useIssueDetails } from "@/hooks/store"; +// hooks +import { useIssueDetails, usePublish } from "@/hooks/store"; +// helpers import { getDescriptionPlaceholder } from "@/plane-web/helpers/issue.helper"; +// local types import { TFormData } from "./create-issue-modal"; type TProps = { @@ -19,15 +26,10 @@ type TProps = { placeholder?: string | ((isFocused: boolean, value: string) => string); }; -const IssueForm = ({ - project, - isSubmitting, - descriptionEditorRef, - anchor, - handleFormData, - formData, - placeholder, -}: TProps) => { +const IssueForm = observer((props: TProps) => { + const { project, isSubmitting, descriptionEditorRef, anchor, handleFormData, formData, placeholder } = props; + // store hooks + const { workspace: workspaceID } = usePublish(anchor); const { uploadIssueAsset } = useIssueDetails(); return ( @@ -94,6 +96,8 @@ const IssueForm = ({ const { asset_id } = await uploadIssueAsset(file, anchor); return asset_id; }} + anchor={anchor} + workspaceId={workspaceID?.toString() ?? ""} />