Skip to content

Commit ee9cf67

Browse files
authored
feat: allow setting image dimensions in dialog (#834)
1 parent cee578d commit ee9cf67

File tree

15 files changed

+168
-28
lines changed

15 files changed

+168
-28
lines changed

locales/en/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "Or add an image from an URL:",
1616
"autoCompletePlaceholder": "Select or paste an image src",
1717
"alt": "Alt:",
18-
"title": "Title:"
18+
"title": "Title:",
19+
"width": "Width:",
20+
"height": "Height:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Delete image",

locales/es-es/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "O añade una imagen desde una URL:",
1616
"autoCompletePlaceholder": "Selecciona o pega el src de la imagen",
1717
"alt": "Alt:",
18-
"title": "Título:"
18+
"title": "Título:",
19+
"width": "Ancho:",
20+
"height": "Alto:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Borrar imagen",

locales/fr/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "Ou ajouter une image depuis une URL :",
1616
"autoCompletePlaceholder": "Sélectionner ou coller la source de l’image",
1717
"alt": "Texte alternatif :",
18-
"title": "Titre :"
18+
"title": "Titre :",
19+
"width": "Largeur :",
20+
"height": "Hauteur :"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Supprimer l’image",

locales/ko-kr/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "URL로 이미지 가져오기:",
1616
"autoCompletePlaceholder": "이미지 소스를 선택하거나 붙여넣으세요.",
1717
"alt": "Alt:",
18-
"title": "제목:"
18+
"title": "제목:",
19+
"width": "너비:",
20+
"height": "높이:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "이미지 삭제",

locales/pt-br/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "Ou adicionar uma imagem a partir de um URL:",
1616
"autoCompletePlaceholder": "Insira um link de imagem",
1717
"alt": "Texto alternativo:",
18-
"title": "Título:"
18+
"title": "Título:",
19+
"width": "Largura:",
20+
"height": "Altura:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Deletar imagem",

locales/ru-ru/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "Или добавить изображение по URL:",
1616
"autoCompletePlaceholder": "Выбрать или вставить ссылку на изображение",
1717
"alt": "Альтернативный заголовок:",
18-
"title": "Заголовок:"
18+
"title": "Заголовок:",
19+
"width": "Ширина:",
20+
"height": "Высота:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Удалить изображение",

locales/uk-ua/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "Або додайте зображення з URL посилання:",
1616
"autoCompletePlaceholder": "Виберіть або вставте джерело зображення",
1717
"alt": "Альтернативна назва:",
18-
"title": "Назва:"
18+
"title": "Назва:",
19+
"width": "Ширина:",
20+
"height": "Висота:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "Видалити зображення",

locales/zh-cn/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "或从网址新增图片:",
1616
"autoCompletePlaceholder": "选择或粘贴图片",
1717
"alt": "替代文本:",
18-
"title": "标题:"
18+
"title": "标题:",
19+
"width": "宽度:",
20+
"height": "高度:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "删除图片",

locales/zh-tw/translation.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"addViaUrlInstructions": "或從網址新增圖片:",
1616
"autoCompletePlaceholder": "選擇或貼上圖片網址",
1717
"alt": "替代文字:",
18-
"title": "標題:"
18+
"title": "標題:",
19+
"width": "寬度:",
20+
"height": "高度:"
1921
},
2022
"imageEditor": {
2123
"deleteImage": "刪除圖片",

src/examples/images.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,28 @@ export function ImageDialogButtonExample() {
242242
</>
243243
)
244244
}
245+
246+
export const ImageDimensionsExample: Story = () => {
247+
return (
248+
<>
249+
<MDXEditor
250+
markdown=""
251+
plugins={[
252+
imagePlugin({
253+
imageUploadHandler: async () => Promise.resolve('https://picsum.photos/200/300'),
254+
allowSetImageDimensions: true
255+
}),
256+
diffSourcePlugin(),
257+
toolbarPlugin({
258+
toolbarContents: () => (
259+
<DiffSourceToggleWrapper>
260+
<InsertImage />
261+
</DiffSourceToggleWrapper>
262+
)
263+
})
264+
]}
265+
onChange={console.log}
266+
/>
267+
</>
268+
)
269+
}

0 commit comments

Comments
 (0)