diff --git a/.gitignore b/.gitignore index 9ad4f258e..09da4d46b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store yarn-error.log package-lock.json /dist diff --git a/src/trix/config/input.js b/src/trix/config/input.js index dadc163a1..f632d5b8a 100644 --- a/src/trix/config/input.js +++ b/src/trix/config/input.js @@ -3,6 +3,8 @@ import { makeElement, removeNode } from "trix/core/helpers/dom" const input = { level2Enabled: true, + fileInputId: `trix-file-input-${Date.now().toString(16)}`, + acceptedFileTypes: "*", getLevel() { if (this.level2Enabled && browser.supportsInputEvents) { @@ -12,7 +14,7 @@ const input = { } }, pickFiles(callback) { - const input = makeElement("input", { type: "file", multiple: true, hidden: true, id: this.fileInputId }) + const input = makeElement("input", { type: "file", multiple: true, hidden: true, id: this.fileInputId, accept: this.acceptedFileTypes }) input.addEventListener("change", () => { callback(input.files)