Skip to content

Commit

Permalink
Fix pasting in MS Edge. Fixes #452
Browse files Browse the repository at this point in the history
In Edge, dataTransfer.types is a DOMStringList, not an Array.
  • Loading branch information
javan committed Oct 5, 2017
1 parent 57aa713 commit c2f9f14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/trix/controllers/input_controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2f9f14

Please sign in to comment.