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) { @@ -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) { @@ -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) { @@ -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) { @@ -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) {

Loading…
Cancel
Save