chat designer: fix chat height when changing fontSize
This commit is contained in:
parent
d1d16f1706
commit
75d22c9d1d
1 changed files with 16 additions and 18 deletions
|
@ -5,13 +5,12 @@ class App.ChannelChat extends App.Controller
|
||||||
'click .js-remove': 'remove'
|
'click .js-remove': 'remove'
|
||||||
'click .js-widget': 'widget'
|
'click .js-widget': 'widget'
|
||||||
'change .js-params': 'updateParams'
|
'change .js-params': 'updateParams'
|
||||||
'keyup .js-params': 'updateParams'
|
'input .js-params': 'updateParams'
|
||||||
'submit .js-demo-head': 'changeDemoWebsite'
|
'submit .js-demo-head': 'onUrlSubmit'
|
||||||
'blur .js-testurl-input': 'changeDemoWebsite'
|
'blur .js-testurl-input': 'changeDemoWebsite'
|
||||||
'click .js-selectBrowserWidth': 'selectBrowserWidth'
|
'click .js-selectBrowserWidth': 'selectBrowserWidth'
|
||||||
'click .js-swatch': 'usePaletteColor'
|
'click .js-swatch': 'usePaletteColor'
|
||||||
'click .js-toggle-chat': 'toggleChat'
|
'click .js-toggle-chat': 'toggleChat'
|
||||||
'input .js-chatTitle': 'changeTitle'
|
|
||||||
|
|
||||||
elements:
|
elements:
|
||||||
'.js-browser': 'browser'
|
'.js-browser': 'browser'
|
||||||
|
@ -101,7 +100,6 @@ class App.ChannelChat extends App.Controller
|
||||||
|
|
||||||
isOpen: true
|
isOpen: true
|
||||||
browserWidth: 1280
|
browserWidth: 1280
|
||||||
chatHeight: 360
|
|
||||||
|
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
super
|
||||||
|
@ -140,11 +138,11 @@ class App.ChannelChat extends App.Controller
|
||||||
@code.each (i, block) ->
|
@code.each (i, block) ->
|
||||||
hljs.highlightBlock block
|
hljs.highlightBlock block
|
||||||
|
|
||||||
@adjustBrowserWidth()
|
@updatePreview()
|
||||||
@updateParams()
|
@updateParams()
|
||||||
|
|
||||||
# bind adjustBrowserWidth with parameter animate = false
|
# bind updatePreview with parameter animate = false
|
||||||
$(window).on 'resize.chat-designer', => @adjustBrowserWidth false
|
$(window).on 'resize.chat-designer', => @updatePreview false
|
||||||
|
|
||||||
release: ->
|
release: ->
|
||||||
$(window).off 'resize.chat-designer'
|
$(window).off 'resize.chat-designer'
|
||||||
|
@ -155,9 +153,9 @@ class App.ChannelChat extends App.Controller
|
||||||
# select tab
|
# select tab
|
||||||
tab.addClass('is-selected').siblings().removeClass('is-selected')
|
tab.addClass('is-selected').siblings().removeClass('is-selected')
|
||||||
@browserWidth = tab.attr('data-value')
|
@browserWidth = tab.attr('data-value')
|
||||||
@adjustBrowserWidth()
|
@updatePreview()
|
||||||
|
|
||||||
adjustBrowserWidth: (animate = true) =>
|
updatePreview: (animate = true) =>
|
||||||
width = parseInt @browserWidth, 10
|
width = parseInt @browserWidth, 10
|
||||||
|
|
||||||
# reset zoom
|
# reset zoom
|
||||||
|
@ -190,13 +188,14 @@ class App.ChannelChat extends App.Controller
|
||||||
if fullscreen
|
if fullscreen
|
||||||
return @browserBody.height() - @chatHeader.outerHeight()
|
return @browserBody.height() - @chatHeader.outerHeight()
|
||||||
else
|
else
|
||||||
return @chatHeight - @chatHeader.outerHeight()
|
return @chat.height() - @chatHeader.outerHeight()
|
||||||
|
|
||||||
changeDemoWebsite: (event) =>
|
onUrlSubmit: (event) ->
|
||||||
event.preventDefault() if event
|
event.preventDefault() if event
|
||||||
|
@urlInput.focus()
|
||||||
|
@changeDemoWebsite()
|
||||||
|
|
||||||
# fire both on enter and blur
|
changeDemoWebsite: ->
|
||||||
# but cache url
|
|
||||||
return if @urlInput.val() is '' or @urlInput.val() is @urlCache
|
return if @urlInput.val() is '' or @urlInput.val() is @urlCache
|
||||||
@urlCache = @urlInput.val()
|
@urlCache = @urlInput.val()
|
||||||
|
|
||||||
|
@ -204,7 +203,7 @@ class App.ChannelChat extends App.Controller
|
||||||
if !@url.startsWith('http')
|
if !@url.startsWith('http')
|
||||||
@url = "http://#{ @url }"
|
@url = "http://#{ @url }"
|
||||||
|
|
||||||
@urlInput.addClass('is-loading').focus()
|
@urlInput.addClass('is-loading')
|
||||||
|
|
||||||
@palette.empty()
|
@palette.empty()
|
||||||
|
|
||||||
|
@ -263,10 +262,7 @@ class App.ChannelChat extends App.Controller
|
||||||
toggleChat: =>
|
toggleChat: =>
|
||||||
@chat.toggleClass('is-open')
|
@chat.toggleClass('is-open')
|
||||||
@isOpen = @chat.hasClass('is-open')
|
@isOpen = @chat.hasClass('is-open')
|
||||||
@adjustBrowserWidth()
|
@updatePreview()
|
||||||
|
|
||||||
changeTitle: (event) ->
|
|
||||||
@chatWelcome.html $(event.currentTarget).val()
|
|
||||||
|
|
||||||
new: (e) =>
|
new: (e) =>
|
||||||
new App.ControllerGenericNew(
|
new App.ControllerGenericNew(
|
||||||
|
@ -329,6 +325,8 @@ class App.ChannelChat extends App.Controller
|
||||||
@chat.removeClass('zammad-chat--flat')
|
@chat.removeClass('zammad-chat--flat')
|
||||||
@chatWelcome.html params.title
|
@chatWelcome.html params.title
|
||||||
|
|
||||||
|
@updatePreview false
|
||||||
|
|
||||||
if @permanent
|
if @permanent
|
||||||
for key, value of @permanent
|
for key, value of @permanent
|
||||||
params[key] = value
|
params[key] = value
|
||||||
|
|
Loading…
Reference in a new issue