[FIX] web_editor: calling openMediaDialog on replace media
Before this commit: In mass mailing, Selecting image and click on replace media you get picture middle of the screen. After this commit: Now, clicking on replace would open media dialog and replace picture. task-3506590 closes odoo/odoo#137920 X-original-commit: 7e0b8af005e818c9283b332fb140aeaeaf028275 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
@@ -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 <a>.
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user