diff --git a/web/components/issues/description-form.tsx b/web/components/issues/description-form.tsx index 505030945..8596d5fe8 100644 --- a/web/components/issues/description-form.tsx +++ b/web/components/issues/description-form.tsx @@ -128,33 +128,24 @@ export const IssueDescriptionForm: FC = ({ { - if (!value) return <>; - - return ( + render={({ field: { value, onChange } }) => ( { - setShowAlert(true); - setIsSubmitting("submitting"); - onChange(description_html); - handleSubmit(handleDescriptionFormSubmit)().finally(() => - setIsSubmitting("submitted") - ); - }} - editable={isAllowed} - /> - ); - }} + uploadFile={fileService.getUploadFileFunction(workspaceSlug)} + deleteFile={fileService.deleteImage} + value={value} + debouncedUpdatesEnabled={true} + setShouldShowAlert={setShowAlert} + setIsSubmitting={setIsSubmitting} + customClassName={isAllowed ? "min-h-[150px] shadow-sm" : "!p-0 !pt-2 text-custom-text-200"} + noBorder={!isAllowed} + onChange={(description: Object, description_html: string) => { + setShowAlert(true); + setIsSubmitting("submitting"); + onChange(description_html); + handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted") + ); + } } /> + )} />
= (props) => { { - if (!value && !watch("description_html")) return <>; - - return ( + render={({ field: { value, onChange } }) => ( { - onChange(description_html); - setValue("description", description); - }} - /> - ); - }} + uploadFile={fileService.getUploadFileFunction(workspaceSlug as string)} + deleteFile={fileService.deleteImage} + ref={editorRef} + debouncedUpdatesEnabled={false} + value={!value || + value === "" || + (typeof value === "object" && Object.keys(value).length === 0) + ? watch("description_html") + : value} + customClassName="min-h-[150px]" + onChange={(description: Object, description_html: string) => { + onChange(description_html); + setValue("description", description); + } } /> + )} /> = (props) => { { - if (!value) return <>; - - return ( + render={({ field: { value, onChange } }) => (

" - : value - } - debouncedUpdatesEnabled={true} - setShouldShowAlert={setShowAlert} - setIsSubmitting={setIsSubmitting} - customClassName={ - isAllowed ? "min-h-[150px] shadow-sm" : "!p-0 !pt-2 text-custom-text-200" - } - noBorder={!isAllowed} - onChange={(description: Object, description_html: string) => { - setShowAlert(true); - setIsSubmitting("submitting"); - onChange(description_html); - handleSubmit(handleDescriptionFormSubmit)().finally(() => - setIsSubmitting("submitted") - ); - }} - editable={isAllowed} - /> - ); - }} + uploadFile={fileService.getUploadFileFunction(workspaceSlug as string)} + deleteFile={fileService.deleteImage} + value={!value || + value === "" || + (typeof value === "object" && Object.keys(value).length === 0) + ? "

" + : value} + debouncedUpdatesEnabled={true} + setShouldShowAlert={setShowAlert} + setIsSubmitting={setIsSubmitting} + customClassName={isAllowed ? "min-h-[150px] shadow-sm" : "!p-0 !pt-2 text-custom-text-200"} + noBorder={!isAllowed} + onChange={(description: Object, description_html: string) => { + setShowAlert(true); + setIsSubmitting("submitting"); + onChange(description_html); + handleSubmit(handleDescriptionFormSubmit)().finally(() => setIsSubmitting("submitted") + ); + } } + editable={isAllowed} /> + )} />