From c15f33971860ad6d03d1ae8a3b664575e648d034 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Sun, 6 Aug 2017 20:31:44 +0200
Subject: [PATCH] Fix emoji keyboard not disappearing after pressing ctrl+enter
 to tweet

---
 Resources/Plugins/emoji-keyboard/browser.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Resources/Plugins/emoji-keyboard/browser.js b/Resources/Plugins/emoji-keyboard/browser.js
index 30007721..ec93abe0 100644
--- a/Resources/Plugins/emoji-keyboard/browser.js
+++ b/Resources/Plugins/emoji-keyboard/browser.js
@@ -225,6 +225,10 @@ enabled(){
     }
   };
   
+  this.composerSendingEvent = function(e){
+    hideKeyboard();
+  };
+  
   this.documentClickEvent = function(e){
     if (me.currentKeyboard && !e.target.classList.contains("js-compose-text")){
       hideKeyboard();
@@ -246,6 +250,8 @@ enabled(){
 }
 
 ready(){
+  this.composeDrawer = $("[data-drawer='compose']");
+  
   this.composePanelScroller = $(".js-compose-scroller", ".js-docked-compose").first().children().first();
   this.composePanelScroller.on("scroll", this.composerScrollEvent);
   
@@ -253,6 +259,7 @@ ready(){
   $(document).on("click", this.documentClickEvent);
   $(document).on("keydown", this.documentKeyEvent);
   $(document).on("uiComposeImageAdded", this.uploadFilesEvent);
+  this.composeDrawer.on("uiComposeTweetSending", this.composerSendingEvent);
   
   // HTML generation
   
@@ -373,5 +380,7 @@ disabled(){
   $(document).off("click", this.documentClickEvent);
   $(document).off("keydown", this.documentKeyEvent);
   $(document).off("uiComposeImageAdded", this.uploadFilesEvent);
+  this.composeDrawer.off("uiComposeTweetSending", this.composerSendingEvent);
+  
   TD.mustaches["compose/docked_compose.mustache"] = this.prevComposeMustache;
 }