1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Don't insert text if the allowed length would be exceeded

This commit is contained in:
Maximilian Mader 2014-04-29 22:04:52 +02:00
parent b633f05452
commit b8bc642714

View File

@ -767,9 +767,13 @@ the existing text. If `options.submit` is true the message will be sent to the s
text = text + $('#timsChatInput').val() if options.prepend
text = $('#timsChatInput').val() + text if options.append
# do not insert text if it would exceed the allowed length
maxLength = $('#timsChatInput').attr 'maxlength'
return if maxLength? and text.length > maxLength
$('#timsChatInput').val text
$('#timsChatInput').trigger 'change'
if options.submit
do $('#timsChatForm').submit
else