REFACTOR: Remove `Discourse.SiteSettings` from clipboardData

REFACTOR: Remove Discourse.SiteSettings from clipboardData

Also rename method to clipboardHelpers to make searching easier since clipboardData refers to browser functionality.

diff --git a/app/assets/javascripts/discourse/app/components/composer-editor.js b/app/assets/javascripts/discourse/app/components/composer-editor.js
index 3fde471..eb2205e 100644
--- a/app/assets/javascripts/discourse/app/components/composer-editor.js
+++ b/app/assets/javascripts/discourse/app/components/composer-editor.js
@@ -25,7 +25,7 @@ import { iconHTML } from "discourse-common/lib/icon-library";
 import {
   tinyAvatar,
   formatUsername,
-  clipboardData,
+  clipboardHelpers,
   caretPosition,
   inCodeBlock
 } from "discourse/lib/utilities";
@@ -656,7 +656,10 @@ export default Component.extend({
         return;
       }
 
-      const { canUpload, canPasteHtml, types } = clipboardData(e, true);
+      const { canUpload, canPasteHtml, types } = clipboardHelpers(e, {
+        siteSettings: this.siteSettings,
+        canUpload: true
+      });
 
       if (!canUpload || canPasteHtml || types.includes("text/plain")) {
         e.preventDefault();
diff --git a/app/assets/javascripts/discourse/app/components/d-editor.js b/app/assets/javascripts/discourse/app/components/d-editor.js
index 93f2a3e..b476ca3 100644
--- a/app/assets/javascripts/discourse/app/components/d-editor.js
+++ b/app/assets/javascripts/discourse/app/components/d-editor.js
@@ -15,7 +15,7 @@ import { findRawTemplate } from "discourse-common/lib/raw-templates";
 import { siteDir } from "discourse/lib/text-direction";
 import {
   determinePostReplaceSelection,
-  clipboardData,
+  clipboardHelpers,
   safariHacksDisabled,
   caretPosition,
   inCodeBlock
@@ -863,7 +863,10 @@ export default Component.extend({
     }
 
     const isComposer = $("#reply-control .d-editor-input").is(":focus");
-    let { clipboard, canPasteHtml, canUpload } = clipboardData(e, isComposer);
+    let { clipboard, canPasteHtml, canUpload } = clipboardHelpers(e, {
+      siteSettings: this.siteSettings,
+      canUpload: isComposer
+    });
 
     let plainText = clipboard.getData("text/plain");
     let html = clipboard.getData("text/html");
diff --git a/app/assets/javascripts/discourse/app/lib/utilities.js b/app/assets/javascripts/discourse/app/lib/utilities.js
index cee9ce5..f105b3b 100644
--- a/app/assets/javascripts/discourse/app/lib/utilities.js
+++ b/app/assets/javascripts/discourse/app/lib/utilities.js
@@ -310,7 +310,7 @@ const toArray = items => {
   return items;
 };
 
-export function clipboardData(e, canUpload) {
+export function clipboardHelpers(e, opts) {
   const clipboard =
     e.clipboardData ||
     e.originalEvent.clipboardData ||
@@ -324,7 +324,7 @@ export function clipboardData(e, canUpload) {
     files = toArray(clipboard.items).filter(i => i.kind === "file");
   }
 
-  canUpload = files && canUpload && types.includes("Files");
+  let canUpload = files && opts.canUpload && types.includes("Files");
   const canUploadImage =
     canUpload && files.filter(f => f.type.match("^image/"))[0];
   const canPasteHtml =

GitHub sha: bad083b3

This commit appears in #10298 which was merged by eviltrout.