From 9ca22754328c96b98b7ae8d98e5f1ab0f6b9e291 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 17 Feb 2013 21:35:46 +0100 Subject: [PATCH 1/7] Fixes #1498: Two-part locale specs in lang cookie wouldn't be read correctly --- src/static/js/l10n.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/static/js/l10n.js b/src/static/js/l10n.js index a67a7c1a4..c79ea706d 100644 --- a/src/static/js/l10n.js +++ b/src/static/js/l10n.js @@ -1,8 +1,8 @@ (function(document) { // Set language for l10n - var language = document.cookie.match(/language=((\w{2,3})(-w+)?)/); + var language = document.cookie.match(/language=((\w{2,3})(-\w+)?)/); if(language) language = language[1]; - + html10n.bind('indexed', function() { html10n.localize([language, navigator.language, navigator.userLanguage, 'en']) }) From 7e023ce8e1093977717c930237693d0bb5b874c2 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 17 Feb 2013 21:03:19 +0000 Subject: [PATCH 2/7] make the focus jump back to the left if it's required --- src/static/js/ace2_inner.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 8209c9bf8..a4d3580a0 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -1622,10 +1622,19 @@ function Ace2Inner(){ lines = ccData.lines; var lineAttribs = ccData.lineAttribs; var linesWrapped = ccData.linesWrapped; + var scrollToTheLeftNeeded = false; if (linesWrapped > 0) { + if(browser.chrome){ + // chrome decides in it's infinite wisdom that its okay to put the browsers visisble window in the middle of the span + // an outcome of this is that the first chars of the string are no longer visible to the user.. Yay chrome.. + // Move the browsers visible area to the left hand side of the span + var scrollToTheLeftNeeded = true; + } // console.log("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines."); + }else{ + var scrollToTheLeftNeeded = false; } if (ss[0] >= 0) selStart = [ss[0] + a + netNumLinesChangeSoFar, ss[1]]; @@ -1692,6 +1701,10 @@ function Ace2Inner(){ //console.log("removed: "+id); }); + if(scrollToTheLeftNeeded){ // needed to stop chrome from breaking the ui when long strings without spaces are pasted + $("#innerdocbody").scrollLeft(0); + } + p.mark("findsel"); // if the nodes that define the selection weren't encountered during // content collection, figure out where those nodes are now. From 51a9ecf1f0ff9a4d3238b90f49a9e7de0809c412 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 17 Feb 2013 21:19:15 +0000 Subject: [PATCH 3/7] better support for other browsers --- src/static/js/ace2_inner.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index a4d3580a0..182e40be5 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -1626,15 +1626,14 @@ function Ace2Inner(){ if (linesWrapped > 0) { - if(browser.chrome){ + if(!browser.ie){ // chrome decides in it's infinite wisdom that its okay to put the browsers visisble window in the middle of the span // an outcome of this is that the first chars of the string are no longer visible to the user.. Yay chrome.. // Move the browsers visible area to the left hand side of the span + // Firefox isn't quite so bad, but it's still pretty quirky. var scrollToTheLeftNeeded = true; } // console.log("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines."); - }else{ - var scrollToTheLeftNeeded = false; } if (ss[0] >= 0) selStart = [ss[0] + a + netNumLinesChangeSoFar, ss[1]]; From 48ffbde7316a2aa21d76e300d0a272651b98b389 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 01:10:54 +0000 Subject: [PATCH 4/7] allow colon to indent line --- src/static/js/ace2_inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 70b5443bd..5c0af0f15 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -1897,7 +1897,7 @@ function Ace2Inner(){ var prevLine = rep.lines.prev(thisLine); var prevLineText = prevLine.text; var theIndent = /^ *(?:)/.exec(prevLineText)[0]; - if (/[\[\(\{]\s*$/.exec(prevLineText)) theIndent += THE_TAB; + if (/[\[\(\:\{]\s*$/.exec(prevLineText)) theIndent += THE_TAB; var cs = Changeset.builder(rep.lines.totalWidth()).keep( rep.lines.offsetOfIndex(lineNum), lineNum).insert( theIndent, [ From 77d03d34731f1ec12d77f82fe4c260c4bb9f559a Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 01:40:34 +0000 Subject: [PATCH 5/7] Try to add some sanity to indentation --- src/static/js/ace2_inner.js | 9 +++++---- src/static/js/pad_editbar.js | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 5c0af0f15..151a18068 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3287,7 +3287,7 @@ function Ace2Inner(){ listType = /([a-z]+)([12345678])/.exec(listType); var type = listType[1]; var level = Number(listType[2]); - + //detect empty list item; exclude indentation if(text === '*' && type !== "indent") { @@ -3317,8 +3317,10 @@ function Ace2Inner(){ function doIndentOutdent(isOut) { - if (!(rep.selStart && rep.selEnd) || - ((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) + if (!((rep.selStart && rep.selEnd) || + ((rep.selStart[0] == rep.selEnd[0]) && (rep.selStart[1] == rep.selEnd[1]) && rep.selEnd[1] > 1)) && + (isOut != true) + ) { return false; } @@ -3326,7 +3328,6 @@ function Ace2Inner(){ var firstLine, lastLine; firstLine = rep.selStart[0]; lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0)); - var mods = []; for (var n = firstLine; n <= lastLine; n++) { diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 91a07bf96..cc9f8758c 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -156,10 +156,7 @@ var padeditbar = (function() else if (cmd == 'insertorderedlist') ace.ace_doInsertOrderedList(); else if (cmd == 'indent') { - if (!ace.ace_doIndentOutdent(false)) - { - ace.ace_doInsertUnorderedList(); - } + ace.ace_doIndentOutdent(false); } else if (cmd == 'outdent') { From b30e1de3e50e718769627b68ee3d70c9988b2f89 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 15:12:11 +0000 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fa0da3639..aae935d66 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ documented codebase makes it easier for developers to improve the code and contr Etherpad Lite is designed to be easily embeddable and provides a [HTTP API](https://github.com/ether/etherpad-lite/wiki/HTTP-API) -that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. There is also a [jQuery plugin](https://github.com/johnyma22/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. +that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. There is also a [jQuery plugin](https://github.com/etherpad/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. There's also a full-featured plugin framework, allowing you to easily add your own features. Finally, Etherpad Lite comes with translations into tons of different languages! From abadfb7b6a2cb92f3fc736231ed2344e0344f32b Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 18 Feb 2013 15:12:37 +0000 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aae935d66..331353a3b 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ documented codebase makes it easier for developers to improve the code and contr Etherpad Lite is designed to be easily embeddable and provides a [HTTP API](https://github.com/ether/etherpad-lite/wiki/HTTP-API) -that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. There is also a [jQuery plugin](https://github.com/etherpad/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. +that allows your web application to manage pads, users and groups. It is recommended to use the [available client implementations](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) in order to interact with this API. There is also a [jQuery plugin](https://github.com/ether/etherpad-lite-jquery-plugin) that helps you to embed Pads into your website. There's also a full-featured plugin framework, allowing you to easily add your own features. Finally, Etherpad Lite comes with translations into tons of different languages!