From 38499465c30bd7edfad351ab4949839d81cde545 Mon Sep 17 00:00:00 2001
From: John McLear
Date: Tue, 5 Mar 2013 19:01:22 +0000
Subject: [PATCH 1/7] fix chat simulation test to work in android
---
tests/frontend/specs/keystroke_chat.js | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/frontend/specs/keystroke_chat.js b/tests/frontend/specs/keystroke_chat.js
index 060c5aa2..e4908728 100644
--- a/tests/frontend/specs/keystroke_chat.js
+++ b/tests/frontend/specs/keystroke_chat.js
@@ -30,8 +30,9 @@ describe("send chat message", function(){
var usernameValue = username.text();
var time = $firstChatMessage.children(".time");
var timeValue = time.text();
- var expectedStringIncludingUserNameAndTime = usernameValue + timeValue + " " + "JohnMcLear";
- expect(expectedStringIncludingUserNameAndTime).to.be($firstChatMessage.text());
+ var discoveredValue = $firstChatMessage.text();
+ var chatMsgExists = (discoveredValue.indexOf("JohnMcLear") !== -1);
+ expect(chatMsgExists).to.be(true);
done();
});
@@ -61,6 +62,7 @@ describe("send chat message", function(){
expect(containsMessage).to.be(true);
done();
});
-
});
+
});
+
From f9f8b1c0794610f08cb41bd0d06a427719701ed1 Mon Sep 17 00:00:00 2001
From: John McLear
Date: Tue, 5 Mar 2013 20:30:31 +0000
Subject: [PATCH 2/7] allow chrome to do control z type functionality, not sure
why this was never in.. broken when we last updated jQ anyway
---
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 ddb614be..f2320926 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -3580,7 +3580,7 @@ function Ace2Inner(){
var specialHandled = false;
var isTypeForSpecialKey = ((browser.msie || browser.safari) ? (type == "keydown") : (type == "keypress"));
- var isTypeForCmdKey = ((browser.msie || browser.safari) ? (type == "keydown") : (type == "keypress"));
+ var isTypeForCmdKey = ((browser.msie || browser.safari || browser.chrome) ? (type == "keydown") : (type == "keypress"));
var stopped = false;
From 760e1b82c35598d7064ce8dee5421adcf2053ff7 Mon Sep 17 00:00:00 2001
From: Marcel Klehr
Date: Tue, 5 Mar 2013 23:12:00 +0100
Subject: [PATCH 3/7] Add a setting for RTL text direction (integrating the url
paramter)
Fixes #1191
---
doc/api/embed_parameters.md | 6 ++++++
src/locales/en.json | 1 +
src/static/js/pad.js | 2 +-
src/static/js/pad_editor.js | 22 ++++++++++++++++++++--
src/templates/pad.html | 4 ++++
5 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/doc/api/embed_parameters.md b/doc/api/embed_parameters.md
index 3100fff9..dcbe3e5b 100644
--- a/doc/api/embed_parameters.md
+++ b/doc/api/embed_parameters.md
@@ -60,3 +60,9 @@ Default: en
Example: `lang=ar` (translates the interface into Arabic)
+## rtl
+ * Boolean
+
+Default: true
+Displays pad text from right to left.
+
diff --git a/src/locales/en.json b/src/locales/en.json
index bef6dfd0..920a2b00 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -29,6 +29,7 @@
"pad.settings.stickychat": "Chat always on screen",
"pad.settings.colorcheck": "Authorship colors",
"pad.settings.linenocheck": "Line numbers",
+ "pad.settings.rtlcheck": "Read content from right to left?",
"pad.settings.fontType": "Font type:",
"pad.settings.fontType.normal": "Normal",
"pad.settings.fontType.monospaced": "Monospace",
diff --git a/src/static/js/pad.js b/src/static/js/pad.js
index 6e8b2ae0..4b052620 100644
--- a/src/static/js/pad.js
+++ b/src/static/js/pad.js
@@ -313,7 +313,7 @@ function handshake()
if (settings.rtlIsTrue == true)
{
- pad.changeViewOption('rtl', true);
+ pad.changeViewOption('rtlIsTrue', true);
}
// If the Monospacefont value is set to true then change it to monospace.
diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js
index dd0cbbbb..b73409ff 100644
--- a/src/static/js/pad_editor.js
+++ b/src/static/js/pad_editor.js
@@ -62,20 +62,36 @@ var padeditor = (function()
},
initViewOptions: function()
{
+ // Line numbers
padutils.bindCheckboxChange($("#options-linenoscheck"), function()
{
pad.changeViewOption('showLineNumbers', padutils.getCheckbox($("#options-linenoscheck")));
});
+
+ // Author colors
padutils.bindCheckboxChange($("#options-colorscheck"), function()
{
padcookie.setPref('showAuthorshipColors', padutils.getCheckbox("#options-colorscheck"));
pad.changeViewOption('showAuthorColors', padutils.getCheckbox("#options-colorscheck"));
});
+
+ // Right to left
+ padutils.bindCheckboxChange($("#options-rtlcheck"), function()
+ {
+ pad.changeViewOption('rtlIsTrue', padutils.getCheckbox($("#options-rtlcheck")))
+ });
+ html10n.bind('localized', function() {
+ pad.changeViewOption('rtlIsTrue', ('rtl' == html10n.getDirection()));
+ padutils.setCheckbox($("#options-rtlcheck"), ('rtl' == html10n.getDirection()));
+ })
+
+ // font face
$("#viewfontmenu").change(function()
{
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
});
+ // Language
html10n.bind('localized', function() {
$("#languagemenu").val(html10n.getLanguage());
// translate the value of 'unnamed' and 'Enter your name' textboxes in the userlist
@@ -104,12 +120,14 @@ var padeditor = (function()
if (value == "false") return false;
return defaultValue;
}
- self.ace.setProperty("rtlIsTrue", settings.rtlIsTrue);
var v;
- v = getOption('rtlIsTrue', false);
+ v = getOption('rtlIsTrue', ('rtl' == html10n.getDirection()));
+ // Override from parameters if true
+ if(settings.rtlIsTrue === true) v = true;
self.ace.setProperty("rtlIsTrue", v);
+ padutils.setCheckbox($("#options-rtlcheck"), v);
v = getOption('showLineNumbers', true);
self.ace.setProperty("showslinenumbers", v);
diff --git a/src/templates/pad.html b/src/templates/pad.html
index 76df5133..1d8c069a 100644
--- a/src/templates/pad.html
+++ b/src/templates/pad.html
@@ -217,6 +217,10 @@
+
+
+
+
<% e.end_block(); %>
<% e.begin_block("mySettings.dropdowns"); %>
From 5731ef78020095b55a58e41b9f3e0cf7335e97c5 Mon Sep 17 00:00:00 2001
From: Marcel Klehr
Date: Wed, 6 Mar 2013 15:40:02 +0100
Subject: [PATCH 4/7] Fix ace rtlIsTrue property setter
---
src/static/js/ace2_inner.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js
index f2320926..b8b59b84 100644
--- a/src/static/js/ace2_inner.js
+++ b/src/static/js/ace2_inner.js
@@ -959,7 +959,11 @@ function Ace2Inner(){
styled: setStyled,
textface: setTextFace,
textsize: setTextSize,
- rtlistrue: setClassPresenceNamed(root, "rtl")
+ rtlistrue: function(value) {
+ setClassPresence(root, "rtl", value)
+ setClassPresence(root, "ltr", !value)
+ document.documentElement.dir = value? 'rtl' : 'ltr'
+ }
};
var setter = setters[key.toLowerCase()];
From 1e94eaa06c776fa61ca1489b6672f63d4be50248 Mon Sep 17 00:00:00 2001
From: John McLear
Date: Wed, 6 Mar 2013 14:50:08 +0000
Subject: [PATCH 5/7] fix safari rtl dissapearing pad
---
src/static/css/pad.css | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/static/css/pad.css b/src/static/css/pad.css
index 6034b5ed..e536b925 100644
--- a/src/static/css/pad.css
+++ b/src/static/css/pad.css
@@ -179,6 +179,7 @@ a img {
width: 100%;
padding: 0;
margin: 0;
+ left: 0; /* Required for safari fixes RTL */
}
#editorloadingbox {
padding-top: 100px;
From 60df48e48508d910f72c14a576c6c2b94e093163 Mon Sep 17 00:00:00 2001
From: John McLear
Date: Wed, 6 Mar 2013 15:02:05 +0000
Subject: [PATCH 6/7] ltr test and fix rtl test
---
tests/frontend/specs/language.js | 34 +++++++++++++++++++++++++++++---
1 file changed, 31 insertions(+), 3 deletions(-)
diff --git a/tests/frontend/specs/language.js b/tests/frontend/specs/language.js
index 86d2d740..ab7f2b3d 100644
--- a/tests/frontend/specs/language.js
+++ b/tests/frontend/specs/language.js
@@ -93,8 +93,9 @@ describe("Language select and change", function(){
//select arabic
$languageoption.attr('selected','selected');
- $language.change();
-
+ $language.val("ar");
+ $languageoption.change();
+
helper.waitFor(function() {
return chrome$("html")[0]["dir"] != 'ltr';
})
@@ -104,5 +105,32 @@ describe("Language select and change", function(){
done();
});
});
-
+
+ it("changes direction when picking an ltr lang", function(done) {
+ var inner$ = helper.padInner$;
+ var chrome$ = helper.padChrome$;
+
+ //click on the settings button to make settings visible
+ var $settingsButton = chrome$(".buttonicon-settings");
+ $settingsButton.click();
+
+ //click the language button
+ var $language = chrome$("#languagemenu");
+ var $languageoption = $language.find("[value=en]");
+
+ //select english
+ //select arabic
+ $languageoption.attr('selected','selected');
+ $language.val("en");
+ $languageoption.change();
+
+ helper.waitFor(function() {
+ return chrome$("html")[0]["dir"] != 'rtl';
+ })
+ .done(function(){
+ // check if the document's direction was changed
+ expect(chrome$("html")[0]["dir"]).to.be("ltr");
+ done();
+ });
+ });
});
From 0c9214bb27ae1f2367995ffd55381f5b64d73714 Mon Sep 17 00:00:00 2001
From: John McLear
Date: Wed, 6 Mar 2013 15:08:27 +0000
Subject: [PATCH 7/7] bump v and changelog
---
CHANGELOG.md | 5 +++++
src/package.json | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1e4857bd..0fac58f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+# 1.2.81
+ * Fix: CtrlZ-Y for Undo Redo
+ * Fix: RTL functionality on contents & fix RTL/LTR tests and RTL in Safari
+ * Fix: Various other tests fixed in Android
+
# 1.2.8
! IMPORTANT: New setting.json value is required to automatically reconnect clients on disconnect
* NEW: Use Socket IO for rooms (allows for pads to be load balanced with sticky rooms)
diff --git a/src/package.json b/src/package.json
index 44d03d80..13a4de4c 100644
--- a/src/package.json
+++ b/src/package.json
@@ -45,5 +45,5 @@
"engines" : { "node" : ">=0.6.3",
"npm" : ">=1.0"
},
- "version" : "1.2.8"
+ "version" : "1.2.81"
}