nodebb-plugin-composer-quill
nodebb-plugin-composer-quill copied to clipboard
Upload picture accept types
Hi @julianlam
Please consider adding accept to the file input:
- In formatting.js (composer) add picture: function() as follows:
var formattingDispatchTable = {
picture: function () {
var postContainer = this;
postContainer.find('#pictures').click();
},
upload: function () {
var postContainer = this;
postContainer.find('#files').click();
},
- In composer.tpl (that I copied from redactor ;) ) add input with id=pictures:
<form id="fileForm" method="post" enctype="multipart/form-data">
<!--[if gte IE 9]><!-->
<input type="file" id="files" name="files[]" multiple class="gte-ie9 hide"/>
<input type="file" id="pictures" accept="image/*, video/*" name="files[]" multiple class="gte-ie9 hide"/>
<!--<![endif]-->
<!--[if lt IE 9]>
<input type="file" id="files" name="files[]" class="lt-ie9 hide" value="Upload"/>
<input type="file" id="pictures" accept="image/*, video/*" name="files[]" class="lt-ie9 hide" value="Upload"/>
<![endif]-->
</form>
A better way is to use the ACP defined mime types for files and pictures, but I have not been able to find such field in config. Thanks!