diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-06-03 15:49:31 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-06-03 15:49:31 +0200 |
| commit | c8d7ad9a6bc55af465392d772ae15e981d0f80c7 (patch) | |
| tree | e9423fa8d28f85b8ad6a1a16e59afadb8db441e9 /addons/web_editor/static/src/js | |
| parent | 8085f259c87f1e6b7f9cf89067f56b327b8936e3 (diff) | |
| parent | 995aa1685eece9ff1070a637d19d511fb1f80260 (diff) | |
[MERGE] forward port branch saas-12.2 up to 995aa1685ee
Diffstat (limited to 'addons/web_editor/static/src/js')
5 files changed, 16 insertions, 5 deletions
diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js index d3f9abfd024..9f6cfaa586a 100644 --- a/addons/web_editor/static/src/js/backend/field_html.js +++ b/addons/web_editor/static/src/js/backend/field_html.js @@ -294,7 +294,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { resolver(); }; - this.$iframe.one('load', function onLoad() { + this.$iframe.on('load', function onLoad() { var _avoidDoubleLoad = ++avoidDoubleLoad; ajax.loadAsset(self.nodeOptions.cssReadonly).then(function (asset) { if (_avoidDoubleLoad !== avoidDoubleLoad) { diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js index dc2a444384b..6a516dd2ad5 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/bullet.js @@ -165,10 +165,10 @@ var BulletPlugin = AbstractPlugin.extend({ // convert ul <-> ol var ul; + $(ol).removeClass('o_checklist'); if (sorted === 'checklist' && current === "ul") { ul = ol; } else if (sorted === 'ul' && current === 'checklist') { - $(ol).removeClass('o_checklist'); ul = ol; } else { ul = this.document.createElement(sorted === "ol" ? "ol" : "ul"); @@ -321,7 +321,7 @@ var BulletPlugin = AbstractPlugin.extend({ var self = this; var nodes = []; var isWithinElem; - var ancestor = range.commonAncestor(); + var ancestor = range.commonAncestor() || this.editable; var $dom = $(ancestor); if (!dom.isList(ancestor)) { @@ -344,7 +344,8 @@ var BulletPlugin = AbstractPlugin.extend({ if (!$dom.length) { // if the selection is contained in a single HTML node, we indent // the first ancestor 'content block' (P, H1, PRE, ...) or TD - $dom = $(range.sc).closest(this.options.styleTags.join(',') + ',td'); + var nodes = this.context.invoke('HelperPlugin.getSelectedNodes'); + $dom = $(this._filterEditableFormatNodes(nodes)); } } diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js index e6a598a2813..6e539787a67 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/media.js @@ -44,6 +44,7 @@ var MediaPlugin = AbstractPlugin.extend({ }, mousePosition: {}, + _modalOpen: false, //-------------------------------------------------------------------------- // Public @@ -53,6 +54,10 @@ var MediaPlugin = AbstractPlugin.extend({ * Open the image dialog and listen to its saved/closed events. */ showImageDialog: function () { + if (this._modalOpen) { + return; + } + this._modalOpen = true; this.context.invoke('editor.saveRange'); var media = this.context.invoke('editor.restoreTarget'); @@ -72,6 +77,7 @@ var MediaPlugin = AbstractPlugin.extend({ }); mediaDialog.on('closed', this, function () { this.context.invoke('editor.restoreRange'); + this._modalOpen = false; }); mediaDialog.open(); }, diff --git a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js index 16e22939cd4..f2834c531f7 100644 --- a/addons/web_editor/static/src/js/wysiwyg/plugin/text.js +++ b/addons/web_editor/static/src/js/wysiwyg/plugin/text.js @@ -229,8 +229,11 @@ var TextPlugin = AbstractPlugin.extend({ $(br).before(emptyText).remove(); range = this.context.invoke('editor.setRange', emptyText, 0, emptyText, 1); } else { + var offset = range.so; this.context.invoke('HelperPlugin.insertTextInline', '\u200B'); - range.eo += 1; + range = this.context.invoke('editor.createRange'); + range.so = offset; + range.eo = offset + 1; } range.select(); } diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js index ddd987f4ed2..7a461b9126c 100644 --- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js +++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js @@ -6,6 +6,7 @@ var Dialog = require('web.Dialog'); var fonts = require('wysiwyg.fonts'); var Widget = require('web.Widget'); var concurrency = require('web.concurrency'); +var session = require('web.session'); var QWeb = core.qweb; |
