mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-10-02 00:40:47 +00:00
Fixes to action-deletetiddler widget
This commit is contained in:
parent
23ca729805
commit
8c67e11365
@ -35,8 +35,8 @@ DeleteTiddlerWidget.prototype.render = function(parent,nextSibling) {
|
|||||||
Compute the internal state of the widget
|
Compute the internal state of the widget
|
||||||
*/
|
*/
|
||||||
DeleteTiddlerWidget.prototype.execute = function() {
|
DeleteTiddlerWidget.prototype.execute = function() {
|
||||||
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
this.actionFilter = this.getAttribute("$filter");
|
||||||
this.actionConfirm = this.getAttribute("$confirm");
|
this.actionTiddler = this.getAttribute("$tiddler");
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,7 +44,7 @@ Refresh the widget by ensuring our attributes are up to date
|
|||||||
*/
|
*/
|
||||||
DeleteTiddlerWidget.prototype.refresh = function(changedTiddlers) {
|
DeleteTiddlerWidget.prototype.refresh = function(changedTiddlers) {
|
||||||
var changedAttributes = this.computeAttributes();
|
var changedAttributes = this.computeAttributes();
|
||||||
if(changedAttributes["$tiddler"] || changedAttributes["$confirm"]) {
|
if(changedAttributes["$filter"] || changedAttributes["$tiddler"]) {
|
||||||
this.refreshSelf();
|
this.refreshSelf();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -55,8 +55,16 @@ DeleteTiddlerWidget.prototype.refresh = function(changedTiddlers) {
|
|||||||
Invoke the action associated with this widget
|
Invoke the action associated with this widget
|
||||||
*/
|
*/
|
||||||
DeleteTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
DeleteTiddlerWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||||
|
var tiddlers;
|
||||||
this.wiki.setText(this.actionTiddler,this.actionField,this.actionIndex,this.actionValue);
|
if(this.actionFilter) {
|
||||||
|
tiddlers = this.wiki.filterTiddlers(this.actionFilter,this);
|
||||||
|
}
|
||||||
|
if(this.actionTiddler) {
|
||||||
|
tiddlers.push(this.actionTiddler);
|
||||||
|
}
|
||||||
|
for(var t=0; t<tiddlers.length; t++) {
|
||||||
|
this.wiki.deleteTiddler(tiddlers[t]);
|
||||||
|
}
|
||||||
return true; // Action was invoked
|
return true; // Action was invoked
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ type: text/vnd.tiddlywiki
|
|||||||
|
|
||||||
! Introduction
|
! Introduction
|
||||||
|
|
||||||
The ''action-deletetiddler'' widget is an [[action widget|ActionWidgets]] that deletes a tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget.
|
The ''action-deletetiddler'' widget is an [[action widget|ActionWidgets]] that deletes tiddlers. ActionWidgets are used within triggering widgets such as the ButtonWidget.
|
||||||
|
|
||||||
There are several differences compared to the [[WidgetMessage: tm-delete-tiddler]]:
|
There are several differences compared to the [[WidgetMessage: tm-delete-tiddler]]:
|
||||||
|
|
||||||
@ -20,7 +20,8 @@ There are several differences compared to the [[WidgetMessage: tm-delete-tiddler
|
|||||||
The ''action-deletetiddler'' widget is invisible. Any content within it is ignored.
|
The ''action-deletetiddler'' widget is invisible. Any content within it is ignored.
|
||||||
|
|
||||||
|!Attribute |!Description |
|
|!Attribute |!Description |
|
||||||
|$tiddler |The title of the tiddler to be deleted (if not provided defaults to the [[WidgetVariable: currentTiddler]] |
|
|$tiddler |Optional title of the tiddler to be deleted |
|
||||||
|
|$filter |Optional filter identifying tiddlers to be deleted |
|
||||||
|
|
||||||
! Examples
|
! Examples
|
||||||
|
|
||||||
@ -29,5 +30,5 @@ Here is an example of a button that deletes the tiddler HelloThere. Note:
|
|||||||
<$macrocall $name='wikitext-example-without-html'
|
<$macrocall $name='wikitext-example-without-html'
|
||||||
src='<$button>
|
src='<$button>
|
||||||
<$action-deletetiddler $tiddler="HelloThere"/>
|
<$action-deletetiddler $tiddler="HelloThere"/>
|
||||||
Go to Control Panel "Appearance" tab
|
Delete "HelloThere"
|
||||||
</$button>'/>
|
</$button>'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user