[FIX] web_editor: infinite loop in lists in table
Before this commit: In table selecting a list and on deletion/backspace page crashes. After this commit: The selected list is now deleted. task-3383168 closes odoo/odoo#128943 X-original-commit: c7d3d247269ce27a10da39df5848cc10f9f6627b Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -2066,7 +2066,7 @@ export class OdooEditor extends EventTarget {
|
||||
doJoin &&
|
||||
next &&
|
||||
!(next.previousSibling && next.previousSibling === joinWith) &&
|
||||
this.editable.contains(next)
|
||||
this.editable.contains(next) && (closestElement(joinWith,'TD') === closestElement(next, 'TD'))
|
||||
) {
|
||||
const restore = preserveCursor(this.document);
|
||||
this.observerFlush();
|
||||
|
||||
@@ -1039,6 +1039,27 @@ X[]
|
||||
),
|
||||
});
|
||||
});
|
||||
it('should delete the list item', async () => {
|
||||
await testEditor(BasicEditor, {
|
||||
contentBefore: unformat(
|
||||
`<table><tbody>
|
||||
<tr>
|
||||
<td><ul><li>[a</li><li>b</li><li>c]</li></ul></td>
|
||||
<td><ul><li>A</li><li>B</li><li>C</li></ul></td>
|
||||
</tr>
|
||||
</tbody></table>`,
|
||||
),
|
||||
stepFunction: deleteForward,
|
||||
contentAfter: unformat(
|
||||
`<table><tbody>
|
||||
<tr>
|
||||
<td><ul><li>[]<br></li></ul></td>
|
||||
<td><ul><li>A</li><li>B</li><li>C</li></ul></td>
|
||||
</tr>
|
||||
</tbody></table>`,
|
||||
),
|
||||
});
|
||||
});
|
||||
it('should delete an image that is displayed as a block', async () => {
|
||||
await testEditor(BasicEditor, {
|
||||
contentBefore: unformat(`<div>a[b<img style="display: block;"/>c]d</div>`),
|
||||
|
||||
Reference in New Issue
Block a user