Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube iframe code gets improperly escaped in rich text mode? #701

Open
jywarren opened this issue Mar 23, 2021 · 8 comments
Open

YouTube iframe code gets improperly escaped in rich text mode? #701

jywarren opened this issue Mar 23, 2021 · 8 comments

Comments

@jywarren
Copy link
Member

Someone in the plots2 project (publiclab/plots2#9164) pasted this in, presumably in rich text mode, and the page broke - the iframe code seemed to get malformed and then the rest of the page wouldn't render.

<iframe width="560" height="315" src="
https://www.youtube.com/embed/5LAJ3_Zvsg4" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write;
encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<iframe width="560" height="315" src="
https://www.youtube.com/embed/FxYbXTV5MT4" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write;
encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<iframe width="560" height="315" src="
https://www.youtube.com/embed/5z4MXCkV6S0" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write;
encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

<iframe width="560" height="315" src="
https://www.youtube.com/embed/ICrQHCq89pk" title="YouTube video player"
frameborder="0" allow="accelerometer; autoplay; clipboard-write;
encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

I was able to paste it in "markdown" mode, not "rich text" and i wonder if that made it work.

I think @17sushmita's note that allowfullscreen became allowfullscreen\="" when in the rich text mode seems very likely to be our rich text editor code trying to "fix" that parameter but in fact breaking it.

Let's try to reproduce this by pasting the above into the rich text mode editor and seeing if it causes a page cutoff or rendering problem?

If not, it could somehow relate to the action of publishing it after pasting in rich text mode in which case we could move back to the plots2 project to investigate further.

Thanks, all!!!

@RaviAnand111
Copy link
Contributor

Hey @jywarren @TildaDares , is this issue still open, I want to work on it,
I tried to embed a your youtube video, publiclab editor is working fine,
but on embedding the links given by @jywarren , the editor is showing abnormalites and not showing video frames.

@TildaDares
Copy link
Member

Hi @RaviAnand111, yeah you can work on this. Thanks!

@RaviAnand111
Copy link
Contributor

2022-01-05.17-45-21.mp4

Hey everyone @jywarren @TildaDares , I have found this, please share your views on it.
ThankYou

@RaviAnand111
Copy link
Contributor

If the video is not working, then this is the link of video on my drive.
YouTube Iframe video
@TildaDares @jywarren
Thanks

@TildaDares
Copy link
Member

@RaviAnand111 I think the problem is the line break that is added to the iframe code after copying. I copied the iframe code from the top and then removed all line breaks which are displayed in the form LF and it worked. I think we need to find a way to remove line breaks after input.

Screenshot 2022-01-05 at 20 41 38

@RaviAnand111
Copy link
Contributor

oh great, I will try to recreate this and find a way to how to remove line breaks,
Thanks

@RaviAnand111
Copy link
Contributor

so what I think is there is no problem with the editor and the youtube embed tool,
it's just that the iframe code at the top is wrong as there are line breaks in it, anyone can copy embed code from youtube and paste it in the editor without any problem.
What do you think?
@TildaDares @jywarren

@TildaDares
Copy link
Member

TildaDares commented Jan 6, 2022

@RaviAnand111 I tried using this SO answer to remove the line breaks but that removes the iframe completely https://stackoverflow.com/a/51602415/11953728. I also tried pasting the code above in other markdown editors and it worked.

@jywarren is there a way to remove the line breaks before parsing to markdown?

chunks.before += _module.wysiwyg.parseMarkdown(modalResult); // newlines before and after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants