change way of post preview hiding; focus on textarea if it has some when switching

This commit is contained in:
Simon Grim 2015-08-20 17:31:16 +05:00
parent b12d3d450e
commit 65833ed34a

View File

@ -410,6 +410,10 @@ function reTwistPopup(event, post, textArea) {
});
} else {
replyArea.find('textarea').replaceWith(textArea);
if (textArea.val()) {
textArea.focus();
replyArea.addClass('open');
}
}
replyArea.find('.post-submit').addClass('with-reference');
}
@ -619,18 +623,18 @@ function posPostPreview(event) {
postPreview.width(textArea.width());
postPreview.width(postPreview.width() // width is not accurate if we do it with textArea.width() directly, don't know why
- postPreview.css('padding-left') - postPreview.css('padding-right'));
textArea.on('focusout', function () {$(this).siblings('#post-preview').hide();});
}
if (textArea[0].value.length)
postPreview.html(htmlFormatMsg(textArea[0].value).html).show();
else
postPreview.hide();
postPreview.slideUp('fast');
textArea.before(postPreview);
}
// Reduz Área do Novo post
function unfocusThis() {
$(this).removeClass('open');
$(this).removeClass('open')
.find('#post-preview').slideUp('fast');
}
function checkPostForMentions(post, mentions, max) {
@ -735,7 +739,7 @@ function replyTextInput(event) {
if (textArea[0].value.length)
textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show();
else
textAreaForm.find('#post-preview').html('').hide();
textAreaForm.find('#post-preview').html('').slideUp('fast');
}
}
@ -1255,7 +1259,7 @@ function postSubmit(e, oldLastPostId) {
var textArea = btnPostSubmit.closest('.post-area-new').find('textarea');
textArea.siblings('#post-preview').hide();
textArea.siblings('#post-preview').slideUp('fast');
var postData = btnPostSubmit.closest('.post-data');
if (!postData.length) {