From 00dea67bc1623dac600d71d40053ab09fcce329b Mon Sep 17 00:00:00 2001 From: Yakov Litvin Date: Tue, 24 Dec 2024 10:23:25 +0300 Subject: [PATCH] feature: once a tiddler editor is focused, add it to the history top --- JumpKeysPlugin.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/JumpKeysPlugin.js b/JumpKeysPlugin.js index f226e89..4754bfc 100644 --- a/JumpKeysPlugin.js +++ b/JumpKeysPlugin.js @@ -2,7 +2,7 @@ |Description|Adds an interface and hotkeys for jumping between tiddlers and more| |Source |https://github.com/YakovL/TiddlyWiki_JumpKeysPlugin/blob/master/JumpKeysPlugin.js| |Author |Yakov Litvin| -|Version |1.2.0| +|Version |1.2.1| |License |[[MIT|https://github.com/YakovL/TiddlyWiki_YL_ExtensionsCollection/blob/master/Common%20License%20(MIT)]]| !!!Usage The plugin works more or less like the tab switching in a browser: press {{{ctrl + j}}} or the "jump" command in tiddler toolbar to open the jumping interface and: @@ -261,6 +261,7 @@ config.shadowTiddlers['JumpKeysSettings'] = JSON.stringify(config.jumper.default // reinstall-safe decorating and setting handlers if(!config.jumper.orig_story_displayTiddler) { config.jumper.orig_story_displayTiddler = story.displayTiddler + config.jumper.orig_editHandler = config.macros.edit.handler store.addNotification('JumpKeysStyleSheet', refreshStyles) store.addNotification("ColorPalette", (unused, doc) => refreshStyles('JumpKeysStyleSheet', doc)) @@ -289,6 +290,17 @@ story.displayTiddler = function(srcElement, tiddler, template, animate, unused, }) return config.jumper.orig_story_displayTiddler.apply(this, arguments) } + +// once a tiddler editor is focused, add it to the history top +// (this doesn't cover other editors yet, like CodeMirror or WYSIWYG) +config.macros.edit.handler = config.macros.edit.handler = function() { + const editor = config.jumper.orig_editHandler.apply(this, arguments) + const tiddler = arguments[5] + editor.addEventListener('focus', () => { + config.jumper.pushTouchedTiddler({ title: tiddler.title }) + }) + return editor +} //}}} /*** !!!Jumper styles