[FIX] web_editor: uncheck new checklist item on split
On ENTER in a checklist item, a new checklist item is created. The new one should never be checked. This ensures that ENTER in a checked checklist item never creates a checked checklist item but instead cleans the class. closes odoo/odoo#32684 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
This commit is contained in:
@@ -296,6 +296,7 @@ var KeyboardPlugin = AbstractPlugin.extend({
|
||||
var next = this.context.invoke('HelperPlugin.splitTree', ancestor, point, {
|
||||
isSkipPaddingBlankHTML: !this.context.invoke('HelperPlugin.isNodeBlockType', point.node.parentNode) && !!point.node.parentNode.nextSibling
|
||||
});
|
||||
$(next).removeClass('o_checked');
|
||||
while (next.firstChild) {
|
||||
next = next.firstChild;
|
||||
}
|
||||
|
||||
@@ -1179,6 +1179,30 @@ var keyboardTestsEnter = [{
|
||||
start: "br->0",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "in ul.o_checklist > li.o_checked > p: ENTER at end",
|
||||
content: '<ul class="o_checklist"><li class="o_checked"><p>test</p></li></ul>',
|
||||
steps: [{
|
||||
start: "p:contents()[0]->4",
|
||||
key: 'ENTER',
|
||||
}],
|
||||
test: {
|
||||
content: '<ul class="o_checklist"><li class="o_checked"><p>test</p></li><li><p><br></p></li></ul>',
|
||||
start: "br->0",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "in ul.o_checklist > li.o_checked > p > b: ENTER within text",
|
||||
content: '<ul class="o_checklist"><li class="o_checked"><p><b>test</b></p></li></ul>',
|
||||
steps: [{
|
||||
start: "b:contents()[0]->2",
|
||||
key: 'ENTER',
|
||||
}],
|
||||
test: {
|
||||
content: '<ul class="o_checklist"><li class="o_checked"><p><b>te</b></p></li><li><p><b>st</b></p></li></ul>',
|
||||
start: "b:eq(1):contents()[0]->0",
|
||||
},
|
||||
},
|
||||
|
||||
// end list UL / OL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user