diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 2f624638c73..660902f7052 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -5463,9 +5463,8 @@ registry.ReplaceMedia = SnippetOptionWidget.extend({ * @see this.selectClass for parameters */ async replaceMedia() { - // TODO for now, this simulates a double click on the media, - // to be refactored when the new editor is merged - this.$target.dblclick(); + // open mediaDialog and replace the media. + await this.options.wysiwyg.openMediaDialog({ node:this.$target[0] }); }, /** * Makes the image a clickable link by wrapping it in an . diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 04da6065b56..813acbe5572 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1512,7 +1512,7 @@ export class Wysiwyg extends Component { // selection when the modal is closed. const restoreSelection = preserveCursor(this.odooEditor.document); - const $editable = $(OdooEditorLib.closestElement(range.startContainer, '.o_editable') || this.odooEditor.editable); + const $editable = $(OdooEditorLib.closestElement(params.node || range.startContainer, '.o_editable') || this.odooEditor.editable); const model = $editable.data('oe-model'); const field = $editable.data('oe-field'); const type = $editable.data('oe-type');