diff --git a/core/modules/widgets/action-deletefield.js b/core/modules/widgets/action-deletefield.js index 0669e97d4..ad05c331c 100644 --- a/core/modules/widgets/action-deletefield.js +++ b/core/modules/widgets/action-deletefield.js @@ -36,6 +36,7 @@ Compute the internal state of the widget */ DeleteFieldWidget.prototype.execute = function() { this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler")); + this.actionField = this.getAttribute("$field"); }; /* @@ -57,6 +58,9 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { var self = this, tiddler = this.wiki.getTiddler(self.actionTiddler), removeFields = {}; + if(this.actionField) { + removeFields[this.actionField] = undefined; + } if(tiddler) { $tw.utils.each(this.attributes,function(attribute,name) { if(name.charAt(0) !== "$" && name !== "title") { diff --git a/core/ui/EditTemplate/fields.tid b/core/ui/EditTemplate/fields.tid index 2a4e21a58..0cc0b1189 100644 --- a/core/ui/EditTemplate/fields.tid +++ b/core/ui/EditTemplate/fields.tid @@ -8,7 +8,6 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$ \define config-filter() [[hide]] -[title{$(config-title)$}] \end -<$fieldmangler>
-<$button message="tm-remove-field" param=< |
$list>
@@ -49,5 +51,3 @@ $:/config/EditTemplateFields/Visibility/$(currentField)$
$button>
-
-$fieldmangler>
diff --git a/editions/prerelease/tiddlers/ActionDeleteFieldWidget.tid b/editions/prerelease/tiddlers/ActionDeleteFieldWidget.tid
index d01703131..d0b1a8f05 100644
--- a/editions/prerelease/tiddlers/ActionDeleteFieldWidget.tid
+++ b/editions/prerelease/tiddlers/ActionDeleteFieldWidget.tid
@@ -15,6 +15,7 @@ The ''action-deletefield'' widget is invisible. Any content within it is ignored
|!Attribute |!Description |
|$tiddler |The title of the tiddler whose fields are to be modified (if not provided defaults to the [[WidgetVariable: currentTiddler]] |
+|$field |Optional name of a field to delete |
|//{any attributes not starting with $}// |Each attribute name specifies a field to be deleted. The attribute value is ignored and need not be specified |
! Examples
@@ -34,3 +35,11 @@ src='<$button>
<$action-deletefield $tiddler="HelloThere" modified tags/>
Delete "modified" and "tags" from ~HelloThere
$button>'/>
+
+Here is an example of a button that uses the optional $field attribute to delete the text field of the tiddler HelloThere:
+
+<$macrocall $name='wikitext-example-without-html'
+src='<$button>
+<$action-deletefield $tiddler="HelloThere" $field="text"/>
+Delete text from ~HelloThere
+$button>'/>