Skip to content

Commit 6b8ddfe

Browse files
qdaxbdaniel-lxsmrubens
authored andcommitted
add mermaid buttons (#4547)
* add mermaid buttons * feat: Add Modal, TabButton, and ZoomControls components * feat: Add error handling messages for image operations and file opening * mermaid: Add drag functionality and support contious zooming * add active color for tabbutton * refactor zoom controls * refactor: Remove unused svgToPng prop and simplify handleCopy function * Move zoom to constants and increase max zoom * feat: add save image functionality and refactor image handling * feat: add translations --------- Co-authored-by: Daniel Riccio <[email protected]> Co-authored-by: Matt Rubens <[email protected]>
1 parent 0b8ec9e commit 6b8ddfe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1360
-59
lines changed

src/core/webview/webviewMessageHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import { checkoutDiffPayloadSchema, checkoutRestorePayloadSchema, WebviewMessage
1717
import { checkExistKey } from "../../shared/checkExistApiConfig"
1818
import { experimentDefault } from "../../shared/experiments"
1919
import { Terminal } from "../../integrations/terminal/Terminal"
20-
import { openFile, openImage } from "../../integrations/misc/open-file"
20+
import { openFile } from "../../integrations/misc/open-file"
21+
import { openImage, saveImage } from "../../integrations/misc/image-handler"
2122
import { selectImages } from "../../integrations/misc/process-images"
2223
import { getTheme } from "../../integrations/theme/getTheme"
2324
import { discoverChromeHostUrl, tryChromeHostUrl } from "../../services/browser/browserDiscovery"
@@ -423,7 +424,10 @@ export const webviewMessageHandler = async (
423424
provider.postMessageToWebview({ type: "vsCodeLmModels", vsCodeLmModels })
424425
break
425426
case "openImage":
426-
openImage(message.text!)
427+
openImage(message.text!, { values: message.values })
428+
break
429+
case "saveImage":
430+
saveImage(message.dataUri!)
427431
break
428432
case "openFile":
429433
openFile(message.text!, message.values as { create?: boolean; content?: string; line?: number })

src/i18n/locales/ca/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
},
2929
"errors": {
3030
"invalid_data_uri": "Format d'URI de dades no vàlid",
31+
"error_copying_image": "Error copiant la imatge: {{errorMessage}}",
32+
"error_saving_image": "Error desant la imatge: {{errorMessage}}",
33+
"error_opening_image": "Error obrint la imatge: {{error}}",
34+
"could_not_open_file": "No s'ha pogut obrir el fitxer: {{errorMessage}}",
35+
"could_not_open_file_generic": "No s'ha pogut obrir el fitxer!",
3136
"checkpoint_timeout": "S'ha esgotat el temps en intentar restaurar el punt de control.",
3237
"checkpoint_failed": "Ha fallat la restauració del punt de control.",
3338
"no_workspace": "Si us plau, obre primer una carpeta de projecte",
@@ -71,7 +76,9 @@
7176
"custom_storage_path_set": "Ruta d'emmagatzematge personalitzada establerta: {{path}}",
7277
"default_storage_path": "S'ha reprès l'ús de la ruta d'emmagatzematge predeterminada",
7378
"settings_imported": "Configuració importada correctament.",
74-
"share_link_copied": "Enllaç de compartició copiat al portapapers"
79+
"share_link_copied": "Enllaç de compartició copiat al portapapers",
80+
"image_copied_to_clipboard": "URI de dades de la imatge copiada al portapapers",
81+
"image_saved": "Imatge desada a {{path}}"
7582
},
7683
"answers": {
7784
"yes": "",

src/i18n/locales/de/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "Ungültiges Daten-URI-Format",
27+
"error_copying_image": "Fehler beim Kopieren des Bildes: {{errorMessage}}",
28+
"error_saving_image": "Fehler beim Speichern des Bildes: {{errorMessage}}",
29+
"error_opening_image": "Fehler beim Öffnen des Bildes: {{error}}",
30+
"could_not_open_file": "Datei konnte nicht geöffnet werden: {{errorMessage}}",
31+
"could_not_open_file_generic": "Datei konnte nicht geöffnet werden!",
2732
"checkpoint_timeout": "Zeitüberschreitung beim Versuch, den Checkpoint wiederherzustellen.",
2833
"checkpoint_failed": "Fehler beim Wiederherstellen des Checkpoints.",
2934
"no_workspace": "Bitte öffne zuerst einen Projektordner",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "Benutzerdefinierter Speicherpfad festgelegt: {{path}}",
6873
"default_storage_path": "Auf Standardspeicherpfad zurückgesetzt",
6974
"settings_imported": "Einstellungen erfolgreich importiert.",
70-
"share_link_copied": "Share-Link in die Zwischenablage kopiert"
75+
"share_link_copied": "Share-Link in die Zwischenablage kopiert",
76+
"image_copied_to_clipboard": "Bild-Daten-URI in die Zwischenablage kopiert",
77+
"image_saved": "Bild gespeichert unter {{path}}"
7178
},
7279
"answers": {
7380
"yes": "Ja",

src/i18n/locales/en/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "Invalid data URI format",
27+
"error_copying_image": "Error copying image: {{errorMessage}}",
28+
"error_opening_image": "Error opening image: {{error}}",
29+
"error_saving_image": "Error saving image: {{errorMessage}}",
30+
"could_not_open_file": "Could not open file: {{errorMessage}}",
31+
"could_not_open_file_generic": "Could not open file!",
2732
"checkpoint_timeout": "Timed out when attempting to restore checkpoint.",
2833
"checkpoint_failed": "Failed to restore checkpoint.",
2934
"no_workspace": "Please open a project folder first",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "Custom storage path set: {{path}}",
6873
"default_storage_path": "Reverted to using default storage path",
6974
"settings_imported": "Settings imported successfully.",
70-
"share_link_copied": "Share link copied to clipboard"
75+
"share_link_copied": "Share link copied to clipboard",
76+
"image_copied_to_clipboard": "Image data URI copied to clipboard",
77+
"image_saved": "Image saved to {{path}}"
7178
},
7279
"answers": {
7380
"yes": "Yes",

src/i18n/locales/es/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "Formato de URI de datos no válido",
27+
"error_copying_image": "Error copiando la imagen: {{errorMessage}}",
28+
"error_saving_image": "Error guardando la imagen: {{errorMessage}}",
29+
"error_opening_image": "Error abriendo la imagen: {{error}}",
30+
"could_not_open_file": "No se pudo abrir el archivo: {{errorMessage}}",
31+
"could_not_open_file_generic": "¡No se pudo abrir el archivo!",
2732
"checkpoint_timeout": "Se agotó el tiempo al intentar restaurar el punto de control.",
2833
"checkpoint_failed": "Error al restaurar el punto de control.",
2934
"no_workspace": "Por favor, abre primero una carpeta de proyecto",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "Ruta de almacenamiento personalizada establecida: {{path}}",
6873
"default_storage_path": "Se ha vuelto a usar la ruta de almacenamiento predeterminada",
6974
"settings_imported": "Configuración importada correctamente.",
70-
"share_link_copied": "Enlace de compartir copiado al portapapeles"
75+
"share_link_copied": "Enlace de compartir copiado al portapapeles",
76+
"image_copied_to_clipboard": "URI de datos de imagen copiada al portapapeles",
77+
"image_saved": "Imagen guardada en {{path}}"
7178
},
7279
"answers": {
7380
"yes": "",

src/i18n/locales/fr/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "Format d'URI de données invalide",
27+
"error_copying_image": "Erreur lors de la copie de l'image : {{errorMessage}}",
28+
"error_saving_image": "Erreur lors de l'enregistrement de l'image : {{errorMessage}}",
29+
"error_opening_image": "Erreur lors de l'ouverture de l'image : {{error}}",
30+
"could_not_open_file": "Impossible d'ouvrir le fichier : {{errorMessage}}",
31+
"could_not_open_file_generic": "Impossible d'ouvrir le fichier !",
2732
"checkpoint_timeout": "Expiration du délai lors de la tentative de rétablissement du checkpoint.",
2833
"checkpoint_failed": "Échec du rétablissement du checkpoint.",
2934
"no_workspace": "Veuillez d'abord ouvrir un espace de travail",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "Chemin de stockage personnalisé défini : {{path}}",
6873
"default_storage_path": "Retour au chemin de stockage par défaut",
6974
"settings_imported": "Paramètres importés avec succès.",
70-
"share_link_copied": "Lien de partage copié dans le presse-papiers"
75+
"share_link_copied": "Lien de partage copié dans le presse-papiers",
76+
"image_copied_to_clipboard": "URI de données d'image copiée dans le presse-papiers",
77+
"image_saved": "Image enregistrée dans {{path}}"
7178
},
7279
"answers": {
7380
"yes": "Oui",

src/i18n/locales/hi/common.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "अमान्य डेटा URI फॉर्मेट",
27+
"error_copying_image": "छवि कॉपी करने में त्रुटि: {{errorMessage}}",
28+
"error_saving_image": "छवि सहेजने में त्रुटि: {{errorMessage}}",
29+
"error_opening_image": "छवि खोलने में त्रुटि: {{error}}",
30+
"could_not_open_file": "फ़ाइल नहीं खोली जा सकी: {{errorMessage}}",
31+
"could_not_open_file_generic": "फ़ाइल नहीं खोली जा सकी!",
2732
"checkpoint_timeout": "चेकपॉइंट को पुनर्स्थापित करने का प्रयास करते समय टाइमआउट हो गया।",
2833
"checkpoint_failed": "चेकपॉइंट पुनर्स्थापित करने में विफल।",
2934
"no_workspace": "कृपया पहले प्रोजेक्ट फ़ोल्डर खोलें",
@@ -66,8 +71,10 @@
6671
"history_cleanup": "इतिहास से गायब फाइलों वाले {{count}} टास्क साफ किए गए।",
6772
"custom_storage_path_set": "कस्टम स्टोरेज पाथ सेट किया गया: {{path}}",
6873
"default_storage_path": "डिफ़ॉल्ट स्टोरेज पाथ का उपयोग पुनः शुरू किया गया",
69-
"settings_imported": "सेटिंग्स सफलतापूर्वक इम्पोर्ट की गईं.",
70-
"share_link_copied": "साझा लिंक क्लिपबोर्ड पर कॉपी किया गया"
74+
"settings_imported": "सेटिंग्स सफलतापूर्वक इम्पोर्ट की गईं।",
75+
"share_link_copied": "साझा लिंक क्लिपबोर्ड पर कॉपी किया गया",
76+
"image_copied_to_clipboard": "छवि डेटा URI क्लिपबोर्ड में कॉपी की गई",
77+
"image_saved": "छवि {{path}} में सहेजी गई"
7178
},
7279
"answers": {
7380
"yes": "हां",

src/i18n/locales/it/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "Formato URI dati non valido",
27+
"error_copying_image": "Errore durante la copia dell'immagine: {{errorMessage}}",
28+
"error_saving_image": "Errore durante il salvataggio dell'immagine: {{errorMessage}}",
29+
"error_opening_image": "Errore durante l'apertura dell'immagine: {{error}}",
30+
"could_not_open_file": "Impossibile aprire il file: {{errorMessage}}",
31+
"could_not_open_file_generic": "Impossibile aprire il file!",
2732
"checkpoint_timeout": "Timeout durante il tentativo di ripristinare il checkpoint.",
2833
"checkpoint_failed": "Impossibile ripristinare il checkpoint.",
2934
"no_workspace": "Per favore, apri prima una cartella di progetto",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "Percorso di archiviazione personalizzato impostato: {{path}}",
6873
"default_storage_path": "Tornato al percorso di archiviazione predefinito",
6974
"settings_imported": "Impostazioni importate con successo.",
70-
"share_link_copied": "Link di condivisione copiato negli appunti"
75+
"share_link_copied": "Link di condivisione copiato negli appunti",
76+
"image_copied_to_clipboard": "URI dati dell'immagine copiato negli appunti",
77+
"image_saved": "Immagine salvata in {{path}}"
7178
},
7279
"answers": {
7380
"yes": "",

src/i18n/locales/ja/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "データURIフォーマットが無効です",
27+
"error_copying_image": "画像のコピー中にエラーが発生しました:{{errorMessage}}",
28+
"error_saving_image": "画像の保存中にエラーが発生しました:{{errorMessage}}",
29+
"error_opening_image": "画像を開く際にエラーが発生しました:{{error}}",
30+
"could_not_open_file": "ファイルを開けませんでした:{{errorMessage}}",
31+
"could_not_open_file_generic": "ファイルを開けませんでした!",
2732
"checkpoint_timeout": "チェックポイントの復元を試みる際にタイムアウトしました。",
2833
"checkpoint_failed": "チェックポイントの復元に失敗しました。",
2934
"no_workspace": "まずプロジェクトフォルダを開いてください",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "カスタムストレージパスが設定されました:{{path}}",
6873
"default_storage_path": "デフォルトのストレージパスに戻りました",
6974
"settings_imported": "設定が正常にインポートされました。",
70-
"share_link_copied": "共有リンクがクリップボードにコピーされました"
75+
"share_link_copied": "共有リンクがクリップボードにコピーされました",
76+
"image_copied_to_clipboard": "画像データURIがクリップボードにコピーされました",
77+
"image_saved": "画像を{{path}}に保存しました"
7178
},
7279
"answers": {
7380
"yes": "はい",

src/i18n/locales/ko/common.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
},
2525
"errors": {
2626
"invalid_data_uri": "잘못된 데이터 URI 형식",
27+
"error_copying_image": "이미지 복사 중 오류 발생: {{errorMessage}}",
28+
"error_saving_image": "이미지 저장 중 오류 발생: {{errorMessage}}",
29+
"error_opening_image": "이미지 열기 중 오류 발생: {{error}}",
30+
"could_not_open_file": "파일을 열 수 없습니다: {{errorMessage}}",
31+
"could_not_open_file_generic": "파일을 열 수 없습니다!",
2732
"checkpoint_timeout": "체크포인트 복원을 시도하는 중 시간 초과되었습니다.",
2833
"checkpoint_failed": "체크포인트 복원에 실패했습니다.",
2934
"no_workspace": "먼저 프로젝트 폴더를 열어주세요",
@@ -67,7 +72,9 @@
6772
"custom_storage_path_set": "사용자 지정 저장 경로 설정됨: {{path}}",
6873
"default_storage_path": "기본 저장 경로로 되돌아갔습니다",
6974
"settings_imported": "설정이 성공적으로 가져와졌습니다.",
70-
"share_link_copied": "공유 링크가 클립보드에 복사되었습니다"
75+
"share_link_copied": "공유 링크가 클립보드에 복사되었습니다",
76+
"image_copied_to_clipboard": "이미지 데이터 URI가 클립보드에 복사되었습니다",
77+
"image_saved": "이미지가 {{path}}에 저장되었습니다"
7178
},
7279
"answers": {
7380
"yes": "",

0 commit comments

Comments
 (0)