mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-27 04:31:27 +08:00
feat: improve ImageViewer context menu UX (#11547)
- Reorder menu items to prioritize "Copy as Image" as the first action - Rename "Copy" to "Copy Image Source" for better clarity - Remove unused ImageIcon import - Add i18n support for "preview.copy.src" across all locales This change improves the user experience by making the most common action (copy image) the first option in the context menu, while also clarifying what each copy action does. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ef5b97813c
commit
d35434b6d6
@ -14,7 +14,7 @@ import { convertImageToPng } from '@renderer/utils/image'
|
||||
import type { ImageProps as AntImageProps } from 'antd'
|
||||
import { Dropdown, Image as AntImage, Space } from 'antd'
|
||||
import { Base64 } from 'js-base64'
|
||||
import { DownloadIcon, ImageIcon } from 'lucide-react'
|
||||
import { DownloadIcon } from 'lucide-react'
|
||||
import mime from 'mime'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@ -73,9 +73,15 @@ const ImageViewer: React.FC<ImageViewerProps> = ({ src, style, ...props }) => {
|
||||
const getContextMenuItems = (src: string, size: number = 14) => {
|
||||
return [
|
||||
{
|
||||
key: 'copy-url',
|
||||
key: 'copy-image',
|
||||
label: t('common.copy'),
|
||||
icon: <CopyIcon size={size} />,
|
||||
onClick: () => handleCopyImage(src)
|
||||
},
|
||||
{
|
||||
key: 'copy-url',
|
||||
label: t('preview.copy.src'),
|
||||
icon: <CopyIcon size={size} />,
|
||||
onClick: () => {
|
||||
navigator.clipboard.writeText(src)
|
||||
window.toast.success(t('message.copy.success'))
|
||||
@ -86,12 +92,6 @@ const ImageViewer: React.FC<ImageViewerProps> = ({ src, style, ...props }) => {
|
||||
label: t('common.download'),
|
||||
icon: <DownloadIcon size={size} />,
|
||||
onClick: () => download(src)
|
||||
},
|
||||
{
|
||||
key: 'copy-image',
|
||||
label: t('preview.copy.image'),
|
||||
icon: <ImageIcon size={size} />,
|
||||
onClick: () => handleCopyImage(src)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Copy as image"
|
||||
"image": "Copy as image",
|
||||
"src": "Copy Image Source"
|
||||
},
|
||||
"dialog": "Open Dialog",
|
||||
"label": "Preview",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "复制为图片"
|
||||
"image": "复制为图片",
|
||||
"src": "复制图片源"
|
||||
},
|
||||
"dialog": "打开预览窗口",
|
||||
"label": "预览",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "複製為圖片"
|
||||
"image": "複製為圖片",
|
||||
"src": "複製圖片來源"
|
||||
},
|
||||
"dialog": "開啟預覽窗口",
|
||||
"label": "預覽",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Als Bild kopieren"
|
||||
"image": "Als Bild kopieren",
|
||||
"src": "Bildquelle kopieren"
|
||||
},
|
||||
"dialog": "Vorschaufenster öffnen",
|
||||
"label": "Vorschau",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Αντιγραφή ως εικόνα"
|
||||
"image": "Αντιγραφή ως εικόνα",
|
||||
"src": "Αντιγραφή πηγής εικόνας"
|
||||
},
|
||||
"dialog": "Άνοιγμα παραθύρου προεπισκόπησης",
|
||||
"label": "Προεπισκόπηση",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Copiar como imagen"
|
||||
"image": "Copiar como imagen",
|
||||
"src": "Copia la fuente de la imagen"
|
||||
},
|
||||
"dialog": "Abrir la ventana de vista previa",
|
||||
"label": "Vista previa",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Copier en tant qu'image"
|
||||
"image": "Copier en tant qu'image",
|
||||
"src": "Copier la source de l'image"
|
||||
},
|
||||
"dialog": "Ouvrir la fenêtre d'aperçu",
|
||||
"label": "Aperçu",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "画像としてコピー"
|
||||
"image": "画像としてコピー",
|
||||
"src": "画像ソースをコピー"
|
||||
},
|
||||
"dialog": "ダイアログを開く",
|
||||
"label": "プレビュー",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Copiar como imagem"
|
||||
"image": "Copiar como imagem",
|
||||
"src": "Copiar Origem da Imagem"
|
||||
},
|
||||
"dialog": "Abrir janela de pré-visualização",
|
||||
"label": "Pré-visualização",
|
||||
|
||||
@ -2517,7 +2517,8 @@
|
||||
},
|
||||
"preview": {
|
||||
"copy": {
|
||||
"image": "Скопировать как изображение"
|
||||
"image": "Скопировать как изображение",
|
||||
"src": "Копировать источник изображения"
|
||||
},
|
||||
"dialog": "Открыть диалог",
|
||||
"label": "Предварительный просмотр",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user