0

我目前正在使用 TiddlyWiki Classic,我想将“newTiddler”按钮添加到 ToolbarCommands 中,以便它出现在所有 tiddlers 上。我也只是觉得应该用那些按钮。我尝试将“newTiddler”添加到 ToolbarCommands 中,但它不起作用。任何人都知道如何做到这一点?

4

1 回答 1

0

好吧,你不能只在工具栏中添加一个宏,因为工具栏是一个单独的宏,而不是一个嵌入。您必须创建一个新命令(下面我正在编写应该用作插件的 JS 代码):

config.commands.newTiddler = {
    text: "new tiddler", // or whatever you want to see on the button
    tooltip: "Create a new tiddler",
    handler: function(event,src,title) {

        var currentTiddler = story.getTiddler(title);
        story.displayTiddler(
            currentTiddler, // to open it below the current tiddler; if you want it on top, put null instead
            config.macros.newTiddler.title, // default title, you may use anything you want
            DEFAULT_EDIT_TEMPLATE // you may use a custom one, though
        );
    }
};

只需创建一个 tiddler(如 NewTiddlerToolbarPlugin),将代码放在那里,标记它systemConfig,重新启动 TW 并将新命令(newTiddler)添加到 ToolbarCommands。

于 2018-05-22T14:38:16.747 回答