1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Add a subfilter parameter to image-picker macro (#2391)

* Documentation and examples
* Fix the tag of image- and colour-picker macros in documentation
This commit is contained in:
Evolena 2016-04-24 14:27:32 +02:00 committed by Jeremy Ruston
parent fe63694a20
commit 2b1d38d3ca
5 changed files with 32 additions and 5 deletions

View File

@ -11,10 +11,10 @@ $actions$
</$button>
\end
\define image-picker(actions)
\define image-picker(actions,subfilter:"")
<div class="tc-image-chooser">
<$list filter="[all[shadows+tiddlers]is[image]!has[draft.of]] -[type[application/pdf]] +[sort[title]]" variable="imageTitle">
<$list filter="[all[shadows+tiddlers]is[image]$subfilter$!has[draft.of]] -[type[application/pdf]] +[sort[title]]" variable="imageTitle">
<$macrocall $name="image-picker-inner" actions="""$actions$"""/>

View File

@ -1,6 +1,6 @@
created: 20160418152735536
modified: 20160418155324847
tags: [[changecount Macro]] [[Macro Examples]]
tags: [[colour-picker Macro]] [[Macro Examples]]
title: colour-picker Macro (Examples)
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,17 @@
created: 20160418155523369
modified: 20160418155913663
tags:
title: image-picker Macro (Example 2)
type: text/vnd.tiddlywiki
Image: <$edit-text tiddler='$:/_MyImage' tag='input' placeholder='(unset)' default=''/>
<$transclude tiddler={{$:/_MyImage}}/>
---
<$macrocall $name='image-picker' actions="
<$action-setfield $tiddler='$:/_MyImage' $value=<<imageTitle>>/>
" subfilter="prefix[Language]"/>

View File

@ -1,7 +1,11 @@
created: 20160418155539132
modified: 20160418155621890
tags: [[changecount Macro]] [[Macro Examples]]
tags: [[image-picker Macro]] [[Macro Examples]]
title: image-picker Macro (Examples)
type: text/vnd.tiddlywiki
<$macrocall $name=".example" n="1" eg={{image-picker Macro (Example 1)}}/>
This next example shows how the <<.param subfilter>> parameter limits the list of images (here to those with the "Language" prefix):
<$macrocall $name=".example" n="2" eg="{{image-picker Macro (Example 2)}}/>

View File

@ -1,4 +1,4 @@
caption: colour-picker
caption: image-picker
created: 20160418155531395
modified: 20160418155805435
tags: Macros [[Core Macros]]
@ -11,5 +11,11 @@ The <<.def image-picker>> [[macro|Macros]] displays an interactive image picker,
;actions
: Wikitext for the action widgets that should be executed when the user selects an image. Within the text, the variable `imageTitle` contains the title of the tiddler containing the selected image.
;subfilter
: An optional extra [[filter step|Filter Step]], e.g. `tag[MyTag]`
The images are selected by means of a [[filter expression|Filter Expression]], into which the <<.param subfilter>> parameter is spliced as follows:
> `[all[shadows+tiddlers]is[image]$subfilter$!has[draft.of]] -[type[application/pdf]] +[sort[title]]`
<<.macro-examples "image-picker">>