1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-31 17:05:45 +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); onLocationChange.superapply(this, arguments);
statusline.updateUrl(); statusline.updateUrl();
statusline.updateProgress(); statusline.updateProgress();
for (let frame in values(buffer.allFrames()))
frame.dactylFocusAllowed = false;
util.timeout(function () { util.timeout(function () {
autocommands.trigger("LocationChange", { url: buffer.URL }); autocommands.trigger("LocationChange", { url: buffer.URL });

View File

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