nodebb-plugin-composer-quill icon indicating copy to clipboard operation
nodebb-plugin-composer-quill copied to clipboard

Upload picture accept types

Open PostMidnight opened this issue 6 years ago • 0 comments

Hi @julianlam

Please consider adding accept to the file input:

  1. 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();
		},
  1. 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!

PostMidnight avatar Jul 26 '19 16:07 PostMidnight