1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 21:57:58 +01:00

Add 'Copy' MOW context menu item for Windows users.

This commit is contained in:
Kris Maglione
2010-10-05 00:27:07 -04:00
parent 5946f6a757
commit 1edd4d9ce0
2 changed files with 25 additions and 4 deletions

View File

@@ -149,8 +149,10 @@ const CommandWidgets = Class("CommandWidgets", {
multilineOutput: Class.memoize(function () {
let elem = document.getElementById("dactyl-multiline-output");
elem.contentDocument.body.id = "dactyl-multiline-output-content";
document.getElementById("dactyl-context-copylink").style.listStyleImage =
util.computedStyle(document.getElementById("context-copylink")).listStyleImage;
["copy", "copylink", "selectall"].forEach(function (id) {
document.getElementById("dactyl-context-" + id).style.listStyleImage =
util.computedStyle(document.getElementById("context-" + id)).listStyleImage;
});
return elem;
}),
multilineInput: Class.memoize(function () document.getElementById("dactyl-multiline-input")),
@@ -748,6 +750,19 @@ const CommandLine = Module("commandline", {
this.timeout(function () { this.widgets.multilineInput.focus(); }, 10);
},
onContext: function onContext(event) {
let enabled = {
link: window.document.popupNode instanceof HTMLAnchorElement,
selection: !window.document.commandDispatcher.focusedWindow.getSelection().isCollapsed
};
for (let [, node] in iter(event.target.childNodes)) {
let group = node.getAttributeNS(NS, "group");
node.hidden = group && !groups.split(/\s+/).some(function (g) enabled[g]);
}
return true;
},
/**
* Handles all command-line events. All key events are passed here when
* COMMAND_LINE mode is active, as well as all input, keyup, focus, and