mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-26 11:37:20 +00:00
Extend browse widget with deserializer attribute
Along the same lines as 596dfa1d50
This commit is contained in:
parent
0d0b841b5c
commit
a4d919f45c
@ -55,8 +55,11 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
if(self.message) {
|
if(self.message) {
|
||||||
self.dispatchEvent({type: self.message, param: self.param, files: event.target.files});
|
self.dispatchEvent({type: self.message, param: self.param, files: event.target.files});
|
||||||
} else {
|
} else {
|
||||||
self.wiki.readFiles(event.target.files,function(tiddlerFieldsArray) {
|
self.wiki.readFiles(event.target.files,{
|
||||||
|
callback: function(tiddlerFieldsArray) {
|
||||||
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
self.dispatchEvent({type: "tm-import-tiddlers", param: JSON.stringify(tiddlerFieldsArray)});
|
||||||
|
},
|
||||||
|
deserializer: self.deserializer
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -72,6 +75,7 @@ Compute the internal state of the widget
|
|||||||
*/
|
*/
|
||||||
BrowseWidget.prototype.execute = function() {
|
BrowseWidget.prototype.execute = function() {
|
||||||
this.browseMultiple = this.getAttribute("multiple");
|
this.browseMultiple = this.getAttribute("multiple");
|
||||||
|
this.deserializer = this.getAttribute("deserializer");
|
||||||
this.message = this.getAttribute("message");
|
this.message = this.getAttribute("message");
|
||||||
this.param = this.getAttribute("param");
|
this.param = this.getAttribute("param");
|
||||||
this.tooltip = this.getAttribute("tooltip");
|
this.tooltip = this.getAttribute("tooltip");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
caption: browse
|
caption: browse
|
||||||
created: 20131024141900000
|
created: 20131024141900000
|
||||||
modified: 20170328173406681
|
modified: 20170718142410367
|
||||||
tags: Widgets
|
tags: Widgets
|
||||||
title: BrowseWidget
|
title: BrowseWidget
|
||||||
type: text/vnd.tiddlywiki
|
type: text/vnd.tiddlywiki
|
||||||
@ -15,6 +15,7 @@ The content of the `<$browse>` widget is ignored.
|
|||||||
|
|
||||||
|!Attribute |!Description |
|
|!Attribute |!Description |
|
||||||
|multiple |Set to "multiple" to select multiple file upload |
|
|multiple |Set to "multiple" to select multiple file upload |
|
||||||
|
|deserializer |Optional name of deserializer to be used (by default the deserializer is derived from the file extension or type) |
|
||||||
|tooltip |Optional tooltip text |
|
|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` |
|
|message |Optional override of widget message to be generated. The parameter for the message will be the JavaScript object `event.target.files` |
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user