@@ -4,6 +4,7 @@ import {getComboMarkdownEditor, initComboMarkdownEditor} from './comp/ComboMarkd
4
4
import { createDropzone } from './dropzone.js' ;
5
5
import { GET , POST } from '../modules/fetch.js' ;
6
6
import { hideElem , showElem } from '../utils/dom.js' ;
7
+ import { isImageFile } from '../utils/image.js' ;
7
8
import { attachRefIssueContextPopup } from './contextpopup.js' ;
8
9
import { initCommentContent , initMarkupContent } from '../markup/content.js' ;
9
10
@@ -84,10 +85,12 @@ async function onEditContent(event) {
84
85
for ( const attachment of data ) {
85
86
const imgSrc = `${ dropzone . getAttribute ( 'data-link-url' ) } /${ attachment . uuid } ` ;
86
87
dz . emit ( 'addedfile' , attachment ) ;
87
- dz . emit ( 'thumbnail' , attachment , imgSrc ) ;
88
+ if ( isImageFile ( attachment . name ) ) {
89
+ dz . emit ( 'thumbnail' , attachment , imgSrc ) ;
90
+ dropzone . querySelector ( `img[src='${ imgSrc } ']` ) . style . maxWidth = '100%' ;
91
+ }
88
92
dz . emit ( 'complete' , attachment ) ;
89
93
fileUuidDict [ attachment . uuid ] = { submitted : true } ;
90
- dropzone . querySelector ( `img[src='${ imgSrc } ']` ) . style . maxWidth = '100%' ;
91
94
const input = document . createElement ( 'input' ) ;
92
95
input . id = attachment . uuid ;
93
96
input . name = 'files' ;
0 commit comments