diff --git a/addons/web_editor/static/src/js/rte.js b/addons/web_editor/static/src/js/rte.js index 0e559b6664f..92ab133263a 100644 --- a/addons/web_editor/static/src/js/rte.js +++ b/addons/web_editor/static/src/js/rte.js @@ -535,7 +535,6 @@ var RTE = Widget.extend({ } if ($editable.length && (!this.$last || this.$last[0] !== $editable[0]) && ($target.closest('[contenteditable]').attr('contenteditable') || "").toLowerCase() !== 'false') { - $editable.summernote(this.config($editable)); $editable.data('NoteHistory', history); @@ -578,6 +577,17 @@ 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) { + range.create(currentSelection.sc, currentSelection.so, currentSelection.sc, currentSelection.sc.length).select(); + } + } }, editable: function () { diff --git a/addons/web_editor/static/src/js/rte.summernote.js b/addons/web_editor/static/src/js/rte.summernote.js index 4ab1e7bed06..979211cd4d7 100644 --- a/addons/web_editor/static/src/js/rte.summernote.js +++ b/addons/web_editor/static/src/js/rte.summernote.js @@ -67,8 +67,8 @@ renderer.createPalette = function ($container, options) { var $palettes = $container.find(".note-color .note-color-palette"); $palettes.prepend(html); - var $bg = $palettes.first().find("button:not(.note-color-btn)").addClass("note-color-btn"); - var $fore = $palettes.last().find("button:not(.note-color-btn)").addClass("note-color-btn"); + var $bg = $palettes.filter(":even").find("button:not(.note-color-btn)").addClass("note-color-btn"); + var $fore = $palettes.filter(":odd").find("button:not(.note-color-btn)").addClass("note-color-btn"); $bg.each(function () { var $el = $(this); var className = 'bg-' + $el.data('color'); @@ -146,10 +146,7 @@ renderer.tplPopovers = function (lang, options) { })).appendTo($resizefa); } var $colorfa = $airPopover.find('.note-color').clone(); - $colorfa.find(".btn-group:first").remove(); $colorfa.find("ul.dropdown-menu").css('min-width', '172px'); - $colorfa.find('button[data-event="color"]').attr('data-value', '{"foreColor": "#f00"}') - .find("i").css({'background': '', 'color': '#f00'}); $resizefa.after($colorfa); // show dialog box and delete @@ -454,7 +451,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".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".toUpperCase().indexOf($node[0].nodeName) === -1) { var p = $('
Batnae municipium.