Supported scrolling by keys in message field

Closes #1119 #853
This commit is contained in:
Igor Zhukov 2016-12-08 22:03:12 +03:00
parent 5e855779b9
commit a0f71227de

View File

@ -1280,6 +1280,28 @@ angular.module('myApp.directives', ['myApp.filters'])
}
}
$scope.$on('history_direction_key', function (e, data) {
var newScrollTop = false
console.warn('scroll top', data.keyCode)
switch (data.keyCode) {
case 33: // page up
newScrollTop = scrollableWrap.scrollTop - scrollableWrap.clientHeight
break
case 34: // page down
newScrollTop = scrollableWrap.scrollTop + scrollableWrap.clientHeight
break
case 36: // home
newScrollTop = 0
break
case 35: // end
newScrollTop = scrollableWrap.scrollHeight
break
}
if (newScrollTop !== false) {
$(scrollableWrap).stop().animate({scrollTop: newScrollTop}, 200)
}
})
$scope.$on('ui_history_change', function () {
var pr = parseInt($(scrollableWrap).css('paddingRight'))
$(scrollableWrap).addClass('im_history_to_bottom')
@ -1653,6 +1675,7 @@ angular.module('myApp.directives', ['myApp.filters'])
$scope.$emit('last_message_edit')
return cancelEvent(e)
}
$scope.$emit('history_direction_key', e)
return true
}