mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-26 08:56:52 +00:00
Add support for tm-relink-tiddler message
This commit is contained in:
parent
37a6ff8521
commit
1d16206188
@ -51,16 +51,20 @@ exports.startup = function() {
|
||||
element.focus(event.paramObject);
|
||||
}
|
||||
});
|
||||
// Install the tm-rename-tiddler message
|
||||
$tw.rootWidget.addEventListener("tm-rename-tiddler",function(event) {
|
||||
var options = {},
|
||||
paramObject = event.paramObject || {},
|
||||
from = paramObject.from || event.tiddlerTitle,
|
||||
to = paramObject.to;
|
||||
options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false;
|
||||
options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false;
|
||||
$tw.wiki.renameTiddler(from,to,options);
|
||||
});
|
||||
// Install the tm-rename-tiddler and tm-relink-tiddler messages
|
||||
var makeRenameHandler = function(method) {
|
||||
return function(event) {
|
||||
var options = {},
|
||||
paramObject = event.paramObject || {},
|
||||
from = paramObject.from || event.tiddlerTitle,
|
||||
to = paramObject.to;
|
||||
options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false;
|
||||
options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false;
|
||||
$tw.wiki[method](from,to,options);
|
||||
};
|
||||
};
|
||||
$tw.rootWidget.addEventListener("tm-rename-tiddler",makeRenameHandler("renameTiddler"));
|
||||
$tw.rootWidget.addEventListener("tm-relink-tiddler",makeRenameHandler("relinkTiddler"));
|
||||
// Install the scroller
|
||||
$tw.pageScroller = new $tw.utils.PageScroller();
|
||||
$tw.rootWidget.addEventListener("tm-scroll",function(event) {
|
||||
|
@ -0,0 +1,26 @@
|
||||
caption: tm-relink-tiddler
|
||||
created: 20220219093748993
|
||||
modified: 20220219093748993
|
||||
tags: Messages navigator-message
|
||||
title: WidgetMessage: tm-relink-tiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.2.2">> The `tm-relink-tiddler` message relinks a tiddler by deleting it and recreating it with a new title. Unlike the [[WidgetMessage: tm-rename-tiddler]] message, this message does not rename the tiddler, it just relinks the references to it.
|
||||
|
||||
The relink tiddler message requires the following properties on the `event` object:
|
||||
|
||||
|!Name |!Description |
|
||||
|from |Current title of tiddler |
|
||||
|to |New title of tiddler |
|
||||
|renameInTags |Optional value "no" to disable renaming in tags fields of other tiddlers (defaults to "yes") |
|
||||
|renameInLists |Optional value "no" to disable renaming in list fields of other tiddlers (defaults to "yes") |
|
||||
|
||||
The relink tiddler message is usually generated with the ButtonWidget and is handled by the core.
|
||||
|
||||
! Examples
|
||||
|
||||
To relink Tiddler1 to Tiddler2 in tags and list fields of other tiddlers:
|
||||
|
||||
```
|
||||
<$action-sendmessage $message="tm-relink-tiddler" from="Tiddler1" to="Tiddler2" />
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
caption: tm-rename-tiddler
|
||||
created: 20190909133618113
|
||||
modified: 20190909133618113
|
||||
modified: 20220219093748993
|
||||
tags: Messages navigator-message
|
||||
title: WidgetMessage: tm-rename-tiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
@ -13,7 +13,9 @@ The `tm-rename-tiddler` message renames a tiddler by deleting it and recreating
|
||||
|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.
|
||||
The very similar [[WidgetMessage: tm-relink-tiddler]] message does not rename the tiddler, it just relinks the references to it.
|
||||
|
||||
The rename tiddler message is usually generated with the ButtonWidget and is handled by the core.
|
||||
|
||||
! Examples
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user