1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 10:00:34 +00:00
TiddlyWiki5/core/wiki/macros/image-picker.tid
Leilei332 2801eee905
Migrate some old macros to new syntax (#8768)
* Migrate some old macros to new syntax

* Rewrite more macros.

* Update image-picker

* Rewrite tabs macro

* Use more new syntax

* Revert thumbnail macro

* Avoid duplicated whitespace pragma

* Revert tabs macro
2024-12-05 12:40:13 +00:00

37 lines
1.6 KiB
Plaintext

tags: $:/tags/Macro
title: $:/core/macros/image-picker
type: text/vnd.tiddlywiki
\procedure image-picker-thumbnail(actions)
<$button tag="a" tooltip=<<imageTitle>>><$transclude $variable="actions"/><$transclude tiddler=<<imageTitle>>/></$button>
\end
\procedure image-picker-list(filter,actions)
\whitespace trim
<$list filter=<<filter>> variable="imageTitle">
<$transclude $variable="image-picker-thumbnail" actions=<<actions>>/>
&#32;
</$list>
\end
\procedure image-picker(actions,filter:"[all[shadows+tiddlers]is[image]] -[type[application/pdf]] +[!has[draft.of]$subfilter$sort[title]]",subfilter:"")
\whitespace trim
<div class="tc-image-chooser">
<$let state-system=<<qualify "$:/state/image-picker/system">> tv-filter={{{ [<filter>search-replace[$subfilter$],<subfilter>] }}}>
<$checkbox tiddler=<<state-system>> field="text" checked="show" unchecked="hide" default="hide">
<span class="tc-tiny-gap-left">{{$:/language/SystemTiddlers/Include/Prompt}}</span>
</$checkbox>
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
<$transclude $variable="image-picker-list" filter=`$(tv-filter)$ +[!is[system]]` actions=<<actions>>/>
</$reveal>
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
<$transclude $variable="image-picker-list" filter=<<tv-filter>> actions=<<actions>>/>
</$reveal>
</$let>
</div>
\end
\procedure image-picker-include-tagged-images(actions)
<$transclude $variable="image-picker" filter="[all[shadows+tiddlers]is[image]] [all[shadows+tiddlers]tag[$:/tags/Image]] -[type[application/pdf]] +[!has[draft.of]sort[title]]" actions=<<actions>>/>
\end