From b85bd358234684974f9af63bc5f28cfabb527767 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Tue, 17 Oct 2017 11:11:34 +0200 Subject: [FIX] web_editor: fixed issue of chrome triple click Partial backport of 11.0 commit (https://github.com/odoo/odoo/commit/6ad2ae30354a77c0f898cb9cb5a859713061d71a) to solve issue 774152. Note: it has to be forward-ported as implementation has been improved to handle mass mailing cases. When an user triple-clicked on a paragraph and then typed text, the paragraph was removed instead of its content (so the new text was added at the beginning of the next paragraph). See: http://stackoverflow.com/questions/38467334/why-does-google-chrome-always-add-space-after-selected-text --- addons/web_editor/static/src/js/rte.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'addons/web_editor/static/src') diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js index 8eef4cfe3a6..37b87553506 100644 --- a/addons/web_editor/static/src/js/rte.js +++ b/addons/web_editor/static/src/js/rte.js @@ -586,6 +586,28 @@ var RTE = Widget.extend({ setTimeout(function () { self.historyRecordUndo($target, 'activate', true); },0); + + // 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 () { -- cgit v1.2.3 From c7f5ad87a4ee2b6fae845aba213ae6ebd41465e8 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 18 Oct 2017 11:18:45 +0200 Subject: [FIX] web_editor: odoo-made tables should not be layout: fixed --- addons/web_editor/static/src/less/web_editor.common.less | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web_editor/static/src') diff --git a/addons/web_editor/static/src/less/web_editor.common.less b/addons/web_editor/static/src/less/web_editor.common.less index 8b1b31e2334..a3b078808ee 100644 --- a/addons/web_editor/static/src/less/web_editor.common.less +++ b/addons/web_editor/static/src/less/web_editor.common.less @@ -24,7 +24,9 @@ html, body { /* ----- GENERIC LAYOUTING HELPERS ---- */ /* table */ #wrapwrap, .o_editable { - table.table { + // Only style editor-made tables (shop/portal/... tables are not supposed to + // use table-bordered...) + table.table.table-bordered { table-layout: fixed; td { min-width: 20px; -- cgit v1.2.3