diff options
Diffstat (limited to 'ext/js/dom/document-util.js')
-rw-r--r-- | ext/js/dom/document-util.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/js/dom/document-util.js b/ext/js/dom/document-util.js index da4d3e61..0338d452 100644 --- a/ext/js/dom/document-util.js +++ b/ext/js/dom/document-util.js @@ -311,6 +311,22 @@ class DocumentUtil { return !(browser === 'firefox' || browser === 'firefox-mobile') || os === 'mac'; } + static isInputElementFocused() { + const element = document.activeElement; + if (element === null) { return false; } + const type = element.nodeName.toUpperCase(); + switch (type) { + case 'INPUT': + case 'TEXTAREA': + case 'SELECT': + return true; + default: + return element.isContentEditable; + } + } + + // Private + static _getActiveButtons(event, array) { let {buttons} = event; if (typeof buttons === 'number' && buttons > 0) { @@ -325,8 +341,6 @@ class DocumentUtil { } } - // Private - _setImposterStyle(style, propertyName, value) { style.setProperty(propertyName, value, 'important'); } |