From c2f9f14157c1505b31e715217cbef76a87c35886 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Thu, 5 Oct 2017 10:25:20 -0500 Subject: [PATCH] Fix pasting in MS Edge. Fixes #452 In Edge, dataTransfer.types is a DOMStringList, not an Array. --- src/trix/controllers/input_controller.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/trix/controllers/input_controller.coffee b/src/trix/controllers/input_controller.coffee index c34796c77..b06823f5e 100644 --- a/src/trix/controllers/input_controller.coffee +++ b/src/trix/controllers/input_controller.coffee @@ -474,10 +474,12 @@ pasteEventIsCrippledSafariHTMLPaste = (event) -> if "text/html" in paste.types # Answer is yes if there's any possibility of Paste and Match Style in Safari, # which is nearly impossible to detect confidently: https://bugs.webkit.org/show_bug.cgi?id=174165 - mightBePasteAndMatchStyle = paste.types.some (type) -> + for type in paste.types hasPasteboardFlavor = /^CorePasteboardFlavorType/.test(type) hasReadableDynamicData = /^dyn\./.test(type) and paste.getData(type) - hasPasteboardFlavor or hasReadableDynamicData + mightBePasteAndMatchStyle = hasPasteboardFlavor or hasReadableDynamicData + return true if mightBePasteAndMatchStyle + false else isExternalHTMLPaste = "com.apple.webarchive" in paste.types isExternalRichTextPaste = "com.apple.flat-rtfd" in paste.types