[FIX] web_editor: indent multiple lines at a time with editable as parent
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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: '<p>aaa</p><p>bbb</p><p>ccc</p><p>ddd</p>',
|
||||
start: 'p:eq(1):contents()[0]->0',
|
||||
end: 'p:eq(3):contents()[0]->3',
|
||||
do: function () {
|
||||
$dropdownPara.mousedown().click();
|
||||
$btnIndent.mousedown().click();
|
||||
},
|
||||
test: {
|
||||
content: '<p>aaa</p><p style="margin-left: 1.5em;">bbb</p><p style="margin-left: 1.5em;">ccc</p><p style="margin-left: 1.5em;">ddd</p>',
|
||||
start: 'p:eq(1):contents()[0]->0',
|
||||
end: 'p:eq(3):contents()[0]->3',
|
||||
},
|
||||
},
|
||||
/* OUTDENT */
|
||||
{
|
||||
name: "Click OUTDENT: indented p -> p",
|
||||
|
||||
Reference in New Issue
Block a user