Skip to content

Commit

Permalink
[FIX] web_editor: relative URL in background snippet
Browse files Browse the repository at this point in the history
When the backround is set with the media modal, directly get the URL of
the IMG element (equivalent to `.getAttribute('src')`) instead of doing
`.src` which returns absolute URI.

This fix uses jQuery wrapper so it still works if called with object:

  $({src: 'test.jpg'}).attr('src') === 'test.jpg'

note: before 17237ff we already used `.attr('src')`.

opw-2215103
closes odoo#47797

Signed-off-by: Nicolas Lempereur (nle) <[email protected]>
  • Loading branch information
nle-odoo committed Mar 17, 2020
1 parent a065651 commit 5a4f68e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/web_editor/static/src/js/editor/snippets.options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ registry.background = SnippetOption.extend({
* @param {Object} data
*/
_onSaveMediaDialog: function (data) {
this._setCustomBackground(data.src);
this._setCustomBackground($(data).attr('src'));
},
});

Expand Down

0 comments on commit 5a4f68e

Please sign in to comment.