1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00

Allow toggling relink in tm-rename-tiddler (#4719)

* Allow toggling relink in tm-rename-tiddler

* Updated docs for tm-rename-tiddler
This commit is contained in:
saqimtiaz 2020-06-19 12:07:03 +02:00 committed by GitHub
parent f760a2fa79
commit a689f31978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View File

@ -609,10 +609,13 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
}; };
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) { NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
var paramObject = event.paramObject || {}, var options = {},
paramObject = event.paramObject || {},
from = paramObject.from || event.tiddlerTitle, from = paramObject.from || event.tiddlerTitle,
to = paramObject.to; to = paramObject.to;
this.wiki.renameTiddler(from,to); options.dontRenameInTags = (paramObject.dontRenameInTags === "true" || paramObject.dontRenameInTags === "yes") ? true : false;
options.dontRenameInLists = (paramObject.dontRenameInLists === "true" || paramObject.dontRenameInLists === "yes") ? true : false;
this.wiki.renameTiddler(from,to,options);
}; };
exports.navigator = NavigatorWidget; exports.navigator = NavigatorWidget;

View File

@ -10,5 +10,27 @@ The `tm-rename-tiddler` message renames a tiddler by deleting it and recreating
|!Name |!Description | |!Name |!Description |
|from |Current title of tiddler | |from |Current title of tiddler |
|to |New title of tiddler | |to |New title of tiddler |
|dontRenameInTags |<<.from-version "5.1.23">> Optional value "yes" to disable renaming in tags fields of other tiddlers (defaults to "no") |
|dontRenameInLists |<<.from-version "5.1.23">> Optional value "yes" to disable renaming in list fields of other tiddlers (defaults to "no") |
The rename tiddler message is usually generated with the ButtonWidget and is handled by the NavigatorWidget. 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" dontRenameInTags="yes" dontRenameInLists="yes"/>
```
To rename a tiddler called Tiddler1 to Tiddler2 and respect the setting $:/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" dontRenameInTags={{$:/config/RelinkOnRename}} dontRenameInLists={{$:/config/RelinkOnRename}}/>
```