Wilk Plugin Library

Thank you for sharing! I love the dictionary tiddler table; it makes things much more readable.

I felt a little guilty since your code is so elegant, but I tweaked the table template a bit for my own use and thought I’d share back in case anyone else is interested. The code below replaces $:/plugins/wilk/dictionary-table/template; it enables double-clicking on a value cell to edit it inline, enter to save back to the data tiddler, and esc to exit edit-mode without saving changes.

\procedure display(content)
<$button
	class="tc-btn-invisible"
	message="tm-copy-to-clipboard"
	param=<<content>>
	tooltip="Copy" >
		<$text text=<<content>> />
		{{$:/core/images/copy-clipboard|1em}}
</$button>
\end

\procedure edit() <$action-createtiddler $basetitle=<<dom-temp>> />
\procedure cancel() <$action-deletetiddler $tiddler=<<temp>> />
\procedure save()
<$action-setfield $tiddler=<<currentTiddler>> $index=<<index>> $value={{{ [<temp>get[text]] ~[<value>] }}} />
<<cancel>>
\end

<$eventcatcher selector=".index" $dblclick=<<edit>> tag="div">
<table class="wilk-dictionary-table">
<$list filter="[<currentTiddler>indexes[]sort[]]" variable="index">
	<tr>
		<td>
			<$transclude $variable="display" content=<<index>> />
		</td>
		<$let
			temp=`$:/temp/volatile/$(currentTiddler)$/$(index)$`
			value={{{ [<currentTiddler>getindex<index>] }}}
		>
		<td class="index" temp=<<temp>>>
			<% if [<temp>is[tiddler]] %>
				<$keyboard key="enter" actions=<<save>>>
				<$keyboard key="escape" actions=<<cancel>>>
					<$edit-text tiddler=<<temp>> tag=input class="tc-max-width" default=<<value>> />
				</$keyboard>
				</$keyboard>
			<% else %>
				<$transclude $variable="display" content=<<value>> />
			<% endif %>
		</td>
		</$let>
	</tr>
</$list>
</table>
</$eventcatcher>
5 Likes