1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-14 05:44:50 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid
Rob Hoelz e9aa3c6c93
Add $timestamp argument for <$action-deletefield> widget (#8115)
* Start on some tests for <$action-deletefield />

* Only update modified field if we actually delete a field

…in the <$action-deletefield /> widget.

Fixes a bug where <$action-deletefield foo /> would update the modified field
if the "foo" field wasn't present on a tiddler.

* action-deletefield: Test when modified does and doesn't exist

* Add $timestamp argument to action-deletefield

To make it more consistent with other tiddler-manipulating action widgets

* Add docs for action-deletefield $timestamp
2024-04-04 16:03:15 +01:00

47 lines
1.9 KiB
Plaintext

caption: action-deletefield
created: 20141025120850184
modified: 20150220162042000
tags: Widgets ActionWidgets
title: ActionDeleteFieldWidget
type: text/vnd.tiddlywiki
! Introduction
The ''action-deletefield'' widget is an [[action widget|ActionWidgets]] that deletes specified fields of a tiddler. ActionWidgets are used within triggering widgets such as the ButtonWidget.
! Content and Attributes
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 [[current tiddler|Current Tiddler]]) |
|$field |Optional name of a field to delete |
|$timestamp |<<.from-version "5.3.4">> Specifies whether the timestamp(s) of the target tiddler will be updated (''modified'' and ''modifier'', plus ''created'' and ''creator'' for newly created tiddlers). Can be "yes" (the default) or "no" |
|//{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
Here is an example of a button that deletes the caption and tags fields of the current tiddler:
<$macrocall $name='wikitext-example-without-html'
src='<$button>
<$action-deletefield caption tags/>
Delete "caption" and "tags"
</$button>'/>
Here is an example of a button that deletes the modified date and tags fields of the tiddler HelloThere:
<$macrocall $name='wikitext-example-without-html'
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>'/>