ckeditor / ckeditor5

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.
https://ckeditor.com/ckeditor-5
Other
9.36k stars 3.68k forks source link

URLs escaped when used as link attributes #12399

Open albertfdp opened 2 years ago

albertfdp commented 2 years ago

📝 Provide detailed reproduction steps (if any)

  1. Run the below snippet
  2. You'll see that the resulting output text has escaped the URL as in https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=featured

Reproduction snippet:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>CKEditor 5 – Classic editor</title>
    <script src="https://cdn.ckeditor.com/ckeditor5/34.2.0/classic/ckeditor.js"></script>
  </head>
  <body>
    <h1>Classic editor</h1>
    <div id="editor">
      <p>This is some sample content.</p>
    </div>
    <script>
      ClassicEditor.create(document.querySelector("#editor"), {
        initialData: `<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=featured">Link</a>`,
      }).then(editor => {
        console.log(editor.getData()); // <p><a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ&amp;feature=featured">Link</a></p>
      });
    </script>
  </body>
</html>

✔️ Expected result

That query strings in URLs are not escaped unless they are rendered as text (so, unescaped in places like a[href], img[src], iframe[src], etc). While browsers seem to still respect these and resolve correctly, that prevents them from being copy pasted into the address bar.

❌ Actual result

All URL are escaped in all instances, even when being used as link attributes.

📃 Other details


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

CKEditorBot commented 11 months ago

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

albertfdp commented 11 months ago

👍

niegowski commented 10 months ago

Related: https://github.com/ckeditor/ckeditor5/issues/15293#issuecomment-1792049300