Browse Source

hide post preview if textarea is empty

master
Simon Grim 9 years ago
parent
commit
fe0a1e1d50
  1. 9
      js/interface_common.js

9
js/interface_common.js

@ -573,6 +573,7 @@ function composeNewPost(e, postAreaNew) {
var textArea = postAreaNew.find('textarea'); var textArea = postAreaNew.find('textarea');
if (textArea.attr('data-reply-to') && !textArea.val().length) { if (textArea.attr('data-reply-to') && !textArea.val().length) {
textArea.val(textArea.attr('data-reply-to')); textArea.val(textArea.attr('data-reply-to'));
posPostPreview(e);
} }
if (!postAreaNew.find('textarea:focus').length) if (!postAreaNew.find('textarea:focus').length)
postAreaNew.find('textarea:last').focus(); postAreaNew.find('textarea:last').focus();
@ -593,7 +594,10 @@ function posPostPreview(event) {
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'));
} }
if (textArea[0].value.length)
postPreview.html(htmlFormatMsg(textArea[0].value, [])).show(); postPreview.html(htmlFormatMsg(textArea[0].value, [])).show();
else
postPreview.hide();
textArea.before(postPreview); textArea.before(postPreview);
} }
@ -700,7 +704,10 @@ function replyTextInput(event) {
} }
} }
textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value, [])); if (textArea[0].value.length)
textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value, [])).show();
else
textAreaForm.find('#post-preview').html('').hide();
} }
function getPostSplitingPML() { function getPostSplitingPML() {

Loading…
Cancel
Save