Closed throne1986 closed 2 years ago
@artf can you please help me with this?
The issue is here
editor.on("component:create", (model) => {
if (model.get("type") === "video") {
setAddVideo(false);
console.log("video url.", videos.videoUrl);
editor.Commands.run("open-assets", {
// target: editor.getSelected(), // <- when you drop the video, is not selected
target: model,
url: videos.videoUrl
});
}
});
You can also remove that global listener and update the video Block with activate: true
, way more cleaner.
The issue is here
editor.on("component:create", (model) => { if (model.get("type") === "video") { setAddVideo(false); console.log("video url.", videos.videoUrl); editor.Commands.run("open-assets", { // target: editor.getSelected(), // <- when you drop the video, is not selected target: model, url: videos.videoUrl }); } });
You can also remove that global listener and update the video Block with
activate: true
, way more cleaner.Hi @artf changing as u suggested but still when I drag the video block and select a video I see on a console that the target is null meaning I cant set the selected video url like this
opts.target.set("src", opts.url);
Here is updated codesanbox https://codesandbox.io/s/react-redux-toolkit-application-forked-l5rhp?file=/src/pages/Editor.js:4197-4230 u can try yourself by draging the video to canvas after the modal will open with list of movies just select a video by clicking the button
use video
on hover any listed video on modaL
@artf can you help me with this?
@throne1986 you still have this...
@throne1986 you still have this...
Thanks I solved the problem by adding editor.selectAdd(model);
like this below
editor.on("component:create", (model) => { if (model.get("type") === "video") { editor.selectAdd(model); } });
Thanks
GrapesJS version
What browser are you using?
chrome new version
Reproducible demo link
https://codesandbox.io/s/react-redux-toolkit-application-forked-l5rhp?file=/src/pages/Editor.js
Describe the bug
How to reproduce the bug?
What is the expected behavior? When the user hovers a video and clicks use video button it should add a video to the video tag in a canvas
What is the current behavior? When the user hovers on a video in a modal and clicks use video button the video is not added at all and on console it shows target: null
If is necessary to execute some code in order to reproduce the bug, paste it here below: here is grapes js editor code, full code can be found here https://codesandbox.io/s/react-redux-toolkit-application-forked-l5rhp?file=/src/pages/Editor.js:715-4094
@artf I am out of ideas and I need help
Code of Conduct