diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-04-16 14:21:00 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-04-16 14:21:00 +0200 |
| commit | bfa5af45df0662b78256cf4f7fb01d966467b18a (patch) | |
| tree | 53b2da4eae2da7ffd6da2f6978adf6d2f2097598 /addons/web_editor/static/src/js | |
| parent | 3efa5b01b42903a1807b5dc77578b07c20299bc2 (diff) | |
| parent | aab0908818ab4bee0af136d4e693a90ab1b2d261 (diff) | |
[MERGE] forward port branch saas-14 up to aab0908818a
Diffstat (limited to 'addons/web_editor/static/src/js')
| -rw-r--r-- | addons/web_editor/static/src/js/summernote.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/web_editor/static/src/js/summernote.js b/addons/web_editor/static/src/js/summernote.js index 2678ba955af..435c5d7fa78 100644 --- a/addons/web_editor/static/src/js/summernote.js +++ b/addons/web_editor/static/src/js/summernote.js @@ -1856,12 +1856,17 @@ $.summernote.pluginEvents.indent = function (event, editor, layoutInfo, outdent) var $dom = $(ancestor); if (!dom.isList(ancestor)) { + // to indent a selection, we indent the child nodes of the common + // ancestor that contains this selection $dom = $(dom.node(ancestor)).children(); } - if (!$dom.length) { - $dom = $(dom.ancestor(r.sc, dom.isList) || dom.ancestor(r.sc, dom.isCell)); + if (!$dom.not('br').length) { + // if selection is inside a list, we indent its list items + $dom = $(dom.ancestor(r.sc, dom.isList)); if (!$dom.length) { - $dom = $(r.sc).closest(options.styleTags.join(',')); + // if the selection is contained in a single HTML node, we indent + // the first ancestor 'content block' (P, H1, PRE, ...) or TD + $dom = $(r.sc).closest(options.styleTags.join(',')+',td'); } } |
