From 791100797356fec1338f702a0ee83c8ca482fb66 Mon Sep 17 00:00:00 2001 From: saqimtiaz Date: Fri, 19 Jun 2020 19:20:25 +0200 Subject: [PATCH] Revised: toggling relink in tm-rename-tiddler (#4723) * switch boolean logic in new parameters Use renameinTags and renameInLists instead of dontRenameInTags and dontRenameInLists respectively. This avoids users having to think through double negatives, as well as corresponds better to the setting in $:/config/RelinkOnRename * Updated docs for revised parameters for tm-new-tiddler --- core/modules/widgets/navigator.js | 7 ++++-- .../WidgetMessage_ tm-rename-tiddler.tid | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index 8aff417cf..4e7a871e0 100755 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -609,10 +609,13 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) { }; NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) { - var paramObject = event.paramObject || {}, + var options = {}, + paramObject = event.paramObject || {}, from = paramObject.from || event.tiddlerTitle, to = paramObject.to; - this.wiki.renameTiddler(from,to); + options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false; + options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false; + this.wiki.renameTiddler(from,to,options); }; exports.navigator = NavigatorWidget; diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-rename-tiddler.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-rename-tiddler.tid index f97a9aaee..d18f523e6 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-rename-tiddler.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-rename-tiddler.tid @@ -10,5 +10,27 @@ The `tm-rename-tiddler` message renames a tiddler by deleting it and recreating |!Name |!Description | |from |Current title of tiddler | |to |New title of tiddler | +|renameInTags |<<.from-version "5.1.23">> Optional value "no" to disable renaming in tags fields of other tiddlers (defaults to "yes") | +|renameInLists |<<.from-version "5.1.23">> Optional value "no" to disable renaming in list fields of other tiddlers (defaults to "yes") | The rename tiddler message is usually generated with the ButtonWidget and is handled by the NavigatorWidget. + +! Examples + +To rename a tiddler called Tiddler1 to Tiddler2 and also renaming Tiddler1 in tags and list fields of other tiddlers: + +``` +<$action-sendmessage $message="tm-rename-tiddler" from="Tiddler1" to="Tiddler2" /> +``` + +To rename a tiddler called Tiddler1 to Tiddler2 and not rename Tiddler1 in tags and list fields of other tiddlers: + +``` +<$action-sendmessage $message="tm-rename-tiddler" from="Tiddler1" to="Tiddler2" renameInTags="no" renameInLists="no"/> +``` + +To rename a tiddler called Tiddler1 to Tiddler2 and respect the setting in the tiddler $:/config/RelinkOnRename for whether to rename Tiddler1 in tags and list fields of other tiddlers: + +``` +<$action-sendmessage $message="tm-rename-tiddler" from="Tiddler1" to="Tiddler2" renameInTags={{$:/config/RelinkOnRename}} renameInLists={{$:/config/RelinkOnRename}}/> +```