mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-20 14:32:59 +01:00
make expand postContainer more easier
If user don't know drag to expand and move 0 after down, then think user clicked and toggle postContainer's height between max and default 400.
This commit is contained in:
@@ -44,15 +44,31 @@ define('composer/resize', function() {
|
||||
var resizeCenterY = resizeRect.top + (resizeRect.height/2);
|
||||
resizeOffset = resizeCenterY - e.clientY;
|
||||
resizeActive = true;
|
||||
resizeDown = e.clientY;
|
||||
|
||||
$(window).on('mousemove', resizeAction);
|
||||
$(window).on('mouseup', resizeStop);
|
||||
$('body').on('touchmove', resizeTouchAction);
|
||||
}
|
||||
|
||||
function resizeStop() {
|
||||
function resizeStop(e) {
|
||||
resizeActive = false;
|
||||
postContainer.find('textarea').focus();
|
||||
if(e.clientY-resizeDown==0){
|
||||
var newHeight;
|
||||
var max = $(window).height() - $('#header-menu').height() - 20;
|
||||
if(max != postContainer.height()){
|
||||
newHeight = max;
|
||||
$('.fa-chevron-up').addClass("fa-chevron-down").removeClass("fa-chevron-up");
|
||||
}else{
|
||||
newHeight = 400;
|
||||
$('.fa-chevron-down').addClass("fa-chevron-up").removeClass("fa-chevron-down");
|
||||
}
|
||||
postContainer.css('height', newHeight);
|
||||
$('body').css({'margin-bottom': newHeight});
|
||||
resizeWritePreview(postContainer);
|
||||
resizeSavePosition(newHeight);
|
||||
}
|
||||
postContainer.find('textarea').focus();
|
||||
$(window).off('mousemove', resizeAction);
|
||||
$(window).off('mouseup', resizeStop);
|
||||
$('body').off('touchmove', resizeTouchAction);
|
||||
@@ -90,6 +106,7 @@ define('composer/resize', function() {
|
||||
|
||||
var resizeActive = false,
|
||||
resizeOffset = 0,
|
||||
resizeDown = 0,
|
||||
resizeEl = postContainer.find('.resizer');
|
||||
|
||||
resizeEl.on('mousedown', resizeStart);
|
||||
@@ -118,4 +135,4 @@ define('composer/resize', function() {
|
||||
|
||||
|
||||
return resize;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user