diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-10-20 19:27:04 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-10-20 19:27:04 +0200 |
| commit | 10128fa7e8c743e9c838743204fb8116bcdeefd6 (patch) | |
| tree | 7ffbf2540d01f994886369bd551ea59f7e446040 /addons/web_editor/static | |
| parent | 68bef91d733aaf8f08df5f3daf0821a4c59d4d87 (diff) | |
| parent | dc2a6c6cd2a281b7d9e5d33d8e37d2f6b15d7e78 (diff) | |
[MERGE] forward port branch saas-16 up to dc2a6c6cd2a
Diffstat (limited to 'addons/web_editor/static')
4 files changed, 39 insertions, 3 deletions
diff --git a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js index 8b42726ff7a..955b49437a8 100644 --- a/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js +++ b/addons/web_editor/static/lib/summernote/src/js/module/Clipboard.js @@ -206,6 +206,18 @@ define([ r.select(); } + // If only pasting a <p/> element in an unique <p/> element, only paste + // the <p/> element text + var $p = $arch.children('p'); + var onlyAP = ($p.length === 1 && $arch.children().length === 1); + if (onlyAP) { + var $p1 = $(r.sc).closest('p'); + var $p2 = $(r.ec).closest('p'); + if ($p1.length && $p2.length && $p1[0] === $p2[0]) { + $arch.html($p.text()); + } + } + /* insert content */ diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js index f97a97b8b46..4d2f6fe977a 100644 --- a/addons/web_editor/static/src/js/editor/rte.js +++ b/addons/web_editor/static/src/js/editor/rte.js @@ -654,6 +654,28 @@ var RTEWidget = Widget.extend({ // 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(); + } + + // 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 && ev.originalEvent.detail === 3) { var currentSelection = range.create(); if (currentSelection.sc.parentNode === currentSelection.ec) { diff --git a/addons/web_editor/static/src/js/editor/rte.summernote.js b/addons/web_editor/static/src/js/editor/rte.summernote.js index 141fb6ea229..7f82df2cb28 100644 --- a/addons/web_editor/static/src/js/editor/rte.summernote.js +++ b/addons/web_editor/static/src/js/editor/rte.summernote.js @@ -446,7 +446,7 @@ $.summernote.pluginEvents.visible = function (event, editor, layoutInfo) { if (($node.is('[data-oe-type="html"]') || $node.is('[data-oe-field="arch"]')) && $node.hasClass("o_editable") && !$node[0].children.length && - "h1 h2 h3 h4 h5 h6 p b bold i u code sup strong small pre th td span".toUpperCase().indexOf($node[0].nodeName) === -1) { + "h1 h2 h3 h4 h5 h6 p b bold i u code sup strong small pre th td span label".toUpperCase().indexOf($node[0].nodeName) === -1) { var p = $('<p><br/></p>')[0]; $node.append( p ); range.createFromNode(p.firstChild).select(); @@ -761,7 +761,7 @@ eventHandler.attach = function (oLayoutInfo, options) { * Open Link Dialog on double click on a link/button. * Shows a tooltip on click to say to the user he can double click. */ - create_dblclick_feature("a[href], .btn", function () { + create_dblclick_feature("a[href], a.btn, button.btn", function () { eventHandler.modules.linkDialog.show(oLayoutInfo); }); 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 57c06c6f513..cfa9f683198 100644 --- a/addons/web_editor/static/src/less/web_editor.common.less +++ b/addons/web_editor/static/src/less/web_editor.common.less @@ -23,7 +23,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; |
