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

getHTML/getSemanticHTML strips embed, replaces with hyperlink #4280

Closed
enzedonline opened this issue Jun 29, 2024 · 1 comment
Closed

getHTML/getSemanticHTML strips embed, replaces with hyperlink #4280

enzedonline opened this issue Jun 29, 2024 · 1 comment

Comments

@enzedonline
Copy link

enzedonline commented Jun 29, 2024

When using the video module to embed a YouTube clip, quill.editor.getHTML(0, quill.getLenth()) or quill.getSemanticHTML() converts the iframe to a hyperlink.

Steps for Reproduction

Quill playground link.

const quill = new Quill('#editor', {
  modules: {
    toolbar: [
      ['video'],
    ],
  },
  placeholder: 'Compose an epic...',
  theme: 'snow', // or 'bubble'
});
const divOutput = document.createElement('div');
quill.container.insertAdjacentElement('afterend', divOutput);
divOutput.textContent = 'Insert video';
quill.on('text-change', () => {
    divOutput.textContent = quill.getSemanticHTML();
});

image

Example editor video html:

 <iframe 
  class="ql-video ql-iframe-align-right" 
  frameborder="0" allowfullscreen="true" 
  src="https://www.youtube.com/embed/eDRgzEVwVEc?showinfo=0" 
  height="270.27734436035155" width="542">
</iframe>

getSemanticHTML output:

<a href="https://www.youtube.com/embed/eDRgzEVwVEc?showinfo=0"
  target="_blank" rel="nofollow noopener">
  https://www.youtube.com/embed/eDRgzEVwVEc?showinfo=0
</a>

Expected behavior: embeds and their attributes (i.e. src, height, width, classList etc) should be preserved

Actual behavior: it's converted to an hyperlink. Outputting as a hyperlink makes getHTML and getSemanticHTML() unusable for its intended purpose since this should be a direct HTML representation of the editor contents.

Platforms: quilljs 2.0.2, windows 10, chrome

Version: 2.0.2

@enzedonline enzedonline changed the title getSemanticHTML strips embed, replaces with hyperlink getHTML/getSemanticHTML strips embed, replaces with hyperlink Jun 30, 2024
@enzedonline
Copy link
Author

see #4829

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

No branches or pull requests

1 participant