Editing TITLE - Is it possible to change editor behaviour?

183 views
Skip to first unread message

Josiah

unread,
May 30, 2016, 3:28:22 AM5/30/16
to TiddlyWiki
As is, when you edit the TITLE of a tiddler and save it it overwrites the previous version.

How difficult would it be change that behavior so that when you change the title of an existing tiddler it offers the OPTION to SAVE it as a NEW tiddler?

My use case: I have hundreds of small tiddlers that are similar I constantly create variant versions of. Right now I have to remember to clone. As is, I keep inadvertently overwriting Tiddlers I want to keep.

Best wishes
Josiah
Message has been deleted

Andreas Hahn

unread,
May 30, 2016, 12:23:43 PM5/30/16
to tiddl...@googlegroups.com

Hi Josiah,

that specific behaviour is governed by the handleSaveTiddlerEvent method of the navigator widget which you can see in [1]. To change that, you can either edit the code over there (which you might not wanna do), or add an action widget to $:/core/ui/Buttons/save which keeps the draft.of and draft.title field of the draft in sync, before invoking the save routine (see [2]). Obviously you can also get arbitrarily fancy with the UI, like adding a checkbox that steers that behaviour, but it sounds like a simple change like that would do the trick for you.

/Andreas

[1] https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/navigator.js#L354-L357

[2] adding <$action-sendmessage $message="tm-add-field" $name="draft.of" $value={{!!draft.title}}/> to $:/core/ui/Buttons/save should be sufficient.

--
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/0004d98d-1dd2-48a0-8d80-2e81d876f19e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Josiah

unread,
May 30, 2016, 1:29:50 PM5/30/16
to TiddlyWiki
Thanks very much. The solution I need is likely [2]. i will try it.

Best wishes
Josiah

Josiah

unread,
May 31, 2016, 2:14:08 PM5/31/16
to TiddlyWiki
Andreas

Unfortunately [2] did not work. Perhaps I should have made clearer that I am working in TW5?

Josiah

Mal

unread,
May 31, 2016, 8:18:16 PM5/31/16
to TiddlyWiki
Josiah,

This may not be exactly what you're looking for, but you can always make a clone of a tiddler (from the view mode toolbar) and save it with your desired title.

Regards,

Mal

Alex Hough

unread,
Jun 1, 2016, 3:49:08 AM6/1/16
to tiddl...@googlegroups.com
Use TiddlyMap, it has built in way to deal with titles


Alex
--
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.

Josiah

unread,
Jun 1, 2016, 5:49:50 AM6/1/16
to TiddlyWiki
Alex & Mal

Mal, I can't clone easily as I don't show the buttons on the interface on the group of Tiddlers I'm talking about. I only display the text content. I edit by double clicking (via a plugin) to activate the editor. Cloning I do do but I have to keep manually switching off and on the styles that hide the clone button, which is cumbersome. I also sometimes just forget and edit a tiddler without thinking I should be editing a copy.

Alex thanks for pointing me to TiddlyMap, a rather stellar thing. Unfortunately it doesn't seem to do what I'm looking for ... which is to set the editor so that when I edit an EXISTING tiddler, and edit its Title, the save button gives me the option to save the edited version as a NEW Tiddler, rather than OVERWRITE the Tiddler being edited.

Best wishes
Josiah


On Wednesday, 1 June 2016 09:49:08 UTC+2, AlexHough wrote:
Use TiddlyMap, it has built in way to deal with titles

Andreas Hahn

unread,
Jun 1, 2016, 12:15:54 PM6/1/16
to tiddl...@googlegroups.com

Hi Josiah,

I can assure you that previous versions of TW did not have mechanisms where [2] is likely to work. In fact I am very confident that [2] does indeed work how its supposed to: Whenever you edit the title, the tiddler with the old title will not be deleted and the tiddler with the new title will be added as a copy. (there will not be an option to not do this)

Be sure to include the action-sendmessage in the proper place, before the tm-save-tiddler message is sent. Since $:/core/ui/Buttons/save isn't particularly large, here is the full modified version of how it should look:

$:/core/ui/Buttons/save

<$fieldmangler>
<$button tooltip={{$:/language/Buttons/Save/Hint}} aria-label={{$:/language/Buttons/Save/Caption}} class=<<tv-config-toolbar-class>>>
<$action-sendmessage $message="tm-add-tag" $param={{$:/temp/NewTagName}}/>
<$action-deletetiddler $tiddler="$:/temp/NewTagName"/>
<$action-sendmessage $message="tm-add-field" $name={{$:/temp/newfieldname}} $value={{$:/temp/newfieldvalue}}/>
<$action-deletetiddler $tiddler="$:/temp/newfieldname"/>
<$action-deletetiddler $tiddler="$:/temp/newfieldvalue"/>
<$action-sendmessage $message="tm-add-field" $name="draft.of" $value={{!!draft.title}}/>
<$action-sendmessage $message="tm-save-tiddler"/>
<$list filter="[<tv-config-toolbar-icons>prefix[yes]]">
{{$:/core/images/done-button}}
</$list>
<$list filter="[<tv-config-toolbar-text>prefix[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Save/Caption}}/></span>
</$list>
</$button>
</$fieldmangler>

I hope this makes things a little clearer. Also note that the position of the action widget would also allow the insertion of another field, maybe called copy-of, which could track the original tiddler that the modified version came from, before the title was altered.

/Andreas

-- 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/2035030f-5ebf-462d-8d91-bb87629891a3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

Josiah

unread,
Jun 1, 2016, 12:39:23 PM6/1/16
to TiddlyWiki
Andreas

Thanks so much for taking time on this!

I will try again.

Best wishes
Josiah
Reply all
Reply to author
Forward
0 new messages