diff --git a/app/assets/javascripts/app/controllers/_click_catcher.coffee b/app/assets/javascripts/app/controllers/_click_catcher.coffee deleted file mode 100644 index a8c9f80aa..000000000 --- a/app/assets/javascripts/app/controllers/_click_catcher.coffee +++ /dev/null @@ -1,21 +0,0 @@ -class App.ClickCatcher extends Spine.Controller - # clickCatcher has no template because it's a plain
- className: 'clickCatcher' - - constructor: -> - super - @render() if @callback and @holder - - triggerCallback: (e) => - e.stopPropagation() - @callback() - @remove() - - render: -> - @el.addClass("zIndex-#{ @zIndexScale }") if @zIndexScale - @el.on('click', @triggerCallback) - @el.height(@holder.prop('scrollHeight')) - @el.appendTo(@holder) - - remove: -> - @el.remove() \ No newline at end of file diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index a691c9ee0..b19701837 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -208,6 +208,9 @@ class LayoutRefCommunicationReply extends App.ControllerContent @$('[contenteditable]').textmodule() + release: => + @remove_textarea_catcher() + detect_empty_textarea: => if !@textarea.text() @add_textarea_catcher() @@ -267,15 +270,10 @@ class LayoutRefCommunicationReply extends App.ControllerContent duration: duration add_textarea_catcher: -> - @textareaCatcher = new App.ClickCatcher - holder: @articleNewEdit.offsetParent() - callback: @close_textarea - zIndexScale: 4 + $(window).on 'click.LayoutRefCommunicationReply-textarea', @close_textarea remove_textarea_catcher: -> - return if !@textareaCatcher - @textareaCatcher.remove() - @textareaCatcher = null + $(window).off 'click.LayoutRefCommunicationReply-textarea' close_textarea: => @remove_textarea_catcher() @@ -2151,7 +2149,6 @@ class TwitterConversationRef extends App.ControllerContent options: duration: duration easing: 'easeOutQuad' - complete: => @addTextareaCatcher() @textBubble.velocity properties: @@ -2180,13 +2177,6 @@ class TwitterConversationRef extends App.ControllerContent stagger: 50 drag: true - addTextareaCatcher: => - if @articleNewEdit.is(':visible') - @textareaCatcher = new App.ClickCatcher - holder: @articleNewEdit.offsetParent() - callback: @closeTextarea - zIndexScale: 4 - App.Config.set( 'layout_ref/twitter_conversation', TwitterConversationRef, 'Routes' )