diff --git a/addons/web_editor/static/src/js/editor/rte.summernote.js b/addons/web_editor/static/src/js/editor/rte.summernote.js index 1c24bb4f7e4..e01c9d452a4 100644 --- a/addons/web_editor/static/src/js/editor/rte.summernote.js +++ b/addons/web_editor/static/src/js/editor/rte.summernote.js @@ -464,7 +464,12 @@ eventHandler.modules.linkDialog.showLinkDialog = function ($editable, $dialog, l }); return def; }; +var originalShowImageDialog = eventHandler.modules.imageDialog.showImageDialog; eventHandler.modules.imageDialog.showImageDialog = function ($editable) { + var options = $editable.closest('.o_editable, .note-editor').data('options'); + if (options.disableFullMediaDialog) { + return originalShowImageDialog.apply(this, arguments); + } var r = $editable.data('range'); if (r.sc.tagName && r.sc.childNodes.length) { r.sc = r.sc.childNodes[r.so]; @@ -472,7 +477,6 @@ eventHandler.modules.imageDialog.showImageDialog = function ($editable) { var media = $(r.sc).parents().addBack().filter(function (i, el) { return dom.isImg(el); })[0]; - var options = $editable.closest('.o_editable, .note-editor').data('options'); topBus.trigger('media_dialog_demand', { $editable: $editable, media: media, @@ -866,6 +870,9 @@ eventHandler.attach = function (oLayoutInfo, options) { oLayoutInfo.editor().on('dragstart', 'img', function (e) { e.preventDefault(); }); $(document).on('mousedown', summernote_mousedown).on('mouseup', summernote_mouseup); oLayoutInfo.editor().off('click').on('click', function (e) {e.preventDefault();}); // if the content editable is a link + oLayoutInfo.editor().find('.note-image-dialog').on('click', '.note-image-input', function (e) { + e.stopPropagation(); // let browser default happen for image file input + }); /** * Open Media Dialog on double click on an image/video/icon. diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index c20b65d4b1a..85db9236a9e 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -141,6 +141,7 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({ res_model: 'forum.post', res_id: +window.location.pathname.split('-').pop(), }, + disableFullMediaDialog: true, }; if (!hasFullEdit) { options.plugins = {