diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 0dffe56035..ac6ce14c03 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -620,7 +620,9 @@ "error.siyuan.no_config": "Siyuan Note API address or token is not configured", "success.siyuan.export": "Successfully exported to Siyuan Note", "warn.yuque.exporting": "Exporting to Yuque, please do not request export repeatedly!", - "warn.siyuan.exporting": "Exporting to Siyuan Note, please do not request export repeatedly!" + "warn.siyuan.exporting": "Exporting to Siyuan Note, please do not request export repeatedly!", + "download.success": "Download successfully", + "download.failed": "Download failed" }, "minapp": { "popup": { diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index b813ededfc..1fbe2249b7 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -620,7 +620,9 @@ "success.siyuan.export": "思源ノートへのエクスポートに成功しました", "warn.yuque.exporting": "語雀にエクスポート中です。重複してエクスポートしないでください!", "warn.siyuan.exporting": "思源ノートにエクスポート中です。重複してエクスポートしないでください!", - "error.yuque.no_config": "語雀のAPIアドレスまたはトークンが設定されていません" + "error.yuque.no_config": "語雀のAPIアドレスまたはトークンが設定されていません", + "download.success": "ダウンロードに成功しました", + "download.failed": "ダウンロードに失敗しました" }, "minapp": { "popup": { diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 803be36eac..2d23ea3991 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -620,7 +620,9 @@ "error.siyuan.no_config": "Не настроен API адрес или токен Siyuan", "success.siyuan.export": "Успешный экспорт в Siyuan", "warn.yuque.exporting": "Экспортируется в Yuque, пожалуйста, не отправляйте повторные запросы!", - "warn.siyuan.exporting": "Экспортируется в Siyuan, пожалуйста, не отправляйте повторные запросы!" + "warn.siyuan.exporting": "Экспортируется в Siyuan, пожалуйста, не отправляйте повторные запросы!", + "download.success": "Скачано успешно", + "download.failed": "Скачивание не удалось" }, "minapp": { "popup": { diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index 86c9ac34b8..8d8b23fb80 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -620,7 +620,9 @@ "error.siyuan.no_config": "未配置思源笔记API地址或令牌", "success.siyuan.export": "导出到思源笔记成功", "warn.yuque.exporting": "正在导出语雀, 请勿重复请求导出!", - "warn.siyuan.exporting": "正在导出到思源笔记,请勿重复请求导出!" + "warn.siyuan.exporting": "正在导出到思源笔记,请勿重复请求导出!", + "download.success": "下载成功", + "download.failed": "下载失败" }, "minapp": { "popup": { diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index 4bec777b83..514491c046 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -620,7 +620,9 @@ "error.siyuan.no_config": "未配置思源筆記API地址或令牌", "success.siyuan.export": "導出到思源筆記成功", "warn.yuque.exporting": "正在導出語雀,請勿重複請求導出!", - "warn.siyuan.exporting": "正在導出到思源筆記,請勿重複請求導出!" + "warn.siyuan.exporting": "正在導出到思源筆記,請勿重複請求導出!", + "download.success": "下載成功", + "download.failed": "下載失敗" }, "minapp": { "popup": { diff --git a/src/renderer/src/pages/home/Messages/MessageImage.tsx b/src/renderer/src/pages/home/Messages/MessageImage.tsx index 138a8f171c..7198066259 100644 --- a/src/renderer/src/pages/home/Messages/MessageImage.tsx +++ b/src/renderer/src/pages/home/Messages/MessageImage.tsx @@ -13,6 +13,7 @@ import { Image as AntdImage, Space } from 'antd' import { FC } from 'react' import { useTranslation } from 'react-i18next' import styled from 'styled-components' + interface Props { block: ImageMessageBlock } @@ -87,40 +88,42 @@ const MessageImage: FC = ({ block }) => { } } + const renderToolbar = + (currentImage: string, currentIndex: number) => + ( + _: any, + { + transform: { scale }, + actions: { onFlipY, onFlipX, onRotateLeft, onRotateRight, onZoomOut, onZoomIn, onReset } + }: any + ) => ( + + + + + + + + + onCopy(block.metadata?.generateImageResponse?.type!, currentImage)} /> + onDownload(currentImage, currentIndex)} /> + + ) + const images = block.metadata?.generateImageResponse?.images?.length ? block.metadata?.generateImageResponse?.images - : // TODO 加file是否合适? - block?.file?.path + : block?.file?.path ? [`file://${block?.file?.path}`] : [] + return ( {images.map((image, index) => ( ( - - - - - - - - - onCopy(block.metadata?.generateImageResponse?.type!, image)} /> - onDownload(image, index)} /> - - ) - }} + style={{ maxWidth: 500, maxHeight: 500 }} + preview={{ toolbarRender: renderToolbar(image, index) }} /> ))}