summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-10-18 14:34:32 +0200
committerChristophe Simonis <chs@odoo.com>2017-10-18 14:34:32 +0200
commita01e76efa71d4db2fa9de0095d13bdfc359f91f0 (patch)
tree87203bc32cbf3d0ef4b794f72b22065f62b5c7f9 /addons/web_editor/static/src/js
parent727a642f5c72ee34e9d6f3c7a507591d05d7d839 (diff)
parent2198220947e4334aba85e782665870ff37ea7736 (diff)
[MERGE] forward port branch 10.0 up to 2198220947e
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/rte.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js
index c7dc268251d..13eb568f9b7 100644
--- a/addons/web_editor/static/src/js/rte.js
+++ b/addons/web_editor/static/src/js/rte.js
@@ -578,6 +578,28 @@ var RTE = Widget.extend({
_.defer(function () {
self.historyRecordUndo($target, 'activate', true);
});
+
+ // To Fix Google Chrome Tripleclick Issue, which selects the ending
+ // whitespace characters (so Tripleclicking then typing text will remove
+ // the whole paragraph instead of its content).
+ // http://stackoverflow.com/questions/38467334/why-does-google-chrome-always-add-space-after-selected-text
+ if ($.browser.chrome === true && event.originalEvent.detail === 3) {
+ var currentSelection = range.create();
+ if (currentSelection.sc.parentNode === currentSelection.ec) {
+ _selectSC(currentSelection);
+ } else if (currentSelection.eo === 0) {
+ var $hasNext = $(currentSelection.sc).parent();
+ while (!$hasNext.next().length && !$hasNext.is('body')) {
+ $hasNext = $hasNext.parent();
+ }
+ if ($hasNext.next()[0] === currentSelection.ec) {
+ _selectSC(currentSelection);
+ }
+ }
+ }
+ function _selectSC(selection) {
+ range.create(selection.sc, selection.so, selection.sc, selection.sc.length).select();
+ }
},
editable: function () {