Skip to content

Commit

Permalink
Add "multiple" attribute to browse widget
Browse files Browse the repository at this point in the history
And default to non-multiple upload; that’s enough to enable the ability
to take photos/videos directly on iOS
  • Loading branch information
Jermolene committed Sep 10, 2014
1 parent 50be852 commit ccd916c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/modules/widgets/browse.js
Expand Up @@ -36,7 +36,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
// Create element
var domNode = this.document.createElement("input");
domNode.setAttribute("type","file");
domNode.setAttribute("multiple","multiple");
if(this.browseMultiple) {
domNode.setAttribute("multiple","multiple");
}
// Add a click event handler
domNode.addEventListener("change",function (event) {
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
Expand All @@ -54,6 +56,7 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
Compute the internal state of the widget
*/
BrowseWidget.prototype.execute = function() {
this.browseMultiple = this.getAttribute("multiple");
};

/*
Expand Down
9 changes: 7 additions & 2 deletions editions/tw5.com/tiddlers/widgets/BrowseWidget.tid
@@ -1,6 +1,6 @@
title: BrowseWidget
created: 201310241419
modified: 201310300837
modified: 20140910200751303
tags: widget

! Introduction
Expand All @@ -9,4 +9,9 @@ The browse widget displays an HTML file browser button that allows the user to c

! Content and Attributes

The browse widget has no attributes, and ignores any contained content.
The content of the `<$browse>` widget is ignored.

|!Attribute |!Description |
|multiple |Set to "multiple" to select multiple file upload |

On iPhone/iPad choosing the multiple option will remove the ability to take photographs/videos directly into TiddlyWiki.

0 comments on commit ccd916c

Please sign in to comment.