[FIX] web_editor, website: never indent/outdent list groups

The "comparisons" website snippet uses a list group with the class set
on a UL. In consequence, the web editor considers it as a regular list
and may try to outdent it, which is not the expected behavior with a
list group. This fix ensures that ULs with the `list-group` class cannot
be in/outdented.

closes odoo/odoo#32709

Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
This commit is contained in:
Antoine Guenet
2019-04-25 10:03:14 +00:00
parent cb9263a823
commit 27eb8ba617
2 changed files with 16 additions and 0 deletions
@@ -313,6 +313,10 @@ var BulletPlugin = AbstractPlugin.extend({
if (!range) {
return;
}
// list groups shouldn't be outdented like regular lists
if ($(dom.ancestor(range.sc, dom.isList)).hasClass('list-group')) {
return;
}
var self = this;
var nodes = [];
@@ -2227,6 +2227,18 @@ var keyboardTestsComplex = [{
start: "p:contents()[0]->1",
},
},
{
name: "in ul.list-group (div > p > text before): BACKSPACE at start",
content: '<div><p>1</p></div><ul class="list-group list-group-flush"><li class="list-group-item"><p><br></p></li></ul>',
steps: [{
start: "p:eq(1)->0",
key: 'BACKSPACE',
}],
test: {
content: '<div><p>1</p></div><ul class="list-group list-group-flush"><li class="list-group-item"><p><br></p></li></ul>',
start: "p:eq(1)->0",
},
},
];
QUnit.test('Complex', function (assert) {