mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-22 23:16:53 +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:
parent
159a310bab
commit
0bbd5eb292
@ -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");
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user