Browse Source

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

master
Simon Grim 9 years ago
parent
commit
65833ed34a
  1. 14
      js/interface_common.js

14
js/interface_common.js

@ -410,6 +410,10 @@ function reTwistPopup(event, post, textArea) {
}); });
} else { } else {
replyArea.find('textarea').replaceWith(textArea); replyArea.find('textarea').replaceWith(textArea);
if (textArea.val()) {
textArea.focus();
replyArea.addClass('open');
}
} }
replyArea.find('.post-submit').addClass('with-reference'); replyArea.find('.post-submit').addClass('with-reference');
} }
@ -619,18 +623,18 @@ function posPostPreview(event) {
postPreview.width(textArea.width()); 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.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')); - postPreview.css('padding-left') - postPreview.css('padding-right'));
textArea.on('focusout', function () {$(this).siblings('#post-preview').hide();});
} }
if (textArea[0].value.length) if (textArea[0].value.length)
postPreview.html(htmlFormatMsg(textArea[0].value).html).show(); postPreview.html(htmlFormatMsg(textArea[0].value).html).show();
else else
postPreview.hide(); postPreview.slideUp('fast');
textArea.before(postPreview); textArea.before(postPreview);
} }
// Reduz Área do Novo post // Reduz Área do Novo post
function unfocusThis() { function unfocusThis() {
$(this).removeClass('open'); $(this).removeClass('open')
.find('#post-preview').slideUp('fast');
} }
function checkPostForMentions(post, mentions, max) { function checkPostForMentions(post, mentions, max) {
@ -735,7 +739,7 @@ function replyTextInput(event) {
if (textArea[0].value.length) if (textArea[0].value.length)
textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show(); textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show();
else 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'); 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'); var postData = btnPostSubmit.closest('.post-data');
if (!postData.length) { if (!postData.length) {

Loading…
Cancel
Save