Browse Source

dynamic width and margin for post preview, some other fixes

master
Simon Grim 9 years ago
parent
commit
4e7e09456f
  1. 14
      js/interface_common.js

14
js/interface_common.js

@ -581,9 +581,15 @@ function composeNewPost(e, postAreaNew) {
function posPostPreview(event) { function posPostPreview(event) {
var textArea = $(event.target); var textArea = $(event.target);
var postPreview = textArea.siblings('#post-preview'); var postPreview = textArea.siblings('#post-preview');
if (!postPreview.length) if (!postPreview.length) {
postPreview = $('#post-preview-template').children().clone(); postPreview = $('#post-preview-template').children().clone()
postPreview.html(htmlFormatMsg(textArea[0].value, [])) .css('margin-left', textArea.css('margin-left'))
.css('margin-right', textArea.css('margin-right'))
;
postPreview.css('width', textArea.css('width')
- postPreview.css('padding-left') - postPreview.css('padding-right'));
}
postPreview.html(htmlFormatMsg(textArea[0].value, [])).show();
textArea.before(postPreview); textArea.before(postPreview);
} }
@ -1207,6 +1213,8 @@ function postSubmit(e, oldLastPostId) {
var $replyText = $this.closest('.post-area-new').find('textarea'); var $replyText = $this.closest('.post-area-new').find('textarea');
$replyText.siblings('#post-preview').hide();
var $postOrig = $this.closest('.post-data'); var $postOrig = $this.closest('.post-data');
if (!$postOrig.length) { if (!$postOrig.length) {
$postOrig = $this.closest('.modal-content').find('.post-data'); $postOrig = $this.closest('.modal-content').find('.post-data');

Loading…
Cancel
Save