Skip to content

Instantly share code, notes, and snippets.

@javan
Created November 15, 2014 00:19
Show Gist options
  • Save javan/2af8bde4930b2d2446f9 to your computer and use it in GitHub Desktop.
Save javan/2af8bde4930b2d2446f9 to your computer and use it in GitHub Desktop.
diff --git a/src/trix/models/composition.coffee b/src/trix/models/composition.coffee
index 0de874b..ce3517d 100644
--- a/src/trix/models/composition.coffee
+++ b/src/trix/models/composition.coffee
@@ -103,12 +103,15 @@ class Trix.Composition
insertFile: (file) ->
if @delegate?.compositionShouldAcceptFile(file)
attachment = Trix.Attachment.attachmentForFile(file)
text = Trix.Text.textForAttachmentWithAttributes(attachment, @currentAttributes)
@insertText(text)
+ Trix.Helpers.defer =>
+ @delegate.documentElement.blur()
+ @delegate.documentElement.focus()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment