diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-10-18 16:57:35 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-10-18 16:57:35 +0200 |
| commit | 25e65d2bcb18f8a39a288176ee28ac0cc1540050 (patch) | |
| tree | 0e7f68faa4e89aebc2d5f595e4bcae98d6f7f5d0 /addons/web_editor/static/src/js | |
| parent | d365a289d4ed3f557fa46155419f5f517860fe9c (diff) | |
| parent | 8096162beeed30debcb1c3945e7f9cee35710666 (diff) | |
[MERGE] forward port branch saas-15 up to 8096162beee
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/rte.js | 22 |
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 db26a7ccfae..f2fb2753642 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 () { |
