Reputation: 407
Html element "input" has very useful attribute "accept" (Example).
When I am uploading image with CKEditor, I can not use this attribute (Example), but I want to. How is it possible?
Upvotes: 0
Views: 698
Reputation: 41
I'm a bit late to the game and this question is very ambiguous, but as I understand it you are trying to upload and image (I am assuming) using CKEditor's built in Image plugin an add the "accept" attribute to the file input. Though this may not be the most elegant way to achieve the result it does successfully default to "Image Files".
In image.js you can add an onClick event to the file element on the upload tab. In the onClick you have access to the input element via this.getInputElement(). there you can set accept to whichever type you would like to default to. Here is the code for the element from the standard plugin after the addition of the onClick:
{
type: 'file',
id: 'upload',
label: editor.lang.image.btnUpload,
style: 'height:40px',
size: 38,
onClick: function () {
var input = this.getInputElement();
input.$.accept = 'image/*';
}
}
I believe this will get you what you are looking for that is if all of my assumptions about your question are correct.
Upvotes: 3