mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 22:09:12 +02:00
fix: intake form asset upload (#1691)
This commit is contained in:
committed by
GitHub
parent
009c866cc0
commit
cd88622fd9
@@ -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<IRichTextEditor, "fileHandler" | "mentionHandler"> {
|
||||
anchor: string;
|
||||
uploadFile: (file: File) => Promise<string>;
|
||||
workspaceId: string;
|
||||
}
|
||||
|
||||
export const RichTextEditor = forwardRef<EditorRefApi, RichTextEditorWrapperProps>((props, ref) => {
|
||||
const { containerClassName, uploadFile, ...rest } = props;
|
||||
// store hooks
|
||||
|
||||
// use-mention
|
||||
|
||||
// file size
|
||||
const { anchor, containerClassName, uploadFile, workspaceId, ...rest } = props;
|
||||
|
||||
return (
|
||||
<RichTextEditorWithRef
|
||||
@@ -29,12 +24,12 @@ export const RichTextEditor = forwardRef<EditorRefApi, RichTextEditorWrapperProp
|
||||
ref={ref}
|
||||
fileHandler={getEditorFileHandlers({
|
||||
uploadFile,
|
||||
workspaceId: "",
|
||||
anchor: "",
|
||||
workspaceId,
|
||||
anchor,
|
||||
})}
|
||||
{...rest}
|
||||
containerClassName={containerClassName}
|
||||
editorClassName="min-h-[100px] max-h-[50vh] border border-gray-100 rounded-md pl-3 pb-3 overflow-y-scroll"
|
||||
editorClassName="min-h-[100px] max-h-[50vh] border-[0.5px] border-custom-border-200 rounded-md pl-3 pb-3 overflow-y-scroll"
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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() ?? ""}
|
||||
/>
|
||||
|
||||
<Button variant="primary" size="sm" type="submit" loading={isSubmitting} className="mx-auto mr-0">
|
||||
@@ -102,6 +106,6 @@ const IssueForm = ({
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
||||
export default IssueForm;
|
||||
|
||||
Reference in New Issue
Block a user