[FIX] web_editor: fix pasting youtube videos from the editor
Before this commit, following this flow in the Website Builder: - Enter edit mode, - Drop a snippet with text, - Paste a youtube video link, - Click on the "Embed Youtube Video" option of the powerbox, => There is a traceback. This is coming from the bad function calls in the Wysiwyg to create a video node. When [1] reworked the MediaDialog in owl, a first implementation was done exporting some utils (saveVideos, videoSpecificMediaClasses). But this implementation was not kept and later changed to use static methods and properties on the VideoSelector class (createElements and mediaSpecificClasses). Unfortunately, the outdated util methods used in the Wysiwyg were not changed, and it was breaking the youtube video instertions. This commit changes the Wysiwyg to use the existing VideoSelector.createElements and VideoSelector.mediaSpecificClasses static method and property to fix this flow. [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b task-2687506 closes odoo/odoo#105475 X-original-commit: 4923c20c29170407d43908f983f2a168241f4817 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Younn Olivier (yol) <yol@odoo.com>
This commit is contained in:
@@ -3,7 +3,7 @@ odoo.define('web_editor.wysiwyg', function (require) {
|
||||
|
||||
const { ComponentWrapper } = require('web.OwlCompatibility');
|
||||
const { MediaDialogWrapper } = require('@web_editor/components/media_dialog/media_dialog');
|
||||
const { saveVideos, videoSpecificClasses } = require('@web_editor/components/media_dialog/video_selector');
|
||||
const { VideoSelector } = require('@web_editor/components/media_dialog/video_selector');
|
||||
const dom = require('web.dom');
|
||||
const core = require('web.core');
|
||||
const { browser } = require('@web/core/browser/browser');
|
||||
@@ -150,8 +150,8 @@ const Wysiwyg = Widget.extend({
|
||||
route: '/web_editor/video_url/data',
|
||||
params: { video_url: url },
|
||||
});
|
||||
const [savedVideo] = saveVideos([{src}]);
|
||||
savedVideo.classList.add(...videoSpecificClasses);
|
||||
const [savedVideo] = VideoSelector.createElements([{src}]);
|
||||
savedVideo.classList.add(...VideoSelector.mediaSpecificClasses);
|
||||
return savedVideo;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user