Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.31k stars 308 forks source link

Fix relative image url fetched from stylesheet domain #591

Closed p1gp1g closed 1 month ago

p1gp1g commented 1 month ago

Partial URLs are interpreted relative to the source of the style sheet, not relative to the document https://www.w3.org/TR/CSS1/


Before the patch, if the stylesheet is hosted on a remote host, the background images are retrieved from the stylesheet domain. For instance, on the following example, /img/1.jpg is fetched from https://cnd.jsdelivr.net/

<!DOCTYPE html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css" />
  </head>
  <body>
    <textarea id="my-text-area">
![](/img/1.jpg)
    </textarea>
[...]
  </body>
</html>