On Monday, May 29, 2017 at 1:33:16 PM UTC+2, Julian Kniephoff wrote:
>
> On Monday, May 29, 2017 at 12:08:13 PM UTC+2, Ton Gerner wrote:
>>
>> @Julian
>>
>> Create a tiddler which contains:
>>
>> {{!!title}}
>>
>> {{!!draft.of}}
>>
>> {{!!draft.title}}
>>
>> In edit mode with preview mode enabled you see that `{{!!draft.of}}` and 
>> `{{!!draft.title}}` behave the same.
>>
>> But - still in edit mode - change the title of that tiddler. Only 
>> `{{!!draft.title}}` follows the change! Why?
>>
>
> That is exactly what I meant. draft.of contains the original title of the 
> tiddler that is being edited; i.e. the name the tiddler had when you click 
> the edit button, even if you change the title during editing. draft.title 
> contains 
> the title that the tiddler should get after editing. When you just pressed 
> the edit button, this coincides with draft.of, because you haven't 
> changed the title yet, but when you do, draft.title updates.
>

You are exactly right!
 

> Now I am not that familiar with TiddlyWikis editing lifecycle internals, 
> yet, but I presume that both are needed at the moment you save the tiddler. 
>

right. .. Internally the tidders are immutable. That means eg: plugin 
authors have to use the core function $tw.wiki.addTiddler() or 
$tw.wiki.deleteTiddler() and so on.  Using those functions is necessary, 
because changing tiddlers also needs to trigger a UI refresh, if the edited 
tiddler is visible at the moment. 

So as soon as you change the content of a tiddler it will be refreshed. 
That's the main reason, why $edit-widget in view mode causes problems. 
Since as soon as you change a single character it will be refreshed and the 
"edit-widget" looses focus. ... That's a famous newbee trap! 
 

> You want to be able to reference the original tiddler, for example to 
> potentially delete it when you changed the title,
>

exactly
 

> or to write the new values of the draft tiddler back to it if you didn't.
>

If tiddler content is overwritten, you actually create a new one with the 
same name which overwrites the old one in the internal memory. ... But 
directly editing the internal memory with eg: plugins is not possible since 
tiddlers are immutable there. 
 

> Also, if you changed the title, you of course need to be able to reference 
> that, to actually create the new tiddler.
>

right. you also need to send a "delete request" with the old name, and a 
"create request" with the new name, to a server, if you run in client - 
server mode. 

have fun!
mario 

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/fcfb9fb8-8af1-4b51-8a13-8a087f039197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to