TiddlyWiki5/core/wiki/macros/image-picker.tid

40 lines
1.6 KiB
Plaintext

created: 20170715180840889
modified: 20170715180914005
tags: $:/tags/Macro
title: $:/core/macros/image-picker
type: text/vnd.tiddlywiki
\define image-picker-thumbnail(actions)
<$button tag="a" tooltip="""$(imageTitle)$"""><$transclude $variable="__actions__"/><$transclude tiddler=<<imageTitle>>/></$button>
\end
\define image-picker-list(filter,actions)
\whitespace trim
<$list filter="""$filter$""" variable="imageTitle">
<$macrocall $name="image-picker-thumbnail" actions=<<__actions__>>/>
&#32;
</$list>
\end
\define 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">
<$vars state-system=<<qualify "$:/state/image-picker/system">>>
<$checkbox tiddler=<<state-system>> field="text" checked="show" unchecked="hide" default="hide">
&#32;
{{$:/language/SystemTiddlers/Include/Prompt}}
</$checkbox>
<$reveal state=<<state-system>> type="match" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$ +[!is[system]]""" actions=<<__actions__>>/>
</$reveal>
<$reveal state=<<state-system>> type="nomatch" text="hide" default="hide" tag="div">
<$macrocall $name="image-picker-list" filter="""$filter$""" actions=<<__actions__>>/>
</$reveal>
</$vars>
</div>
\end
\define image-picker-include-tagged-images(actions)
<$macrocall $name="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