Merge branch 'develop' of github.com:ether/etherpad-lite into develop

This commit is contained in:
John McLear 2015-01-24 02:20:34 +00:00
commit 4fa47ea969
20 changed files with 147 additions and 69 deletions

View File

@ -1,6 +1,31 @@
# Developer Guidelines
(Please talk to people on the mailing list before you change this page, see our section on [how to get in touch](https://github.com/ether/etherpad-lite#get-in-touch))
## How to write a bug report
* Please be polite, we all are humans and problems can occur.
* Please add as much information as possible, for example
* client os(s) and version(s)
* browser(s) and version(s), is the problem reproduceable on different clients
* special environments like firewalls or antivirus
* host os and version
* npm and nodejs version
* Logfiles if available
* steps to reproduce
* what you expected to happen
* what actually happened
* Please format logfiles and code examples with markdown see github Markdown help below the issue textarea for more information.
If you send logfiles, please set the loglevel switch DEBUG in your settings.json file:
```
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
"loglevel": "DEBUG",
```
The logfile location is defined in startup script or the log is directly shown in the commandline after you have started etherpad.
## Important note for pull requests
**Pull requests should be issued against the develop branch**. We never pull directly into master.

View File

@ -32,6 +32,7 @@
"pad.settings.padSettings": "Pad Settings",
"pad.settings.myView": "My View",
"pad.settings.stickychat": "Chat always on screen",
"pad.settings.chatandusers": "Show Chat and Users",
"pad.settings.colorcheck": "Authorship colors",
"pad.settings.linenocheck": "Line numbers",
"pad.settings.rtlcheck": "Read content from right to left?",
@ -120,6 +121,7 @@
"timeslider.unnamedauthors": "{{num}} unnamed {[plural(num) one: author, other: authors ]}",
"pad.savedrevs.marked": "This revision is now marked as a saved revision",
"pad.savedrevs.timeslider": "You can see saved revisions by visiting the timeslider",
"pad.userlist.entername": "Enter your name",
"pad.userlist.unnamed": "unnamed",
"pad.userlist.guest": "Guest",

View File

@ -30,8 +30,6 @@ function getPadHTML(pad, revNum, callback)
var html;
async.waterfall([
// fetch revision atext
function (callback)
{
if (revNum != undefined)
@ -416,6 +414,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
var lineContentFromHook = hooks.callAllStr("getLineHTMLForExport",
{
line: line,
lineContent: lineContent,
apool: apool,
attribLine: attribLines[i],
text: textLines[i]

View File

@ -17,7 +17,7 @@
"etherpad-require-kernel" : "1.0.7",
"resolve" : "1.0.0",
"socket.io" : "1.3.2",
"ueberDB" : "0.2.10",
"ueberDB" : "0.2.11",
"express" : "3.8.1",
"async" : "0.9.0",
"connect" : "2.7.11",
@ -55,5 +55,5 @@
"repository" : { "type" : "git",
"url" : "http://github.com/ether/etherpad-lite.git"
},
"version" : "1.5.0"
"version" : "1.5.1"
}

View File

@ -914,6 +914,36 @@ input[type=checkbox] {
border-left: 1px solid #ccc !important;
width: 185px !important;
}
.chatAndUsers{
display:block !important;
right:0px !important;
border-radius:0px !important;
width:182px !important;
margin:2px 0 0 0 !important;
border: none !important;
border-bottom: 1px solid #ccc !important;
height:155px !important;
border-left: 1px solid #ccc !important;
}
.chatAndUsers > #otherusers{
max-height: 100px;
overflow-y: auto;
}
.chatAndUsersChat > div > #titlecross{
display:none;
}
.chatAndUsersChat{
bottom:0px !important;
padding:0 !important;
margin:0 !important;
right:0 !important;
top: 200px !important;
width:182px !important;
border: none !important;
padding:5px !important;
border-left: 1px solid #ccc !important;
}
@media screen and (max-width: 600px) {
.toolbar ul li.separator {
display: none;

View File

@ -21,6 +21,17 @@
*/
var _, $, jQuery, plugins, Ace2Common;
var browser = require('./browser').browser;
if(browser.msie){
// Honestly fuck IE royally.
// Basically every hack we have since V11 causes a problem
if(parseInt(browser.version) >= 11){
delete browser.msie;
browser.chrome = true;
browser.modernIE = true;
}
}
Ace2Common = require('./ace2_common');
plugins = require('ep_etherpad-lite/static/js/pluginfw/client_plugins');
@ -34,8 +45,7 @@ var isNodeText = Ace2Common.isNodeText,
binarySearchInfinite = Ace2Common.binarySearchInfinite,
htmlPrettyEscape = Ace2Common.htmlPrettyEscape,
noop = Ace2Common.noop;
var hooks = require('./pluginfw/hooks');
var browser = require('./browser').browser;
var hooks = require('./pluginfw/hooks');
function Ace2Inner(){
@ -1353,7 +1363,7 @@ function Ace2Inner(){
// (from how it looks in our representation) and record them in a way
// that can be used to "normalize" the document (apply the changes to our
// representation, and put the DOM in a canonical form).
//top.console.log("observeChangesAroundNode(%o)", node);
// top.console.log("observeChangesAroundNode(%o)", node);
var cleanNode;
var hasAdjacentDirtyness;
if (!isNodeDirty(node))
@ -2960,7 +2970,6 @@ function Ace2Inner(){
{
return "";
};
return result;
}
else
@ -3584,8 +3593,7 @@ function Ace2Inner(){
// On Mac and Linux, move right moves to end of word and move left moves to start;
// on Windows, always move to start of word.
// On Windows, Firefox and IE disagree on whether to stop for punctuation (FF says no).
/*
if (browser.windows && forwardNotBack)
if (browser.msie && forwardNotBack)
{
while ((!isDone()) && isWordChar(nextChar()))
{
@ -3607,7 +3615,6 @@ function Ace2Inner(){
advance();
}
}
*/
return i;
}
@ -3627,7 +3634,6 @@ function Ace2Inner(){
evt.preventDefault();
return;
}
// Is caret potentially hidden by the chat button?
var myselection = document.getSelection(); // get the current caret selection
var caretOffsetTop = myselection.focusNode.parentNode.offsetTop | myselection.focusNode.offsetTop; // get the carets selection offset in px IE 214
@ -3665,7 +3671,6 @@ function Ace2Inner(){
var specialHandled = false;
var isTypeForSpecialKey = ((browser.msie || browser.safari || browser.chrome) ? (type == "keydown") : (type == "keypress"));
var isTypeForCmdKey = ((browser.msie || browser.safari || browser.chrome) ? (type == "keydown") : (type == "keypress"));
var stopped = false;
inCallStackIfNecessary("handleKeyEvent", function()
@ -3915,10 +3920,10 @@ function Ace2Inner(){
// only move the viewport if we're at the bottom of the viewport, if we hit down any other time the viewport shouldn't change
// NOTE: This behavior only fires if Chrome decides to break the page layout after a paste, it's annoying but nothing I can do
var selection = getSelection();
top.console.log("line #", rep.selStart[0]); // the line our caret is on
top.console.log("firstvisible", visibleLineRange[0]); // the first visiblel ine
top.console.log("lastVisible", visibleLineRange[1]); // the last visible line
top.console.log(rep.selStart[0], visibleLineRange[1], rep.selStart[0], visibleLineRange[0]);
// top.console.log("line #", rep.selStart[0]); // the line our caret is on
// top.console.log("firstvisible", visibleLineRange[0]); // the first visiblel ine
// top.console.log("lastVisible", visibleLineRange[1]); // the last visible line
// top.console.log(rep.selStart[0], visibleLineRange[1], rep.selStart[0], visibleLineRange[0]);
var newY = viewport.top + lineHeight;
}
if(newY){
@ -3952,7 +3957,7 @@ function Ace2Inner(){
}
// Is part of multi-keystroke international character on Firefox Mac
var isFirefoxHalfCharacter = (browser.mozilla && evt.altKey && charCode === 0 && keyCode === 0);
var isFirefoxHalfCharacter = (browser.firefox && evt.altKey && charCode === 0 && keyCode === 0);
// Is part of multi-keystroke international character on Safari Mac
var isSafariHalfCharacter = (browser.safari && evt.altKey && keyCode == 229);
@ -4267,12 +4272,6 @@ function Ace2Inner(){
end.collapse(false);
selection.startPoint = pointFromCollapsedRange(start);
selection.endPoint = pointFromCollapsedRange(end);
/*if ((!selection.startPoint.node.isText) && (!selection.endPoint.node.isText)) {
console.log(selection.startPoint.node.uniqueId()+","+
selection.startPoint.index+" / "+
selection.endPoint.node.uniqueId()+","+
selection.endPoint.index);
}*/
}
return selection;
}
@ -4684,7 +4683,7 @@ function Ace2Inner(){
setIfNecessary(iframe.style, "width", newWidth + "px");
setIfNecessary(sideDiv.style, "height", newHeight + "px");
}
if (browser.mozilla)
if (browser.firefox)
{
if (!doesWrap)
{
@ -4870,7 +4869,7 @@ function Ace2Inner(){
})
// CompositionEvent is not implemented below IE version 8
if ( !(browser.msie && parseInt(browser.version) < 9) && document.documentElement)
if ( !(browser.msie && parseInt(browser.version <= 9)) && document.documentElement)
{
$(document.documentElement).on("compositionstart", handleCompositionEvent);
$(document.documentElement).on("compositionend", handleCompositionEvent);
@ -5333,20 +5332,9 @@ function Ace2Inner(){
{
var body = doc.getElementById("innerdocbody");
root = body; // defined as a var in scope outside
if (browser.mozilla) $(root).addClass("mozilla");
if (browser.firefox) $(root).addClass("mozilla");
if (browser.safari) $(root).addClass("safari");
if (browser.msie) $(root).addClass("msie");
if (browser.msie)
{
// cache CSS background images
try
{
doc.execCommand("BackgroundImageCache", false, true);
}
catch (e)
{ /* throws an error in some IE 6 but not others! */
}
}
setClassPresence(root, "authorColors", true);
setClassPresence(root, "doesWrap", doesWrap);

View File

@ -66,18 +66,6 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro
}
}
// for IE
if (browser.msie)
{
try
{
document.execCommand("BackgroundImageCache", false, true);
}
catch (e)
{}
}
//var socket;
var channelState = "DISCONNECTED";

View File

@ -54,6 +54,22 @@ var chat = (function()
isStuck = false;
}
},
chatAndUsers: function(fromInitialCall)
{
if(fromInitialCall || $('#options-chatandusers').prop('checked')){
padcookie.setPref("chatAndUsers", true);
chat.stickToScreen(true);
$('#options-stickychat').prop('checked', true)
$('#options-stickychat').prop("disabled", "disabled");
$('#users').addClass("chatAndUsers");
$("#chatbox").addClass("chatAndUsersChat");
}else{
padcookie.setPref("chatAndUsers", false);
$('#options-stickychat').prop("disabled", false);
$('#users').removeClass("chatAndUsers");
$("#chatbox").removeClass("chatAndUsersChat");
}
},
hide: function ()
{
// decide on hide logic based on chat window being maximized or not

View File

@ -81,8 +81,7 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
onServerMessage: function()
{}
};
if (browser.mozilla)
if (browser.firefox)
{
// Prevent "escape" from taking effect and canceling a comet connection;
// doesn't work if focus is on an iframe.

View File

@ -35,9 +35,10 @@ function sanitizeUnicode(s)
return UNorm.nfc(s);
}
function makeContentCollector(collectStyles, browser, apool, domInterface, className2Author)
function makeContentCollector(collectStyles, abrowser, apool, domInterface, className2Author)
{
browser = browser || {};
abrowser = abrowser || {};
// I don't like the above.
var dom = domInterface || {
isNodeText: function(n)
@ -484,7 +485,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
var cls = dom.nodeProp(node, "className");
var isPre = (tname == "pre");
if ((!isPre) && browser.safari)
if ((!isPre) && abrowser.safari)
{
isPre = (styl && /\bwhite-space:\s*pre\b/i.exec(styl));
}
@ -610,7 +611,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
}
}
}
if (!browser.msie)
if (!abrowser.msie)
{
_reachBlockPoint(node, 1, state);
}
@ -625,7 +626,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
_ensureColumnZero(state);
}
}
if (browser.msie)
if (abrowser.msie)
{
// in IE, a point immediately after a DIV appears on the next line
_reachBlockPoint(node, 1, state);

View File

@ -65,7 +65,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
lineMarker: 0
};
var browser = (optBrowser || {});
var document = optDocument;
if (document)
@ -93,8 +92,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
var perTextNodeProcess = (doesWrap ? _.identity : processSpaces);
var perHtmlLineProcess = (doesWrap ? processSpaces : _.identity);
var lineClass = 'ace-line';
result.appendSpan = function(txt, cls)
{
var processedMarker = false;
// Handle lineAttributeMarker, if present
if (cls.indexOf(lineAttributeMarker) >= 0)
@ -225,7 +226,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
{
newHTML += '&nbsp;';
}
else
else if (!optBrowser.msie)
{
newHTML += '<br/>';
}

View File

@ -318,20 +318,20 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt)
return spanHandler;
};
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, abrowser)
{
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
var hookFilters = hooks.callAll("aceGetFilterStack", {
linestylefilter: linestylefilter,
browser: browser
browser: abrowser
});
_.map(hookFilters ,function(hookFilter)
{
func = hookFilter(lineText, func);
});
if (browser !== undefined && browser.msie)
if (abrowser !== undefined && abrowser.msie)
{
// IE7+ will take an e-mail address like <foo@bar.com> and linkify it to foo@bar.com.
// We then normalize it back to text with no angle brackets. It's weird. So always

View File

@ -120,6 +120,7 @@ var getParameters = [
{ name: "userColor", checkVal: null, callback: function(val) { settings.globalUserColor = decodeURIComponent(val); } },
{ name: "rtl", checkVal: "true", callback: function(val) { settings.rtlIsTrue = true } },
{ name: "alwaysShowChat", checkVal: "true", callback: function(val) { chat.stickToScreen(); } },
{ name: "chatAndUsers", checkVal: "true", callback: function(val) { chat.chatAndUsers(); } },
{ name: "lang", checkVal: null, callback: function(val) { window.html10n.localize([val, 'en']); } }
];
@ -494,7 +495,7 @@ var pad = {
pad.initTime = +(new Date());
pad.padOptions = clientVars.initialOptions;
if ((!browser.msie) && (!(browser.mozilla && browser.version.indexOf("1.8.") == 0)))
if ((!browser.msie) && (!(browser.firefox && browser.version.indexOf("1.8.") == 0)))
{
document.domain = document.domain; // for comet
}
@ -562,6 +563,10 @@ var pad = {
chat.stickToScreen(true); // stick it to the screen
$('#options-stickychat').prop("checked", true); // set the checkbox to on
}
if(padcookie.getPref("chatAndUsers")){ // if we have a cookie for always showing chat then show it
chat.chatAndUsers(true); // stick it to the screen
$('#options-chatandusers').prop("checked", true); // set the checkbox to on
}
if(padcookie.getPref("showAuthorshipColors") == false){
pad.changeViewOption('showAuthorColors', false);
}
@ -779,6 +784,7 @@ var pad = {
handleIsFullyConnected: function(isConnected, isInitialConnect)
{
pad.determineChatVisibility(isConnected && !isInitialConnect);
pad.determineChatAndUsersVisibility(isConnected && !isInitialConnect);
pad.determineAuthorshipColorsVisibility();
},
determineChatVisibility: function(asNowConnectedFeedback){
@ -791,6 +797,16 @@ var pad = {
$('#options-stickychat').prop("checked", false); // set the checkbox for off
}
},
determineChatAndUsersVisibility: function(asNowConnectedFeedback){
var chatAUVisCookie = padcookie.getPref('chatAndUsersVisible');
if(chatAUVisCookie){ // if the cookie is set for chat always visible
chat.chatAndUsers(true); // stick it to the screen
$('#options-chatandusers').prop("checked", true); // set the checkbox to on
}
else{
$('#options-chatandusers').prop("checked", false); // set the checkbox for off
}
},
determineAuthorshipColorsVisibility: function(){
var authColCookie = padcookie.getPref('showAuthorshipColors');
if (authColCookie){

View File

@ -18,7 +18,16 @@ var pad;
exports.saveNow = function(){
pad.collabClient.sendMessage({"type": "SAVE_REVISION"});
alert(_("pad.savedrevs.marked"));
$.gritter.add({
// (string | mandatory) the heading of the notification
title: _("pad.savedrevs.marked"),
// (string | mandatory) the text inside the notification
text: _("pad.savedrevs.timeslider") || "You can view saved revisions in the timeslider",
// (bool | optional) if you want it to fade out on its own or just sit there
sticky: false,
// (int | optional) the time you want it to be alive for before fading out
time: '2000'
});
}
exports.init = function(_pad){

View File

@ -133,6 +133,10 @@
<input type="checkbox" id="options-stickychat" onClick="chat.stickToScreen();">
<label for="options-stickychat" data-l10n-id="pad.settings.stickychat"></label>
</p>
<p>
<input type="checkbox" id="options-chatandusers" onClick="chat.chatAndUsers();">
<label for="options-chatandusers" data-l10n-id="pad.settings.chatandusers"></label>
</p>
<p>
<input type="checkbox" id="options-colorscheck">
<label for="options-colorscheck" data-l10n-id="pad.settings.colorcheck"></label>

View File

@ -44,7 +44,7 @@ describe("bold button", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -297,7 +297,7 @@ function prepareDocument(n, target){ // generates a random document with random
}
function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -15,7 +15,7 @@ describe("indentation button", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -44,7 +44,7 @@ describe("italic some text", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -47,7 +47,7 @@ describe("undo button then redo button", function(){
var modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE
if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.modernIE){ // if it's a mozilla or IE
var evtType = "keypress";
}else{
var evtType = "keydown";