1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-24 22:33:16 +00:00

Fix #5760 - tm-focus-selector doesn't work in new windows (#5766)

* Pass the original event to invokeActionString

* Update rootwidget.js
This commit is contained in:
Simon Huber 2021-06-06 13:42:28 +02:00 committed by GitHub
parent 2f1806ab6a
commit c18b7527a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -324,7 +324,7 @@ KeyboardManager.prototype.handleKeydownEvent = function(event) {
if(key !== undefined) { if(key !== undefined) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
$tw.rootWidget.invokeActionString(action,$tw.rootWidget); $tw.rootWidget.invokeActionString(action,$tw.rootWidget,event);
return true; return true;
} }
return false; return false;

View File

@ -40,9 +40,10 @@ exports.startup = function() {
// Install the tm-focus-selector message // Install the tm-focus-selector message
$tw.rootWidget.addEventListener("tm-focus-selector",function(event) { $tw.rootWidget.addEventListener("tm-focus-selector",function(event) {
var selector = event.param || "", var selector = event.param || "",
element; element,
doc = event.event ? event.event.target.ownerDocument : document;
try { try {
element = document.querySelector(selector); element = doc.querySelector(selector);
} catch(e) { } catch(e) {
console.log("Error in selector: ",selector) console.log("Error in selector: ",selector)
} }