mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-29 02:24:29 -05:00
Merge branch 'master' into webpack-frontend
This commit is contained in:
commit
2f11706dd2
4 changed files with 32 additions and 17 deletions
2
app.js
2
app.js
|
@ -512,7 +512,7 @@ process.on('SIGINT', function () {
|
||||||
if (history.isReady() && realtime.isReady()) {
|
if (history.isReady() && realtime.isReady()) {
|
||||||
models.Revision.checkAllNotesRevision(function (err, notes) {
|
models.Revision.checkAllNotesRevision(function (err, notes) {
|
||||||
if (err) throw new Error(err);
|
if (err) throw new Error(err);
|
||||||
if (notes.length <= 0) {
|
if (!notes || notes.length <= 0) {
|
||||||
clearInterval(checkCleanTimer);
|
clearInterval(checkCleanTimer);
|
||||||
return process.exit(0);
|
return process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,7 @@ function finishConnection(socket, note, user) {
|
||||||
// update user note history
|
// update user note history
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
|
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
|
||||||
history.updateHistory(user.userid, noteId, note.server.document);
|
if (note.server) history.updateHistory(user.userid, noteId, note.server.document);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
emitOnlineUsers(socket);
|
emitOnlineUsers(socket);
|
||||||
|
@ -669,7 +669,7 @@ function operationCallback(socket, operation) {
|
||||||
// update user note history
|
// update user note history
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
|
var noteId = note.alias ? note.alias : LZString.compressToBase64(note.id);
|
||||||
history.updateHistory(userId, noteId, note.server.document);
|
if (note.server) history.updateHistory(userId, noteId, note.server.document);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2870,14 +2870,14 @@ function sortOnlineUserList(list) {
|
||||||
else if (usera.idle && !userb.idle)
|
else if (usera.idle && !userb.idle)
|
||||||
return 1;
|
return 1;
|
||||||
else {
|
else {
|
||||||
if (usera.name.toLowerCase() < userb.name.toLowerCase()) {
|
if (usera.name && usera.name.toLowerCase() < userb.name.toLowerCase()) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (usera.name.toLowerCase() > userb.name.toLowerCase()) {
|
} else if (usera.name && usera.name.toLowerCase() > userb.name.toLowerCase()) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
if (usera.color.toLowerCase() < userb.color.toLowerCase())
|
if (usera.color && usera.color.toLowerCase() < userb.color.toLowerCase())
|
||||||
return -1;
|
return -1;
|
||||||
else if (usera.color.toLowerCase() > userb.color.toLowerCase())
|
else if (usera.color && usera.color.toLowerCase() > userb.color.toLowerCase())
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -863,9 +863,7 @@ if (typeof jQuery === 'undefined') {
|
||||||
//
|
//
|
||||||
// FIXME: Calculate the left top corner of `this.option.appendTo` element.
|
// FIXME: Calculate the left top corner of `this.option.appendTo` element.
|
||||||
getCaretPosition: function () {
|
getCaretPosition: function () {
|
||||||
//var position = this._getCaretRelativePosition();
|
if ($('.CodeMirror-cursor').length > 0) {
|
||||||
//var offset = this.$el.offset();
|
|
||||||
//var offset = $('.CodeMirror-cursor').offset();
|
|
||||||
var position = $('.CodeMirror-cursor').position();
|
var position = $('.CodeMirror-cursor').position();
|
||||||
var menu = $('.cursor-menu .dropdown-menu');
|
var menu = $('.cursor-menu .dropdown-menu');
|
||||||
var offsetLeft = parseFloat(menu.attr('data-offset-left'));
|
var offsetLeft = parseFloat(menu.attr('data-offset-left'));
|
||||||
|
@ -873,6 +871,23 @@ if (typeof jQuery === 'undefined') {
|
||||||
position.left += offsetLeft;
|
position.left += offsetLeft;
|
||||||
position.top += offsetTop;
|
position.top += offsetTop;
|
||||||
return position;
|
return position;
|
||||||
|
} else {
|
||||||
|
var position = this._getCaretRelativePosition();
|
||||||
|
var offset = this.$el.offset();
|
||||||
|
|
||||||
|
// Calculate the left top corner of `this.option.appendTo` element.
|
||||||
|
var $parent = this.option.appendTo;
|
||||||
|
if ($parent) {
|
||||||
|
if (!($parent instanceof $)) { $parent = $($parent); }
|
||||||
|
var parentOffset = $parent.offsetParent().offset();
|
||||||
|
offset.top -= parentOffset.top;
|
||||||
|
offset.left -= parentOffset.left;
|
||||||
|
}
|
||||||
|
|
||||||
|
position.top += offset.top;
|
||||||
|
position.left += offset.left;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Focus on the element.
|
// Focus on the element.
|
||||||
|
|
Loading…
Reference in a new issue