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

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

@ -68,8 +68,6 @@ var db = require('./database'),
messages.push(message); messages.push(message);
next(null); next(null);
}); });
}); });
} }
@ -95,8 +93,8 @@ var db = require('./database'),
} else { } else {
username = "<span class='chat-user'>" + tousername + "</span>: "; 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'), Messaging = require('../messaging'),
user = require('../user'), user = require('../user'),
notifications = require('../notifications'), notifications = require('../notifications'),
plugins = require('../plugins'),
async = require('async'), async = require('async'),
S = require('string'), S = require('string'),
@ -64,8 +65,7 @@ SocketModules.composer.editCheck = function(socket, pid, callback) {
}; };
SocketModules.composer.renderPreview = function(socket, content, callback) { SocketModules.composer.renderPreview = function(socket, content, callback) {
var preview = require('marked')(content); plugins.fireHook('filter:post.parse', content, callback);
callback(null, preview);
} }
/* Chat */ /* Chat */

Loading…
Cancel
Save