summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorAntoine Guenet <age@odoo.com>2019-04-15 11:40:05 +0000
committerAntoine Guenet <age@odoo.com>2019-04-15 11:40:05 +0000
commit17aff7b59b7b5e997da14a00e0df1d2ed7c16164 (patch)
treecbf2c7ff38ccb88056f45ae69f3cac0de5d0db24 /addons
parent8b31b3b18df1fa3be25014b556e08e132fb3ab07 (diff)
[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>
Diffstat (limited to 'addons')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js1
-rw-r--r--addons/web_editor/static/tests/wysiwyg_keyboard_tests.js24
2 files changed, 25 insertions, 0 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
index 3ab6a5f0317..94ec9306f7d 100644
--- a/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
+++ b/addons/web_editor/static/src/js/wysiwyg/plugin/keyboard.js
@@ -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;
}
diff --git a/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js b/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js
index 56ceb27a025..28a8106234c 100644
--- a/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js
+++ b/addons/web_editor/static/tests/wysiwyg_keyboard_tests.js
@@ -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