diff --git a/core/modules/widgets/browse.js b/core/modules/widgets/browse.js index ed57e4c33..de3c91fb8 100644 --- a/core/modules/widgets/browse.js +++ b/core/modules/widgets/browse.js @@ -46,6 +46,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) { if(this.nwsaveas) { domNode.setAttribute("nwsaveas",this.nwsaveas); } + if(this.accept) { + domNode.setAttribute("accept",this.accept); + } // Nw.js supports "webkitdirectory" and "nwdirectory" to allow a directory to be selected if(this.webkitdirectory) { domNode.setAttribute("webkitdirectory",this.webkitdirectory); @@ -83,6 +86,7 @@ BrowseWidget.prototype.execute = function() { this.param = this.getAttribute("param"); this.tooltip = this.getAttribute("tooltip"); this.nwsaveas = this.getAttribute("nwsaveas"); + this.accept = this.getAttribute("accept"); this.webkitdirectory = this.getAttribute("webkitdirectory"); this.nwdirectory = this.getAttribute("nwdirectory"); }; diff --git a/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid b/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid index 0f2544fb3..b241abeb1 100644 --- a/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/BrowseWidget.tid @@ -1,6 +1,6 @@ caption: browse created: 20131024141900000 -modified: 20170718142410367 +modified: 20200421221304177 tags: Widgets title: BrowseWidget type: text/vnd.tiddlywiki @@ -17,7 +17,9 @@ The content of the `<$browse>` widget is ignored. |multiple |Set to "multiple" to select multiple file upload | |deserializer |<<.from-version "5.1.15">> Optional name of deserializer to be used (by default the deserializer is derived from the file extension or type) | |tooltip |Optional tooltip text | -|message |Optional override of widget message to be generated. The parameter for the message will be the JavaScript object `event.target.files` | +|accepts |<<.from-version "5.1.23">> Optional comma delimited [[list of file accepted extensions|https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#Unique_file_type_specifiers]] and/or MIME types | +|message |Optional override of widget message to be generated. The files will be passed in the JavaScript object `event.target.files` | +|param |Optional parameter to be passed with the custom message | On iPhone/iPad choosing the multiple option will remove the ability to take photographs/videos directly into TiddlyWiki.