diff options
Diffstat (limited to 'ext/fg/js/display-frame.js')
-rw-r--r-- | ext/fg/js/display-frame.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/fg/js/display-frame.js b/ext/fg/js/display-frame.js index 59032d0c..9fd09e74 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,22 @@ window.displayFrame = new class extends Display { handler(params); } } + + onKeyDown(e) { + const handlers = { + 67: /* c */ () => { + if (e.ctrlKey && window.getSelection().toString() === '') { + this.selectionCopy(); + return true; + } + } + }; + + const handler = handlers[e.keyCode]; + if (handler && handler()) { + e.preventDefault(); + } else { + super.onKeyDown(e); + } + } }; |