closes #792, fixes multiple composers

v1.18.x
Baris Soner Usakli 11 years ago
parent dc27638ca8
commit 0db6423c26

@ -286,11 +286,14 @@ define(['taskbar'], function(taskbar) {
postContainer.find('.nav-tabs a').click(function (e) { postContainer.find('.nav-tabs a').click(function (e) {
e.preventDefault(); e.preventDefault();
$(this).tab('show'); $(this).tab('show');
var selector = $(this).attr('data-pane');
postContainer.find('.tab-content div').removeClass('active');
postContainer.find(selector).addClass('active');
return false; return false;
}); });
postContainer.find('.nav-tabs a').on('shown.bs.tab', function (e) { postContainer.find('.nav-tabs a').on('shown.bs.tab', function (e) {
if($(e.target).attr('href') === '#preview') { if($(e.target).attr('data-pane') === '.tab-preview') {
socket.emit('modules.composer.renderPreview', bodyEl.val(), function(err, preview) { socket.emit('modules.composer.renderPreview', bodyEl.val(), function(err, preview) {
postContainer.find('.preview').html(preview); postContainer.find('.preview').html(preview);
}); });
@ -412,7 +415,9 @@ define(['taskbar'], function(taskbar) {
postContainer.find('.file-upload-btn').removeClass('hide'); postContainer.find('.file-upload-btn').removeClass('hide');
} }
postContainer.css('visibility', 'visible'); postContainer.css('visibility', 'visible')
.css('z-index', 1);
composer.focusElements(post_uuid); composer.focusElements(post_uuid);
} }

@ -24,15 +24,15 @@
</div> </div>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a href="#write" data-toggle="tab">Write</a></li> <li class="active"><a data-pane=".tab-write" data-toggle="tab">Write</a></li>
<li><a href="#preview" data-toggle="tab">Preview</a></li> <li><a data-pane=".tab-preview" data-toggle="tab">Preview</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="write"> <div class="tab-pane active tab-write">
<textarea class="write" tabIndex="2"></textarea> <textarea class="write" tabIndex="2"></textarea>
</div> </div>
<div class="tab-pane" id="preview"> <div class="tab-pane tab-preview">
<div class="preview well"></div> <div class="preview well"></div>
</div> </div>
</div> </div>

Loading…
Cancel
Save