Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
30
rated 0 times [  33] [ 3]  / answers: 1 / hits: 31594  / 9 Years ago, mon, november 9, 2015, 12:00:00

Is there any way to completely disable uploading of images in Summernote, but keep the image url input? The closest thing I found was the disableDragAndDrop: true option, but this doesn't remove the upload button from the image pop-up


More From » jquery

 Answers
129

There's probably a better way to accomplish what you're going for... but a very simple solution that comes to mind is to just add this to your stylesheets:



.note-group-select-from-files {
display: none;
}


It works perfectly to leave just the image url input, and accomplishes what you're going for unless someone were to inspect element and discover that the upload element still exists with display none:



enter






Edit :
I took a look at the Summernote source code, and it looks like the above solution is actually a good way to go. There's currently no api to disable just the file upload button, let alone do so while leaving the img url input intact. You could always add it and open a pull request, of course.



https://github.com/summernote/summernote/blob/4b1bf144862a88899a464ddfab6bc0593a061fbc/src/js/bs3/module/ImageDialog.js#L24



  var body = '<div class=form-group note-group-select-from-files>' +
'<label>' + lang.image.selectFromFiles + '</label>' +
'<input class=note-image-input form-control type=file name=files accept=image/* multiple=multiple />' +
imageLimitation +
'</div>' +
'<div class=form-group style=overflow:auto;>' +
'<label>' + lang.image.url + '</label>' +
'<input class=note-image-url form-control col-md-12 type=text />' +
'</div>';

[#64460] Friday, November 6, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
terrances

Total Points: 184
Total Questions: 100
Total Answers: 92

Location: Tokelau
Member since Sun, May 7, 2023
1 Year ago
;