From 564645dbe8fafcfb2165098f444fa6b4f7e544f1 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Wed, 4 Sep 2024 19:00:09 +0530 Subject: [PATCH] address comment --- .../Extensions/image/ImageComponent.tsx | 77 +++---------------- .../ui/src/locale/languages/de-de.json | 2 +- .../ui/src/locale/languages/en-us.json | 2 +- .../ui/src/locale/languages/es-es.json | 2 +- .../ui/src/locale/languages/fr-fr.json | 2 +- .../ui/src/locale/languages/he-he.json | 2 +- .../ui/src/locale/languages/ja-jp.json | 2 +- .../ui/src/locale/languages/nl-nl.json | 2 +- .../ui/src/locale/languages/pt-br.json | 2 +- .../ui/src/locale/languages/ru-ru.json | 2 +- .../ui/src/locale/languages/zh-cn.json | 2 +- 11 files changed, 22 insertions(+), 75 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/image/ImageComponent.tsx b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/image/ImageComponent.tsx index 958e06702c04..6321050a7642 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/image/ImageComponent.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/BlockEditor/Extensions/image/ImageComponent.tsx @@ -23,10 +23,7 @@ import { Space, Tabs, Typography, - Upload, - UploadProps, } from 'antd'; -import { UploadChangeParam } from 'antd/lib/upload'; import classNames from 'classnames'; import { isEmpty } from 'lodash'; import React, { FC, useState } from 'react'; @@ -48,36 +45,10 @@ const PopoverContent: FC = ({ updateAttributes, onPopupVisibleChange, onUploadingChange, - isUploading, - deleteNode, - isValidSource, src, + deleteNode, }) => { const { t } = useTranslation(); - const handleFileUploadChange = async (info: UploadChangeParam) => { - try { - const srcUrl = info.file.response?.result; - if (srcUrl) { - updateAttributes({ src: srcUrl, alt: info.file.fileName }); - onPopupVisibleChange(false); - } - } catch (error) { - // handle error - } finally { - onUploadingChange(false); - } - }; - - const handleRequestUpload: UploadProps['customRequest'] = (options) => { - onUploadingChange(true); - const reader = new FileReader(); - reader.readAsDataURL(options.file as Blob); - reader.addEventListener('load', (e) => { - setTimeout(() => { - options?.onSuccess?.(e.target); - }, 1000); - }); - }; const handleEmbedImage: FormProps['onFinish'] = (values) => { onPopupVisibleChange(false); @@ -87,35 +58,6 @@ const PopoverContent: FC = ({ onUploadingChange(false); }; - const uploadElement = ( - - - - {isValidSource && ( - - )} - - - ); - const embedLinkElement = (
= ({ + + + @@ -152,13 +104,8 @@ const PopoverContent: FC = ({ return (