mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 05:34:12 +01:00
Focus ancestor link (but not input boxes) of rangefinder selections.
--HG-- branch : testing
This commit is contained in:
@@ -83,6 +83,7 @@ const RangeFinder = Module("rangefinder", {
|
||||
|
||||
if (options["hlsearch"])
|
||||
this.highlight();
|
||||
this.rangeFind.focus();
|
||||
},
|
||||
|
||||
// Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set
|
||||
@@ -103,6 +104,7 @@ const RangeFinder = Module("rangefinder", {
|
||||
|
||||
if (options["hlsearch"])
|
||||
this.highlight();
|
||||
this.rangeFind.focus();
|
||||
|
||||
modes.reset();
|
||||
},
|
||||
@@ -311,6 +313,16 @@ const RangeFind = Class("RangeFind", {
|
||||
}
|
||||
},
|
||||
|
||||
focus: function() {
|
||||
if(this.lastRange)
|
||||
var node = util.evaluateXPath(RangeFind.selectNodePath, this.range.document,
|
||||
this.lastRange.commonAncestorContainer).snapshotItem(0);
|
||||
if(node) {
|
||||
node.focus();
|
||||
this.search(null, false); // Rehighlight collapsed range
|
||||
}
|
||||
},
|
||||
|
||||
makeFrameList: function (win) {
|
||||
const self = this;
|
||||
win = win.top;
|
||||
@@ -622,6 +634,8 @@ const RangeFind = Class("RangeFind", {
|
||||
}}
|
||||
|
||||
}),
|
||||
selectNodePath: ["ancestor-or-self::" + s for ([i, s] in Iterator(
|
||||
["a", "xhtml:a", "*[@onclick]"]))].join(" | "),
|
||||
endpoint: function (range, before) {
|
||||
range = range.cloneRange();
|
||||
range.collapse(before);
|
||||
|
||||
Reference in New Issue
Block a user