diff options
Diffstat (limited to 'ext/fg')
-rw-r--r-- | ext/fg/js/display-frame.js | 27 | ||||
-rw-r--r-- | ext/fg/js/driver.js | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/ext/fg/js/display-frame.js b/ext/fg/js/display-frame.js index 59032d0c..f6f7683e 100644 --- a/ext/fg/js/display-frame.js +++ b/ext/fg/js/display-frame.js @@ -51,6 +51,10 @@ window.displayFrame = new class extends Display { window.parent.postMessage('popupClose', '*'); } + selectionCopy() { + window.parent.postMessage('selectionCopy', '*'); + } + showOrphaned() { $('#content').hide(); $('#orphan').show(); @@ -77,4 +81,27 @@ window.displayFrame = new class extends Display { handler(params); } } + + onKeyDown(e) { + if (super.onKeyDown(e)) { + return true; + } + + const handlers = { + 67: /* c */ () => { + if (e.ctrlKey) { + this.selectionCopy(); + return true; + } + } + }; + + const handler = handlers[e.keyCode]; + if (handler && handler()) { + e.preventDefault(); + return true; + } + + return false; + } }; diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js index 5191f18d..d4cb1532 100644 --- a/ext/fg/js/driver.js +++ b/ext/fg/js/driver.js @@ -106,6 +106,10 @@ window.driver = new class { const handlers = { popupClose: () => { this.searchClear(); + }, + + selectionCopy: () => { + document.execCommand('copy'); } }; |