aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-14 21:47:43 -0500
committerGitHub <noreply@github.com>2020-11-14 21:47:43 -0500
commitc387898902cf24e017e18f9e3bb140df5d791bb7 (patch)
tree88c5aaabd59ab168095362dc9a8da43200746efb /ext/fg/js/frontend.js
parent4b1c7b1e269b98eaf4906c82cb3fd09566dce7be (diff)
Display fixes (#1033)
* Fix an entry not always being focused * Fix typo * Fix copy action not working on Firefox
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 82a56f1e..2ee9b4a1 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -115,6 +115,7 @@ class Frontend {
['getUrl', {async: false, handler: this._onApiGetUrl.bind(this)}],
['closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}],
['copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}],
+ ['getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}],
['getPopupInfo', {async: false, handler: this._onApiGetPopupInfo.bind(this)}],
['getDocumentInformation', {async: false, handler: this._onApiGetDocumentInformation.bind(this)}]
]);
@@ -168,9 +169,14 @@ class Frontend {
}
_onApiCopySelection() {
+ // This will not work on Firefox if a popup has focus, which is usually the case when this function is called.
document.execCommand('copy');
}
+ _onApiGetSelectionText() {
+ return document.getSelection().toString();
+ }
+
_onApiGetPopupInfo() {
return {
popupId: (this._popup !== null ? this._popup.id : null)