1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

adding a message attribute to the browse widget

* extend browse widget with a message attribute. If blank then import as
original. Otherwise, dispatch the given message with selected files
This commit is contained in:
Eucaly 2014-10-20 21:57:15 +08:00
parent 159a310bab
commit 0bbd5eb292

View File

@ -41,10 +41,15 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
}
// Add a click event handler
domNode.addEventListener("change",function (event) {
if (self.message) {
self.dispatchEvent({type: self.message, param: event.target.files});
return false;
} else {
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
});
return false;
}
},false);
// Insert element
parent.insertBefore(domNode,nextSibling);
@ -57,6 +62,7 @@ Compute the internal state of the widget
*/
BrowseWidget.prototype.execute = function() {
this.browseMultiple = this.getAttribute("multiple");
this.message = this.getAttribute("message");
};
/*