Quickly copy image macro/wikitext into clipboard to reuse

Images are inserted into my TW with macro image-basic, e.g.

<<image-basic "https://tiddlywiki.com/favicon.ico" caption:"" width:"95%" align:"center">>

However, my TW have thousands of images with timestamp as filenames. It is not possible to find an image through file name.

In each time I want to reuse an image, I have to edit the old tiddler, find the target wikitext, copy to clipboard and finally paste into new tiddler. It is time consuming and error prone if I have multiple images in a tiddler.

It would be more efficient if there is a context menu or a button around image to copy underline wikitext of an image into clipboard.

I have a look at the context menu plugin (Tiddler Context Menu Plugin). Not sure how to implement it.

Thanks for any suggestions.

If you would give your images a caption it would be possible to search for that caption.

Just a thought. Can you link to the <<image-basic macro, there may be more parameters that could be used to create a valid search.

-m

@pmario Thanks. I might rewrite macro image-basic to generate a copy to clipboard button.

Learning from wikitext-example macro in Utility Plugin (Utility 3.0.1 — utility kit for authors and developers), a new macro wikitext-clipboard is developed to copy any wikitext into clipboard including original call of wikitext-clipboard.

\function macro-prefix() '<<wikitext-clipboard src:"""'

\function macro-suffix() '""">>'

\function clipboard-macro() [<macro-prefix>] [<src>]  [<macro-suffix>] +[join[]]

\procedure wikitext-clipboard(src)
<div>
    <$transclude $variable="src" $mode="block"/>
    <$transclude $variable="copy-to-clipboard-above-right" src=<<clipboard-macro>>/>
</div>
\end

Usage

<<wikitext-clipboard src:"""<<image-basic "https://avatars.githubusercontent.com/u/79505" align:"center">>""">>

Render as

image

$__bangyou_procedure_wikitext-clipboard.json (648 Bytes)