remove clickCatcher: layout_ref and controller itself
This commit is contained in:
parent
20b41596b6
commit
cc179cf6ce
2 changed files with 5 additions and 36 deletions
|
@ -1,21 +0,0 @@
|
||||||
class App.ClickCatcher extends Spine.Controller
|
|
||||||
# clickCatcher has no template because it's a plain <div>
|
|
||||||
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()
|
|
|
@ -208,6 +208,9 @@ class LayoutRefCommunicationReply extends App.ControllerContent
|
||||||
|
|
||||||
@$('[contenteditable]').textmodule()
|
@$('[contenteditable]').textmodule()
|
||||||
|
|
||||||
|
release: =>
|
||||||
|
@remove_textarea_catcher()
|
||||||
|
|
||||||
detect_empty_textarea: =>
|
detect_empty_textarea: =>
|
||||||
if !@textarea.text()
|
if !@textarea.text()
|
||||||
@add_textarea_catcher()
|
@add_textarea_catcher()
|
||||||
|
@ -267,15 +270,10 @@ class LayoutRefCommunicationReply extends App.ControllerContent
|
||||||
duration: duration
|
duration: duration
|
||||||
|
|
||||||
add_textarea_catcher: ->
|
add_textarea_catcher: ->
|
||||||
@textareaCatcher = new App.ClickCatcher
|
$(window).on 'click.LayoutRefCommunicationReply-textarea', @close_textarea
|
||||||
holder: @articleNewEdit.offsetParent()
|
|
||||||
callback: @close_textarea
|
|
||||||
zIndexScale: 4
|
|
||||||
|
|
||||||
remove_textarea_catcher: ->
|
remove_textarea_catcher: ->
|
||||||
return if !@textareaCatcher
|
$(window).off 'click.LayoutRefCommunicationReply-textarea'
|
||||||
@textareaCatcher.remove()
|
|
||||||
@textareaCatcher = null
|
|
||||||
|
|
||||||
close_textarea: =>
|
close_textarea: =>
|
||||||
@remove_textarea_catcher()
|
@remove_textarea_catcher()
|
||||||
|
@ -2151,7 +2149,6 @@ class TwitterConversationRef extends App.ControllerContent
|
||||||
options:
|
options:
|
||||||
duration: duration
|
duration: duration
|
||||||
easing: 'easeOutQuad'
|
easing: 'easeOutQuad'
|
||||||
complete: => @addTextareaCatcher()
|
|
||||||
|
|
||||||
@textBubble.velocity
|
@textBubble.velocity
|
||||||
properties:
|
properties:
|
||||||
|
@ -2180,13 +2177,6 @@ class TwitterConversationRef extends App.ControllerContent
|
||||||
stagger: 50
|
stagger: 50
|
||||||
drag: true
|
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' )
|
App.Config.set( 'layout_ref/twitter_conversation', TwitterConversationRef, 'Routes' )
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue