mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-24 19:55:46 +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"])
|
if (options["hlsearch"])
|
||||||
this.highlight();
|
this.highlight();
|
||||||
|
this.rangeFind.focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Called when the user types a key in the search dialog. Triggers a find attempt if 'incsearch' is set
|
// 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"])
|
if (options["hlsearch"])
|
||||||
this.highlight();
|
this.highlight();
|
||||||
|
this.rangeFind.focus();
|
||||||
|
|
||||||
modes.reset();
|
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) {
|
makeFrameList: function (win) {
|
||||||
const self = this;
|
const self = this;
|
||||||
win = win.top;
|
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) {
|
endpoint: function (range, before) {
|
||||||
range = range.cloneRange();
|
range = range.cloneRange();
|
||||||
range.collapse(before);
|
range.collapse(before);
|
||||||
|
|||||||
Reference in New Issue
Block a user