v1.18.x
Baris Soner Usakli 11 years ago
parent 0397773b22
commit 959e6e83ea

@ -292,12 +292,10 @@ define(['taskbar'], function(taskbar) {
return false;
});
postContainer.find('.nav-tabs a').on('shown.bs.tab', function (e) {
if($(e.target).attr('data-pane') === '.tab-preview') {
bodyEl.on('blur', function() {
socket.emit('modules.composer.renderPreview', bodyEl.val(), function(err, preview) {
postContainer.find('.preview').html(preview);
});
}
});
@ -305,20 +303,19 @@ define(['taskbar'], function(taskbar) {
resizeCenterY = 0,
resizeOffset = 0,
resizeStart = function(e) {
bodyRect = document.body.getBoundingClientRect();
resizeRect = resizeEl.getBoundingClientRect();
resizeCenterY = resizeRect.top + (resizeRect.height/2);
resizeOffset = resizeCenterY - e.clientY;
resizeActive = true;
$(document.body).on('mousemove', resizeAction);
$(document.body).on('mouseup', resizeStop);
$(window).on('mousemove', resizeAction);
$(window).on('mouseup', resizeStop);
document.body.addEventListener('touchmove', resizeTouchAction);
},
resizeStop = function() {
resizeActive = false;
$(document.body).off('mousemove', resizeAction);
$(document.body).off('mouseup', resizeStop);
$(window).off('mousemove', resizeAction);
$(window).off('mouseup', resizeStop);
document.body.removeEventListener('touchmove', resizeTouchAction);
},
resizeTouchAction = function(e) {
@ -328,17 +325,21 @@ define(['taskbar'], function(taskbar) {
resizeAction = function(e) {
if (resizeActive) {
position = (e.clientY + resizeOffset);
postContainer.css('height', $(window).height() - position);
resizeSavePosition($(window).height() - position);
var newHeight = $(window).height() - position;
if(newHeight > $(window).height() - $('#header-menu').height() - 20) {
newHeight = $(window).height() - $('#header-menu').height() - 20;
}
postContainer.css('height', newHeight);
resizeSavePosition(newHeight);
}
e.preventDefault();
return false;
},
resizeSavePosition = function(px) {
var percentage = px / $(window).height();
localStorage.setItem('composer:resizePercentage', percentage);
},
resizeRect, bodyRect;
resizeRect;
var resizeEl = postContainer.find('.resizer')[0];

@ -68,8 +68,6 @@ var db = require('./database'),
messages.push(message);
next(null);
});
});
}
@ -95,8 +93,8 @@ var db = require('./database'),
} else {
username = "<span class='chat-user'>" + tousername + "</span>: ";
}
var result = username + parsed;
callback(result);
callback(username + parsed);
});
};

@ -7,6 +7,7 @@ var posts = require('../posts'),
Messaging = require('../messaging'),
user = require('../user'),
notifications = require('../notifications'),
plugins = require('../plugins'),
async = require('async'),
S = require('string'),
@ -64,8 +65,7 @@ SocketModules.composer.editCheck = function(socket, pid, callback) {
};
SocketModules.composer.renderPreview = function(socket, content, callback) {
var preview = require('marked')(content);
callback(null, preview);
plugins.fireHook('filter:post.parse', content, callback);
}
/* Chat */

Loading…
Cancel
Save