[tw5] Re: Delete confirmation for blank tiddlers

2020-08-20 Thread Eric Shulman
On Thursday, August 20, 2020 at 5:15:09 AM UTC-7, kebi wrote:
>
> Thanks Tony and Eric for your analyses, in 
> *$:/core/modules/widgets/navigator.js* I tried removing the following 
> condition
> || (tiddler.fields.text || "")
> and now it always asks before deletion.
>

Hmm... I think that conditional is needed if you are creating a new tiddler 
and type something into the text field, and then press the delete button 
from the editor toolbar.  In that situation, the tiddler doesn't exist yet, 
but the tiddler.fields.text value is not blank, so it should ask before 
discarding the input.  I suggest checking the above interaction and see if 
it still asks.

In any case, modifying this central TWCore tiddler is ill-advised, since it 
can interfere with upgrading later on.  Reporting an issue on github is the 
right course of action, so Jeremy can take a look and possibly find a 
better fix.

-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/4088ced9-560a-43a1-a437-1aa906a630c4o%40googlegroups.com.


[tw5] Re: Delete confirmation for blank tiddlers

2020-08-20 Thread kebi
Thanks Tony and Eric for your analyses, in 
*$:/core/modules/widgets/navigator.js* I tried removing the following 
condition
|| (tiddler.fields.text || "")

and now it always asks before deletion.
The code that I removed was an "or" condition so it should have worked 
without changing the code, that's strange.

- kebi

-- 
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/7102a4bc-c0e7-42a5-b1a9-373140083142o%40googlegroups.com.


[tw5] Re: Delete confirmation for blank tiddlers

2020-08-20 Thread Eric Shulman
On Wednesday, August 19, 2020 at 10:42:25 PM UTC-7, TW Tones wrote:
>
>
>- A Quick look at the delete tiddler button $:/core/ui/Buttons/delete 
>shows it uses the button message="tm-delete-tiddler 
>"
>
> The processing for the tm-delete-tiddler message is defined here: 
*$:/core/modules/widgets/navigator.js*,
which sets up an event listener that triggers: *handleDeleteTiddlerEvent*

Examining this function, we find the following lines of code:

if((this.wiki.getTiddler(originalTitle) || (tiddler.fields.text || "") !== 
"")
 && !confirm($tw.language.getString("ConfirmDeleteTiddler",{variables:{title
: confirmationTitle}}))) {
 return false;
 }

This code checks to see if getTiddler() returns a non-null value (i.e., the 
tiddler exists) or if the current text field is not blank (i.e., text has 
been entered while editing). If either of these conditions is true, then it 
prompts for confirmation.  If you press "cancel", then the code skips the 
delete action (return false).  If you press "ok", the code continues on to 
perform the deletion.

>From the above, it appears that it *should* be asking to confirm since the 
tiddler does exist.
However, it seems that this is not what is actually happening.
I don't see where the logic is broken, but this is where it occurs.

-e


 

>
>- There is no mention of this behaviour and no parameters to override 
>it.
>- Only changing the text stops this behaviour, adding a tag or field 
>with a value does not cause the are you sure warning.
>
> It can be quite common to create tiddlers accidentally and want to simply 
> delete them, so I am not surprised at this behaviour. When it is only a 
> tiddler with a title then all that is deleted is the title, if there is any 
> content what so ever, you may not be able to see it eg; fields, then it 
> should trigger the confirmation (in my view).
>
> Perhaps you can submit and *issue* on github for a setting to be provided 
> in the control panel settings to change this behaviour?
>
> In the mean time perhaps you could consider either modifying the tiddler, 
> even just add space to the text. Another way to do this is to make your own 
> "new tiddler button" and modify it to set the text to " " space only, and 
> hide the existing one. However new here and other will not be affected?
>
> *Good catch*
>
> Regards
> Tones
>
> On Thursday, 20 August 2020 12:22:07 UTC+10, kebi wrote:
>>
>> Thanks Eric for your testing.
>> The delete button I'm talking about is not the one inside the edit 
>> tiddler view, but the one in the view toolbar ($:/core/ui/Buttons/delete)
>>
>> - kebi
>>
>

-- 
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/7ca1f680-c563-492a-98d2-e897170f60b8o%40googlegroups.com.


[tw5] Re: Delete confirmation for blank tiddlers

2020-08-19 Thread TW Tones
Kebi,

I agree this is what happens if you create a tiddler, with only its title.

   - A Quick look at the delete tiddler button $:/core/ui/Buttons/delete 
   shows it uses the button message="tm-delete-tiddler 
   "
   - There is no mention of this behaviour and no parameters to override it.
   - Only changing the text stops this behaviour, adding a tag or field 
   with a value does not cause the are you sure warning.

It can be quite common to create tiddlers accidentally and want to simply 
delete them, so I am not surprised at this behaviour. When it is only a 
tiddler with a title then all that is deleted is the title, if there is any 
content what so ever, you may not be able to see it eg; fields, then it 
should trigger the confirmation (in my view).

Perhaps you can submit and *issue* on github for a setting to be provided 
in the control panel settings to change this behaviour?

In the mean time perhaps you could consider either modifying the tiddler, 
even just add space to the text. Another way to do this is to make your own 
"new tiddler button" and modify it to set the text to " " space only, and 
hide the existing one. However new here and other will not be affected?

*Good catch*

Regards
Tones

On Thursday, 20 August 2020 12:22:07 UTC+10, kebi wrote:
>
> Thanks Eric for your testing.
> The delete button I'm talking about is not the one inside the edit tiddler 
> view, but the one in the view toolbar ($:/core/ui/Buttons/delete)
>
> - kebi
>

-- 
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/f8a515f1-9c09-4b55-893c-74efd3b94af3o%40googlegroups.com.


[tw5] Re: Delete confirmation for blank tiddlers

2020-08-19 Thread kebi
Thanks Eric for your testing.
The delete button I'm talking about is not the one inside the edit tiddler 
view, but the one in the view toolbar ($:/core/ui/Buttons/delete)

- kebi

-- 
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/0c11fb16-8ac9-4fc7-a4bc-aa7245a09e3ao%40googlegroups.com.


[tw5] Re: Delete confirmation for blank tiddlers

2020-08-19 Thread Eric Shulman
On Wednesday, August 19, 2020 at 5:00:46 PM UTC-7, kebi wrote:
>
> by default if a tiddler contains some text in its body TiddlyWiki is gonna 
> ask if you are sure about deleting the tiddler, but it won't ask anything 
> if the body is empty.
>

That is not the experience I get when I try the following at tiddlywiki.com

1) Go to http://tiddlywiki.com
2) press "+" button in the sidebar to start editing "Draft of New Tiddler"
3) press "checkmark" button in the tiddler toolbar to create "New Tiddler" 
(note that the body is empty)
4) press "pencil" button in the tiddler toolbar to edit "New Tiddler"
5) press "trashcan" button in the tiddler toolbar to delete "New Tiddler"

You are prompted to confirm the deletion.

Can you describe the *exact step-by-step actions *that produce the behavior 
you want to change?

-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/c6183036-04db-4bed-b6ee-a379d0548713o%40googlegroups.com.