modal window when delete a tiddler from tiddler view button

46 views
Skip to first unread message

Mohammad

unread,
Jul 11, 2019, 5:57:51 AM7/11/19
to TiddlyWiki
When you want to delete a tiddler via Tiddler view toolbar, delete button
a nice local (tm-modal) is appeared and says
 Do you wish to delete the tiddler "HelloThere"?

I want to know how I can duplicate this for other purpose!

I dont want to develop from scarctch and wish to use it for other purpose!

--Mohammad 

Watt

unread,
Jul 11, 2019, 10:53:23 AM7/11/19
to TiddlyWiki
I think there is a difference between ActionDeleteTiddlerWidget and tm-delete-tiddler. Only the latter generates a confirmation dialogue.

$:/core/ui/Buttons/delete uses tm-delete-tiddler.

The confirmation message is in
$:/language/ConfirmDeleteTiddler


Mohammad

unread,
Jul 11, 2019, 11:27:56 AM7/11/19
to TiddlyWiki
Thanks Watt!
I will take a look to see how TW implements it!

-- Mohammad

Jeremy Ruston

unread,
Jul 11, 2019, 11:41:13 AM7/11/19
to tiddl...@googlegroups.com
Hi Mohammad

That modal dialogue is a browser feature called “confirm()”:


It presents a simple text based dialogue to the user with optional “OK” and “cancel” buttons. It’s unusual amongst web DOM features in that it pauses execution of the script until the user responds.

Making it available as a generic wikitext feature is tricky, however. For example, we could make a “tm-confirm” message. The easy part is to give it a parameter containing the message to be displayed. For the users response, one could imagine a parameter specifying the name of a tiddler to receive the text “ok” or “cancel” according to the response of the user.

The gotcha is that that updated tiddler value wouldn’t be available to any further actions in an action string; they would have been compiled with the previous value of that tiddler.

Making a <$action-confirm> widget instead of a message doesn’t help, sadly.

On the bright side, some people people consider the Window.confirm() to be a bad idea because of the way that it blocks access to the rest of the page. The alternative is to construct a non-modal confirmation system — for example, the “delete” button in advanced search “Filter” tab.

Best wishes

Jeremy


--Mohammad 

--
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+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/9f618915-4e42-4e09-80f7-f3f3f00835f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohammad

unread,
Jul 11, 2019, 11:45:29 AM7/11/19
to TiddlyWiki
Watt!

I see the $:/core/ui/Buttons/delete uses tm-delete-tiddler

<$button message="tm-delete-tiddler" tooltip={{$:/language/Buttons/Delete/Hint}} aria-label={{$:/language/Buttons/Delete/Caption}} class=<<tv-config-toolbar-class>>>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/delete-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Delete/Caption}}/></span>
</$list>
</$button>


One expect to see a call to tm-modal message and don't find it!


On Thursday, July 11, 2019 at 7:23:23 PM UTC+4:30, Watt wrote:

Mohammad

unread,
Jul 11, 2019, 12:03:43 PM7/11/19
to TiddlyWiki
Many thanks Jeremy!

I tried to use this feature in my newly developed plugin Trashbin:https://kookma.github.io/TW-Trashbin/
but I decided to use the tm-notify!

For the other part e.g user interaction I use the same mechanism as you pointed out: the “delete” button in advanced search “Filter” tab.
I used this in "Empty Trashbin" button on the sidebar!


Thanks again!

Cheers
Mohammad


On Thursday, July 11, 2019 at 8:11:13 PM UTC+4:30, Jeremy Ruston wrote:
Hi Mohammad


When you want to delete a tiddler via Tiddler view toolbar, delete button
a nice local (tm-modal) is appeared and says
 Do you wish to delete the tiddler "HelloThere"?

I want to know how I can duplicate this for other purpose!

I dont want to develop from scarctch and wish to use it for other purpose!

That modal dialogue is a browser feature called “confirm()”:


It presents a simple text based dialogue to the user with optional “OK” and “cancel” buttons. It’s unusual amongst web DOM features in that it pauses execution of the script until the user responds.

Making it available as a generic wikitext feature is tricky, however. For example, we could make a “tm-confirm” message. The easy part is to give it a parameter containing the message to be displayed. For the users response, one could imagine a parameter specifying the name of a tiddler to receive the text “ok” or “cancel” according to the response of the user.

The gotcha is that that updated tiddler value wouldn’t be available to any further actions in an action string; they would have been compiled with the previous value of that tiddler.

Making a <$action-confirm> widget instead of a message doesn’t help, sadly.

On the bright side, some people people consider the Window.confirm() to be a bad idea because of the way that it blocks access to the rest of the page. The alternative is to construct a non-modal confirmation system — for example, the “delete” button in advanced search “Filter” tab.

Best wishes

Jeremy


--Mohammad 

--
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 tiddl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages