mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-26 10:26:15 -04:00
Merge branch 'develop' of github.com:ether/etherpad-lite into keep-list-order-on-paste
This commit is contained in:
commit
7885c410b5
55 changed files with 5094 additions and 5118 deletions
|
@ -3651,7 +3651,7 @@ function Ace2Inner(){
|
|||
evt.preventDefault();
|
||||
var originalBackground = parent.parent.$('#revisionlink').css("background")
|
||||
parent.parent.$('#revisionlink').css({"background":"lightyellow"});
|
||||
top.setTimeout(function(){
|
||||
scheduler.setTimeout(function(){
|
||||
parent.parent.$('#revisionlink').css({"background":originalBackground});
|
||||
}, 1000);
|
||||
parent.parent.pad.collabClient.sendMessage({"type":"SAVE_REVISION"}); /* The parent.parent part of this is BAD and I feel bad.. It may break something */
|
||||
|
@ -5180,7 +5180,6 @@ function Ace2Inner(){
|
|||
{
|
||||
if(n > lineNumbersShown) //all updated, break
|
||||
break;
|
||||
|
||||
var h = (b.clientHeight || b.offsetHeight);
|
||||
if (b.nextSibling)
|
||||
{
|
||||
|
@ -5215,17 +5214,23 @@ function Ace2Inner(){
|
|||
var n = lineNumbersShown;
|
||||
var div = odoc.createElement("DIV");
|
||||
//calculate height for new line number
|
||||
var h = (b.clientHeight || b.offsetHeight);
|
||||
if(b){
|
||||
var h = (b.clientHeight || b.offsetHeight);
|
||||
|
||||
if (b.nextSibling)
|
||||
h = b.nextSibling.offsetTop - b.offsetTop;
|
||||
if (b.nextSibling){
|
||||
h = b.nextSibling.offsetTop - b.offsetTop;
|
||||
}
|
||||
}
|
||||
|
||||
if(h) // apply style to div
|
||||
if(h){ // apply style to div
|
||||
div.style.height = h +"px";
|
||||
|
||||
}
|
||||
|
||||
div.appendChild(odoc.createTextNode(String(n)));
|
||||
fragment.appendChild(div);
|
||||
b = b.nextSibling;
|
||||
if(b){
|
||||
b = b.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
container.appendChild(fragment);
|
||||
|
|
|
@ -295,7 +295,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
if (newRev != (oldRev + 1))
|
||||
{
|
||||
top.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (oldRev + 1));
|
||||
parent.parent.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (oldRev + 1));
|
||||
// setChannelState("DISCONNECTED", "badmessage_newchanges");
|
||||
return;
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
if (newRev != (rev + 1))
|
||||
{
|
||||
top.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (rev + 1));
|
||||
parent.parent.console.warn("bad message revision on NEW_CHANGES: " + newRev + " not " + (rev + 1));
|
||||
// setChannelState("DISCONNECTED", "badmessage_newchanges");
|
||||
return;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
{
|
||||
if (newRev != (msgQueue[msgQueue.length - 1].newRev + 1))
|
||||
{
|
||||
top.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (msgQueue[msgQueue.length - 1][0] + 1));
|
||||
parent.parent.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (msgQueue[msgQueue.length - 1][0] + 1));
|
||||
// setChannelState("DISCONNECTED", "badmessage_acceptcommit");
|
||||
return;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
|||
|
||||
if (newRev != (rev + 1))
|
||||
{
|
||||
top.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (rev + 1));
|
||||
parent.parent.console.warn("bad message revision on ACCEPT_COMMIT: " + newRev + " not " + (rev + 1));
|
||||
// setChannelState("DISCONNECTED", "badmessage_acceptcommit");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
/**
|
||||
* This code is mostly from the old Etherpad. Please help us to comment this code.
|
||||
* This helps other people to understand this code better and helps them to improve it.
|
||||
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS-IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function makeDraggable(jqueryNodes, eventHandler)
|
||||
{
|
||||
jqueryNodes.each(function()
|
||||
{
|
||||
var node = $(this);
|
||||
var state = {};
|
||||
var inDrag = false;
|
||||
|
||||
function dragStart(evt)
|
||||
{
|
||||
if (inDrag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inDrag = true;
|
||||
if (eventHandler('dragstart', evt, state) !== false)
|
||||
{
|
||||
$(document).bind('mousemove', dragUpdate);
|
||||
$(document).bind('mouseup', dragEnd);
|
||||
}
|
||||
evt.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function dragUpdate(evt)
|
||||
{
|
||||
if (!inDrag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
eventHandler('dragupdate', evt, state);
|
||||
evt.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function dragEnd(evt)
|
||||
{
|
||||
if (!inDrag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inDrag = false;
|
||||
try
|
||||
{
|
||||
eventHandler('dragend', evt, state);
|
||||
}
|
||||
finally
|
||||
{
|
||||
$(document).unbind('mousemove', dragUpdate);
|
||||
$(document).unbind('mouseup', dragEnd);
|
||||
evt.preventDefault();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
node.bind('mousedown', dragStart);
|
||||
});
|
||||
}
|
||||
|
||||
function makeResizableVPane(top, sep, bottom, minTop, minBottom, callback)
|
||||
{
|
||||
if (minTop === undefined) minTop = 0;
|
||||
if (minBottom === undefined) minBottom = 0;
|
||||
|
||||
makeDraggable($(sep), function(eType, evt, state)
|
||||
{
|
||||
if (eType == 'dragstart')
|
||||
{
|
||||
state.startY = evt.pageY;
|
||||
state.topHeight = $(top).height();
|
||||
state.bottomHeight = $(bottom).height();
|
||||
state.minTop = minTop;
|
||||
state.maxTop = (state.topHeight + state.bottomHeight) - minBottom;
|
||||
}
|
||||
else if (eType == 'dragupdate')
|
||||
{
|
||||
var change = evt.pageY - state.startY;
|
||||
|
||||
var topHeight = state.topHeight + change;
|
||||
if (topHeight < state.minTop)
|
||||
{
|
||||
topHeight = state.minTop;
|
||||
}
|
||||
if (topHeight > state.maxTop)
|
||||
{
|
||||
topHeight = state.maxTop;
|
||||
}
|
||||
change = topHeight - state.topHeight;
|
||||
|
||||
var bottomHeight = state.bottomHeight - change;
|
||||
var sepHeight = $(sep).height();
|
||||
|
||||
var totalHeight = topHeight + sepHeight + bottomHeight;
|
||||
topHeight = 100.0 * topHeight / totalHeight;
|
||||
sepHeight = 100.0 * sepHeight / totalHeight;
|
||||
bottomHeight = 100.0 * bottomHeight / totalHeight;
|
||||
|
||||
$(top).css('bottom', 'auto');
|
||||
$(top).css('height', topHeight + "%");
|
||||
$(sep).css('top', topHeight + "%");
|
||||
$(bottom).css('top', (topHeight + sepHeight) + '%');
|
||||
$(bottom).css('height', 'auto');
|
||||
if (callback) callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function makeResizableHPane(left, sep, right, minLeft, minRight, sepWidth, sepOffset, callback)
|
||||
{
|
||||
if (minLeft === undefined) minLeft = 0;
|
||||
if (minRight === undefined) minRight = 0;
|
||||
|
||||
makeDraggable($(sep), function(eType, evt, state)
|
||||
{
|
||||
if (eType == 'dragstart')
|
||||
{
|
||||
state.startX = evt.pageX;
|
||||
state.leftWidth = $(left).width();
|
||||
state.rightWidth = $(right).width();
|
||||
state.minLeft = minLeft;
|
||||
state.maxLeft = (state.leftWidth + state.rightWidth) - minRight;
|
||||
}
|
||||
else if (eType == 'dragend' || eType == 'dragupdate')
|
||||
{
|
||||
var change = evt.pageX - state.startX;
|
||||
|
||||
var leftWidth = state.leftWidth + change;
|
||||
if (leftWidth < state.minLeft)
|
||||
{
|
||||
leftWidth = state.minLeft;
|
||||
}
|
||||
if (leftWidth > state.maxLeft)
|
||||
{
|
||||
leftWidth = state.maxLeft;
|
||||
}
|
||||
change = leftWidth - state.leftWidth;
|
||||
|
||||
var rightWidth = state.rightWidth - change;
|
||||
newSepWidth = sepWidth;
|
||||
if (newSepWidth == undefined) newSepWidth = $(sep).width();
|
||||
newSepOffset = sepOffset;
|
||||
if (newSepOffset == undefined) newSepOffset = 0;
|
||||
|
||||
if (change == 0)
|
||||
{
|
||||
if (rightWidth != minRight || state.lastRightWidth == undefined)
|
||||
{
|
||||
state.lastRightWidth = rightWidth;
|
||||
rightWidth = minRight;
|
||||
}
|
||||
else
|
||||
{
|
||||
rightWidth = state.lastRightWidth;
|
||||
state.lastRightWidth = minRight;
|
||||
}
|
||||
change = state.rightWidth - rightWidth;
|
||||
leftWidth = change + state.leftWidth;
|
||||
}
|
||||
|
||||
var totalWidth = leftWidth + newSepWidth + rightWidth;
|
||||
leftWidth = 100.0 * leftWidth / totalWidth;
|
||||
newSepWidth = 100.0 * newSepWidth / totalWidth;
|
||||
newSepOffset = 100.0 * newSepOffset / totalWidth;
|
||||
rightWidth = 100.0 * rightWidth / totalWidth;
|
||||
|
||||
$(left).css('right', 'auto');
|
||||
$(left).css('width', leftWidth + "%");
|
||||
$(sep).css('left', (leftWidth + newSepOffset) + "%");
|
||||
$(right).css('left', (leftWidth + newSepWidth) + '%');
|
||||
$(right).css('width', 'auto');
|
||||
if (callback) callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.makeDraggable = makeDraggable;
|
|
@ -177,8 +177,7 @@ window.html10n = (function(window, document, undefined) {
|
|||
cb(new Error('A file couldn\'t be parsed as json.'))
|
||||
return
|
||||
}
|
||||
|
||||
if (!data[lang]) lang = lang.substr(0, lang.indexOf('-') == -1? lang.length : lang.indexOf('-'))
|
||||
|
||||
if (!data[lang]) {
|
||||
cb(new Error('Couldn\'t find translations for '+lang))
|
||||
return
|
||||
|
@ -667,7 +666,15 @@ window.html10n = (function(window, document, undefined) {
|
|||
var that = this
|
||||
// if only one string => create an array
|
||||
if ('string' == typeof langs) langs = [langs]
|
||||
|
||||
|
||||
// Expand two-part locale specs
|
||||
var i=0
|
||||
langs.forEach(function(lang) {
|
||||
if(!lang) return
|
||||
langs[i++] = lang
|
||||
if(~lang.indexOf('-')) langs[i++] = lang.substr(0, lang.indexOf('-'))
|
||||
})
|
||||
|
||||
this.build(langs, function(er, translations) {
|
||||
html10n.translations = translations
|
||||
html10n.translateElement(translations)
|
||||
|
|
|
@ -15,7 +15,21 @@ var withNpm = function (npmfn) {
|
|||
});
|
||||
}
|
||||
|
||||
var tasks = 0
|
||||
function wrapTaskCb(cb) {
|
||||
tasks++
|
||||
return function() {
|
||||
cb && cb.apply(this, arguments);
|
||||
tasks--;
|
||||
if(tasks == 0) onAllTasksFinished();
|
||||
}
|
||||
}
|
||||
function onAllTasksFinished() {
|
||||
hooks.aCallAll("restartServer", {}, function () {});
|
||||
}
|
||||
|
||||
exports.uninstall = function(plugin_name, cb) {
|
||||
cb = wrapTaskCb(cb);
|
||||
withNpm(function (er) {
|
||||
if (er) return cb && cb(er);
|
||||
npm.commands.uninstall([plugin_name], function (er) {
|
||||
|
@ -23,13 +37,13 @@ exports.uninstall = function(plugin_name, cb) {
|
|||
hooks.aCallAll("pluginUninstall", {plugin_name: plugin_name}, function (er, data) {
|
||||
if (er) return cb(er);
|
||||
plugins.update(cb);
|
||||
hooks.aCallAll("restartServer", {}, function () {});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports.install = function(plugin_name, cb) {
|
||||
cb = wrapTaskCb(cb)
|
||||
withNpm(function (er) {
|
||||
if (er) return cb && cb(er);
|
||||
npm.commands.install([plugin_name], function (er) {
|
||||
|
@ -37,7 +51,6 @@ exports.install = function(plugin_name, cb) {
|
|||
hooks.aCallAll("pluginInstall", {plugin_name: plugin_name}, function (er, data) {
|
||||
if (er) return cb(er);
|
||||
plugins.update(cb);
|
||||
hooks.aCallAll("restartServer", {}, function () {});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue