1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Add tooltip to browse widget

Fixes #1179
This commit is contained in:
Jermolene 2014-12-02 19:16:38 +00:00
parent 85217112ad
commit 5154a25ab9
3 changed files with 36 additions and 1 deletions

View File

@ -39,6 +39,9 @@ BrowseWidget.prototype.render = function(parent,nextSibling) {
if(this.browseMultiple) { if(this.browseMultiple) {
domNode.setAttribute("multiple","multiple"); domNode.setAttribute("multiple","multiple");
} }
if(this.tooltip) {
domNode.setAttribute("title",this.tooltip);
}
// Add a click event handler // Add a click event handler
domNode.addEventListener("change",function (event) { domNode.addEventListener("change",function (event) {
if(self.message) { if(self.message) {
@ -62,6 +65,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.message = this.getAttribute("message"); this.message = this.getAttribute("message");
this.tooltip = this.getAttribute("tooltip");
}; };
/* /*

View File

@ -12,5 +12,5 @@ description: {{$:/language/Buttons/Import/Hint}}
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Import/Caption}}/></span> <span class="tc-btn-text"><$text text={{$:/language/Buttons/Import/Caption}}/></span>
</$list> </$list>
</$button> </$button>
<$browse/> <$browse title={{$:/language/Buttons/Import/Hint}}/>
</div> </div>

View File

@ -0,0 +1,31 @@
title: BrowseWidget
created: 201310241419
modified: 20141202155353547
tags: Widgets
caption: browse
! Introduction
The browse widget displays an HTML file browser button that allows the user to choose one or more files to import. It sends a [[WidgetMessage: tm-import-tiddlers]] carrying a JSON representation of the tiddlers imported from the files up through its parents. This message usually trapped by the NavigatorWidget which adds the tiddlers to the store and updates the story to display them.
! Content and Attributes
The content of the `<$browse>` widget is ignored.
|!Attribute |!Description |
|multiple |Set to "multiple" to select multiple file upload |
|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` |
On iPhone/iPad choosing the multiple option will remove the ability to take photographs/videos directly into TiddlyWiki.
''e.g.''
```
<$browse>
```
renders as:
<$browse>