1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-09 00:54:11 +01:00

Set lastInputField for editable windows.

This commit is contained in:
Kris Maglione
2010-11-11 11:06:26 -05:00
parent e153b36b8e
commit 7ee4ecc3bf
2 changed files with 8 additions and 2 deletions

View File

@@ -270,6 +270,8 @@ const Buffer = Module("buffer", {
onLocationChange.superapply(this, arguments);
statusline.updateUrl();
statusline.updateProgress();
for (let frame in values(buffer.allFrames()))
frame.dactylFocusAllowed = false;
util.timeout(function () {
autocommands.trigger("LocationChange", { url: buffer.URL });

View File

@@ -690,11 +690,12 @@ const Events = Module("events", {
let elem = event.originalTarget;
if (Events.isContentNode(elem) && !buffer.focusAllowed(elem)
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window]))
&& isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement, Window])) {
if (elem.frameElement)
dactyl.focusContent(true);
else if (!(elem instanceof Window) || Editor.getEditor(elem))
elem.blur();
}
},
// argument "event" is deliberately not used, as i don't seem to have
@@ -709,6 +710,8 @@ const Events = Module("events", {
let win = window.document.commandDispatcher.focusedWindow;
let elem = window.document.commandDispatcher.focusedElement;
if (elem == null && Editor.getEditor(win))
elem = win;
if (win && win.top == window.content && dactyl.has("tabs"))
buffer.focusedFrame = win;
@@ -718,7 +721,8 @@ const Events = Module("events", {
return;
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) ||
elem instanceof HTMLSelectElement) {
elem instanceof HTMLSelectElement ||
elem instanceof Window && Editor.getEditor(elem)) {
dactyl.mode = modes.INSERT;
if (hasHTMLDocument(win))
buffer.lastInputField = elem;