From 0b6c71f688b6e8d2c067f943879099a554e88728 Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 11 Oct 2016 11:17:38 +0100 Subject: [PATCH 1/3] Patch Ace to fix accent key problem in Chrome --- services/web/public/js/ace-1.2.5/ace.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index 2b601cc9b9..713f82c218 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -34,6 +34,14 @@ * @param payload a function to call with (require, exports, module) params */ +// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. +// https://github.com/ajaxorg/ace/issues/3045 +var isChrome53PlusMatched = navigator.userAgent.match(/Chrome\/(.*?)(.|\s+|$)/); +var isChrome53Plus = false; +if (isChrome53PlusMatched) { + isChrome53Plus = isChrome53PlusMatched[1] >= 53; +} + (function() { var ACE_NAMESPACE = "ace"; @@ -2283,6 +2291,9 @@ var TextInput = function(parentNode, host) { if (e.type == "compositionend" && c.range) { host.selection.setRange(c.range); } + // WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. + // https://github.com/ajaxorg/ace/issues/3045 + if (isChrome53Plus) onInput(); }; From e26eda57540e779f762fff35bde824c85b4cdca4 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 11 Oct 2016 11:34:33 +0100 Subject: [PATCH 2/3] Update regex to grab Chrome version. --- services/web/public/js/ace-1.2.5/ace.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index 713f82c218..aeef9f6a85 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -34,16 +34,7 @@ * @param payload a function to call with (require, exports, module) params */ -// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. -// https://github.com/ajaxorg/ace/issues/3045 -var isChrome53PlusMatched = navigator.userAgent.match(/Chrome\/(.*?)(.|\s+|$)/); -var isChrome53Plus = false; -if (isChrome53PlusMatched) { - isChrome53Plus = isChrome53PlusMatched[1] >= 53; -} - (function() { - var ACE_NAMESPACE = "ace"; var global = (function() { return this; })(); @@ -1927,6 +1918,11 @@ var lang = require("../lib/lang"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; +// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. +// https://github.com/ajaxorg/ace/issues/3045 +var chromeVersion = navigator.userAgent.match(/Chrome\/(\d*)/)[1]; +var isChrome53Plus = (chromeVersion >= 53); + var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); text.className = "ace_text-input"; From 0fbbad33ffa0dbde4c468e4a50c286c58e500aae Mon Sep 17 00:00:00 2001 From: James Allen Date: Tue, 11 Oct 2016 11:40:26 +0100 Subject: [PATCH 3/3] Use built in Ace browser detection --- services/web/public/js/ace-1.2.5/ace.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/web/public/js/ace-1.2.5/ace.js b/services/web/public/js/ace-1.2.5/ace.js index aeef9f6a85..89bef3543d 100644 --- a/services/web/public/js/ace-1.2.5/ace.js +++ b/services/web/public/js/ace-1.2.5/ace.js @@ -35,6 +35,7 @@ */ (function() { + var ACE_NAMESPACE = "ace"; var global = (function() { return this; })(); @@ -1918,11 +1919,6 @@ var lang = require("../lib/lang"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; -// WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. -// https://github.com/ajaxorg/ace/issues/3045 -var chromeVersion = navigator.userAgent.match(/Chrome\/(\d*)/)[1]; -var isChrome53Plus = (chromeVersion >= 53); - var TextInput = function(parentNode, host) { var text = dom.createElement("textarea"); text.className = "ace_text-input"; @@ -2289,7 +2285,7 @@ var TextInput = function(parentNode, host) { } // WORKAROUND: Accent keys and Korean keys don't work in Chrome >53. // https://github.com/ajaxorg/ace/issues/3045 - if (isChrome53Plus) onInput(); + if (useragent.isChrome >= 53) onInput(); };