NodeBB / NodeBB/nodebb-plugin-composer-quill

Upload picture accept types

Open
#67 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
19
Forks
14
Avg merge
1m
Merged PRs (30d)
8

Description

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!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with formatting.js and composer.tpl, focusing on the formatting dispatch table and the existing #files input shown in the issue. Compare the requested picture entry and input behavior with the current composer implementation. Done means picture uploads have their own input accepting image and video types without changing the existing file-upload path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.