diff options
| author | Christophe Matthieu <chm@odoo.com> | 2016-01-28 12:11:18 +0100 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2016-01-28 14:57:21 +0100 |
| commit | d958cf541a770f527604e7b1ade158218eb5a606 (patch) | |
| tree | cf87c56fe9fc22f67b0c659cceecc1a4259a5dcf /addons/web_editor/static/src/js/summernote.js | |
| parent | d1abc952ccdc74c3e7f47f4c30ed1b5ca3149633 (diff) | |
[FIX] web_editor: enter keydown create new td only if the caret is on the last char of the last line of the td
Diffstat (limited to 'addons/web_editor/static/src/js/summernote.js')
| -rw-r--r-- | addons/web_editor/static/src/js/summernote.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index e31faaab601..e4d1c5b27c4 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -1065,11 +1065,6 @@ $.summernote.pluginEvents.enter = function (event, editor, layoutInfo) { var exist = r.sc.childNodes[r.so] || r.sc; var node = dom.node(exist); exist = dom.isVisibleText(exist) || dom.isBR(exist) ? exist : dom.hasContentAfter(exist) || (dom.hasContentBefore(exist) || exist); - var last = node; - while (node && dom.isSplitable(node) && !dom.isList(node)) { - last = node; - node = node.parentNode; - } // table: add a tr var td = dom.ancestor(node, dom.isCell); @@ -1083,7 +1078,15 @@ $.summernote.pluginEvents.enter = function (event, editor, layoutInfo) { dom.scrollIntoViewIfNeeded(br); event.preventDefault(); return false; - } else if (last === node && !dom.isBR(node)) { + } + + var last = node; + while (node && dom.isSplitable(node) && !dom.isList(node)) { + last = node; + node = node.parentNode; + } + + if (last === node && !dom.isBR(node)) { node = r.insertNode(br, true); if (isFormatNode(last.firstChild) && $(last).closest(options.styleTags.join(',')).length) { dom.moveContent(last.firstChild, last); |
