diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js index d134bf7c5e5..6a516dd2ad5 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js @@ -321,7 +321,7 @@ var BulletPlugin = AbstractPlugin.extend({ var self = this; var nodes = []; var isWithinElem; - var ancestor = range.commonAncestor(); + var ancestor = range.commonAncestor() || this.editable; var $dom = $(ancestor); if (!dom.isList(ancestor)) { @@ -344,7 +344,8 @@ var BulletPlugin = AbstractPlugin.extend({ if (!$dom.length) { // if the selection is contained in a single HTML node, we indent // the first ancestor 'content block' (P, H1, PRE, ...) or TD - $dom = $(range.sc).closest(this.options.styleTags.join(',') + ',td'); + var nodes = this.context.invoke('HelperPlugin.getSelectedNodes'); + $dom = $(this._filterEditableFormatNodes(nodes)); } } diff --git a/addons/web_editor/static/tests/wysiwyg_tests.js b/addons/web_editor/static/tests/wysiwyg_tests.js index 5eea0df9614..a89da25aca8 100644 --- a/addons/web_editor/static/tests/wysiwyg_tests.js +++ b/addons/web_editor/static/tests/wysiwyg_tests.js @@ -2284,7 +2284,7 @@ QUnit.test('Align', function (assert) { QUnit.test('Indent/outdent', function (assert) { var done = assert.async(); - assert.expect(18); + assert.expect(20); return weTestUtils.createWysiwyg({ debug: false, @@ -2326,6 +2326,21 @@ QUnit.test('Indent/outdent', function (assert) { start: 'p:eq(1):contents()[0]->1', }, }, + { + name: "Click INDENT: li -> indented li", + content: '

aaa

bbb

ccc

ddd

', + start: 'p:eq(1):contents()[0]->0', + end: 'p:eq(3):contents()[0]->3', + do: function () { + $dropdownPara.mousedown().click(); + $btnIndent.mousedown().click(); + }, + test: { + content: '

aaa

bbb

ccc

ddd

', + start: 'p:eq(1):contents()[0]->0', + end: 'p:eq(3):contents()[0]->3', + }, + }, /* OUTDENT */ { name: "Click OUTDENT: indented p -> p",