On Thursday, July 2, 2020 at 11:24:04 AM UTC-7, Eric Shulman wrote:
>
> I'm also working on an enhanced version where the buttons appear as a 
> "popup"
> only when the $edit-text control gets the input focus, but I'm still 
> debugging that
> version (there's a strange interaction between the focus and the popup 
> that I
> haven't yet figured out).
>

Here's the version that uses the focusPopup="..." method, so that the 
delete/cancel/ok buttons
only appear when you put the cursor into the input field:

\define inputpopup(fieldname)
<$vars
   temp="$:/temp/$(currentTiddler)$/$fieldname$"
   popup=<<qualify "$:/state/popup/$(currentTiddler)$/$fieldname$">>
   default={{{ [<currentTiddler>get[$fieldname$]] }}}
   placeholder="enter a value for $fieldname$">
<$keyboard key="enter" actions="""
   <$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" 
$value={{{ [<temp>get[text]] }}} />
   <$action-deletetiddler $filter="[<popup>] [<temp>]" />
""">
<$edit-text tag="input" tiddler=<<temp>> default=<<default>> placeholder=<<
placeholder>> focusPopup=<<popup>> class="tc-popup-handle"/>
</$keyboard>
<$reveal state=<<popup>> type="popup" text="" position="right" 
style="margin-left:0.25em;">
   <$button tooltip="delete field"> {{$:/core/images/delete-button}}
      <$action-deletefield $tiddler=<<currentTiddler>> $field="$fieldname$"
/>
      <$action-deletetiddler $filter="[<popup>] [<temp>]" />
   </$button>
   <$button tooltip="cancel input"> {{$:/core/images/cancel-button}}
      <$action-deletetiddler $filter="[<popup>] [<temp>]" />
   </$button>
   <$button tooltip="save input"> {{$:/core/images/done-button}}
      <$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" 
$value={{{ [<temp>get[text]] }}} />
      <$action-deletetiddler $filter="[<popup>] [<temp>]" />
   </$button>
</$reveal>
</$vars>
\end

Install it the same way as the previous version:
* copy the above code into a tiddler (e.g., 
"/TiddlyTools/Macros/inputpopup")
* tag that tiddler with "$:/tags/Macro"
* in any other tiddler, write:
<<inputpopup "foo">>

-e


 

>
> enjoy,
> -e
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e3ccc54d-de9c-46da-847d-8eead7c6cb57o%40googlegroups.com.

Reply via email to