Hi! I came accross exactly the issue discussed here andin
https://github.com/Jermolene/TiddlyWiki5/pull/4434.
My Use-Case is just as follows: Beside *tags* and *list* renaming (that is
directly supported by TW5) i want to update my own list-fields (custom
named) on ANY title-change (API or manual via editor) that occurs. As far
as i understand the TW5-code, the best way to implement that is to listen
on exactly the mentioned "th-renaming-tiddler"-event but that is not fired
when renaming a tiddler by the standard edit-mode.
Or is there any other approach i should use that i don't see now (beside
changing core-code)?
Thanks,
Mirko
Am Freitag, 31. Januar 2020 09:33:55 UTC+1 schrieb bimlas:
>
> Dear all,
>
> I would like to execute events when a tiddler is renamed, but even though
> I wrote my startup module from the snippets of
> "$:/plugins/tiddlywiki/savetrail/savetrail.js", for some reason only the
> default text "Relinking 'X' to 'Y'" appears in the developer console,
> "RENAMED" and "RELINKED" no (so it doesn't seem to execute the hook). On
> page load it prints "LOADED" to the console, so it loads the startup
> module. I also thought that I might just not be able to write to the
> console, so I also tried to create a tiddler, but that didn't happen
> either. What could be the problem?
>
> /*\
> title: $:/plugins/bimlas/my-plugin/startup/relink-or-rename.js
> type: application/javascript
> module-type: startup
>
> Hook on rename
>
> \*/
> (function() {
>
> /*jslint node: true, browser: false */
> /*global $tw: true */
> "use strict";
>
> // Export name and synchronous status
> exports.name = "my-rename-hook";
> exports.platforms = ["browser"];
> exports.after = ["startup"];
> exports.synchronous = true;
>
> exports.startup = function() {
>
> console.log('LOADED');
>
> $tw.hooks.addHook("th-renaming-tiddler",function handleEvent(newTiddler
> , tiddler) {
> console.log('RENAME',newTiddler);
> $tw.wiki.addTiddler(new $tw.Tiddler({title: "NAME CHANGED", text:
> "rename"}));
> return newTiddler;
> });
>
> $tw.hooks.addHook("th-relinking-tiddler",function handleEvent(
> newTiddler, tiddler) {
> console.log('RELINK', newTiddler);
> $tw.wiki.addTiddler(new $tw.Tiddler({title: "NAME CHANGED", text:
> "relink"}));
> return newTiddler;
> });
> };
> })();
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/60767f75-cddb-48d4-857b-44a21bc35ee0o%40googlegroups.com.