aboutsummaryrefslogtreecommitdiff
path: root/ext/js/comm/clipboard-reader.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-14 18:04:19 -0400
committerGitHub <noreply@github.com>2021-03-14 18:04:19 -0400
commit52a4d874eada5be121e15d73d1d10e9a8d84bdb8 (patch)
tree0a8c2afe9ac507701b954c0510c3f38d14d999a0 /ext/js/comm/clipboard-reader.js
parent06b02c3cf2ce725383f9a0bae87d3ef084ed8809 (diff)
Make MediaUtil a static class (#1525)
Diffstat (limited to 'ext/js/comm/clipboard-reader.js')
-rw-r--r--ext/js/comm/clipboard-reader.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/js/comm/clipboard-reader.js b/ext/js/comm/clipboard-reader.js
index 6d4f5abc..9336efe5 100644
--- a/ext/js/comm/clipboard-reader.js
+++ b/ext/js/comm/clipboard-reader.js
@@ -15,6 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+/* global
+ * MediaUtil
+ */
+
/**
* Class which can read text and images from the clipboard.
*/
@@ -25,14 +29,13 @@ class ClipboardReader {
* @param pasteTargetSelector The selector for the paste target element.
* @param imagePasteTargetSelector The selector for the image paste target element.
*/
- constructor({document=null, pasteTargetSelector=null, imagePasteTargetSelector=null, mediaUtil=null}) {
+ constructor({document=null, pasteTargetSelector=null, imagePasteTargetSelector=null}) {
this._document = document;
this._browser = null;
this._pasteTarget = null;
this._pasteTargetSelector = pasteTargetSelector;
this._imagePasteTarget = null;
this._imagePasteTargetSelector = imagePasteTargetSelector;
- this._mediaUtil = mediaUtil;
}
/**
@@ -107,7 +110,6 @@ class ClipboardReader {
// See browser-specific notes in getText
if (
this._isFirefox() &&
- this._mediaUtil !== null &&
typeof navigator.clipboard !== 'undefined' &&
typeof navigator.clipboard.read === 'function'
) {
@@ -120,7 +122,7 @@ class ClipboardReader {
}
for (const file of files) {
- if (this._mediaUtil.getFileExtensionFromImageMediaType(file.type) !== null) {
+ if (MediaUtil.getFileExtensionFromImageMediaType(file.type) !== null) {
return await this._readFileAsDataURL(file);
}
}