Merge branch 'develop' into improve_cookies

This commit is contained in:
Stefan 2016-12-20 21:31:11 +01:00
commit aefa617797
63 changed files with 1191 additions and 284 deletions

View file

@ -369,6 +369,19 @@ function Ace2Inner(){
return thisAuthor;
}
var _nonScrollableEditEvents = {
"applyChangesToBase": 1
};
_.each(hooks.callAll('aceRegisterNonScrollableEditEvents'), function(eventType) {
_nonScrollableEditEvents[eventType] = 1;
});
function isScrollableEditEvent(eventType)
{
return !_nonScrollableEditEvents[eventType];
}
var currentCallStack = null;
function inCallStack(type, action)
@ -506,7 +519,7 @@ function Ace2Inner(){
{
updateBrowserSelectionFromRep();
}
if ((cs.docTextChanged || cs.userChangedSelection) && cs.type != "applyChangesToBase")
if ((cs.docTextChanged || cs.userChangedSelection) && isScrollableEditEvent(cs.type))
{
scrollSelectionIntoView();
}
@ -1442,16 +1455,6 @@ function Ace2Inner(){
var selection = getSelection();
p.end();
function topLevel(n)
{
if ((!n) || n == root) return null;
while (n.parentNode != root)
{
n = n.parentNode;
}
return n;
}
if (selection)
{
var node1 = topLevel(selection.startPoint.node);
@ -1473,12 +1476,8 @@ function Ace2Inner(){
var nds = root.getElementsByTagName("style");
for (var i = 0; i < nds.length; i++)
{
var n = nds[i];
while (n.parentNode && n.parentNode != root)
{
n = n.parentNode;
}
if (n.parentNode == root)
var n = topLevel(nds[i]);
if (n && n.parentNode == root)
{
observeChangesAroundNode(n);
}
@ -5021,6 +5020,23 @@ function Ace2Inner(){
if(e.target.a || e.target.localName === "a"){
e.preventDefault();
}
// Bug fix: when user drags some content and drop it far from its origin, we
// need to merge the changes into a single changeset. So mark origin with <style>,
// in order to make content be observed by incorporateUserChanges() (see
// observeSuspiciousNodes() for more info)
var selection = getSelection();
if (selection){
var firstLineSelected = topLevel(selection.startPoint.node);
var lastLineSelected = topLevel(selection.endPoint.node);
var lineBeforeSelection = firstLineSelected.previousSibling;
var lineAfterSelection = lastLineSelected.nextSibling;
var neighbor = lineBeforeSelection || lineAfterSelection;
neighbor.appendChild(document.createElement('style'));
}
// Call drop hook
hooks.callAll('aceDrop', {
editorInfo: editorInfo,
@ -5038,6 +5054,16 @@ function Ace2Inner(){
}
}
function topLevel(n)
{
if ((!n) || n == root) return null;
while (n.parentNode != root)
{
n = n.parentNode;
}
return n;
}
function handleIEOuterClick(evt)
{
if ((evt.target.tagName || '').toLowerCase() != "html")
@ -5433,7 +5459,16 @@ function Ace2Inner(){
// and the line-numbers don't line up unless we pay
// attention to where the divs are actually placed...
// (also: padding on TTs/SPANs in IE...)
h = b.nextSibling.offsetTop - b.offsetTop;
if (b === doc.body.firstChild) {
// It's the first line. For line number alignment purposes, its
// height is taken to be the top offset of the next line. If we
// didn't do this special case, we would miss out on any top margin
// included on the first line. The default stylesheet doesn't add
// extra margins, but plugins might.
h = b.nextSibling.offsetTop;
} else {
h = b.nextSibling.offsetTop - b.offsetTop;
}
}
if (h)
{

View file

@ -228,7 +228,7 @@ $(document).ready(function () {
if(data.code === "EPEERINVALID"){
alert("This plugin requires that you update Etherpad so it can operate in it's true glory");
}
alert('An error occured while installing '+data.plugin+' \n'+data.error)
alert('An error occurred while installing '+data.plugin+' \n'+data.error)
$('#installed-plugins .'+data.plugin).remove()
}
@ -241,7 +241,7 @@ $(document).ready(function () {
})
socket.on('finished:uninstall', function(data) {
if(data.error) alert('An error occured while uninstalling the '+data.plugin+' \n'+data.error)
if(data.error) alert('An error occurred while uninstalling the '+data.plugin+' \n'+data.error)
// remove plugin from installed list
$('#installed-plugins .'+data.plugin).remove()

View file

@ -14,12 +14,20 @@ $(document).ready(function () {
socket.on('settings', function (settings) {
/* Check whether the settings.json is authorized to be viewed */
if(settings.results === 'NOT_ALLOWED') {
$('.innerwrapper').hide();
$('.innerwrapper-err').show();
$('.err-message').html("Settings json is not authorized to be viewed in Admin page!!");
return;
}
/* Check to make sure the JSON is clean before proceeding */
if(isJSONClean(settings.results))
{
$('.settings').append(settings.results);
$('.settings').focus();
$('.settings').autosize();
$('.settings').autosize();
}
else{
alert("YOUR JSON IS BAD AND YOU SHOULD FEEL BAD");

View file

@ -265,7 +265,7 @@ linestylefilter.getRegexpFilter = function(regExp, tag)
linestylefilter.REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/;
linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#!;()\[\]$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')');
linestylefilter.REGEX_URLCHAR = new RegExp('(' + /[-:@a-zA-Z0-9_.,~%+\/\\?=&#!;()$]/.source + '|' + linestylefilter.REGEX_WORDCHAR.source + ')');
linestylefilter.REGEX_URL = new RegExp(/(?:(?:https?|s?ftp|ftps|file|nfs):\/\/|(about|geo|mailto|tel):|www\.)/.source + linestylefilter.REGEX_URLCHAR.source + '*(?![:.,;])' + linestylefilter.REGEX_URLCHAR.source, 'g');
linestylefilter.getURLFilter = linestylefilter.getRegexpFilter(
linestylefilter.REGEX_URL, 'url');

View file

@ -194,40 +194,27 @@ function handshake()
// Allow deployers to host Etherpad on a non-root path
'path': exports.baseURL + "socket.io",
'resource': resource,
'max reconnection attempts': 3,
'sync disconnect on unload' : false
'reconnectionAttempts': 5,
'reconnection' : true,
'reconnectionDelay' : 1000,
'reconnectionDelayMax' : 5000
});
var disconnectTimeout;
socket.once('connect', function () {
sendClientReady(false);
});
socket.on('reconnect', function () {
//reconnect is before the timeout, lets stop the timeout
if(disconnectTimeout)
{
clearTimeout(disconnectTimeout);
}
pad.collabClient.setChannelState("CONNECTED");
pad.sendClientReady(true);
});
socket.on('disconnect', function (reason) {
if(reason == "booted"){
pad.collabClient.setChannelState("DISCONNECTED");
} else {
function disconnectEvent()
{
pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
}
pad.collabClient.setChannelState("RECONNECTING");
disconnectTimeout = setTimeout(disconnectEvent, 20000);
}
socket.on('reconnecting', function() {
pad.collabClient.setChannelState("RECONNECTING");
});
socket.on('reconnect_failed', function(error) {
pad.collabClient.setChannelState("DISCONNECTED", "reconnect_timeout");
});
var initalized = false;
@ -731,6 +718,7 @@ var pad = {
var wasConnecting = (padconnectionstatus.getStatus().what == 'connecting');
if (newState == "CONNECTED")
{
padeditor.enable();
padconnectionstatus.connected();
}
else if (newState == "RECONNECTING")

View file

@ -242,9 +242,9 @@ var padeditbar = (function()
});
},
registerAceCommand: function (cmd, callback) {
this.registerCommand(cmd, function (cmd, ace) {
this.registerCommand(cmd, function (cmd, ace, item) {
ace.callWithAce(function (ace) {
callback(cmd, ace);
callback(cmd, ace, item);
}, cmd, true);
});
},

View file

@ -198,6 +198,13 @@ var padeditor = (function()
self.ace = null;
}
},
enable: function()
{
if (self.ace)
{
self.ace.setEditable(true);
}
},
disable: function()
{
if (self.ace)

View file

@ -523,7 +523,7 @@ function setupGlobalExceptionHandler() {
//show javascript errors to the user
$("#editorloadingbox").css("padding", "10px");
$("#editorloadingbox").css("padding-top", "45px");
$("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occured</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please press and hold Ctrl and press F5 to reload this page, if the problem persists please send this error message to your webmaster: </span><div style='color:black;font-size:14px'>'"
$("#editorloadingbox").html("<div style='text-align:left;color:red;font-size:16px;'><b>An error occurred</b><br>The error was reported with the following id: '" + errorId + "'<br><br><span style='color:black;font-weight:bold;font-size:16px'>Please press and hold Ctrl and press F5 to reload this page, if the problem persists please send this error message to your webmaster: </span><div style='color:black;font-size:14px'>'"
+ "ErrorId: " + errorId + "<br>URL: " + window.location.href + "<br>UserAgent: " + userAgent + "<br>" + msg + " in " + url + " at line " + linenumber + "'</div></div>");
}

View file

@ -117,13 +117,14 @@ exports.getPackages = function (cb) {
delete packages[name].parent;
}
if (deps[name].dependencies !== undefined) flatten(deps[name].dependencies);
// I don't think we need recursion
//if (deps[name].dependencies !== undefined) flatten(deps[name].dependencies);
});
}
var tmp = {};
tmp[data.name] = data;
flatten(tmp);
flatten(tmp[undefined].dependencies);
cb(null, packages);
});
};