Skip to content

Commit

Permalink
Merge pull request #591 from p1gp1g/fix/relative-img-url
Browse files Browse the repository at this point in the history
Fix relative image url fetched from stylesheet domain
  • Loading branch information
Ionaru authored Jun 7, 2024
2 parents f039bae + 9b420ac commit 65dfecf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/easymde.js
Original file line number Diff line number Diff line change
Expand Up @@ -2233,8 +2233,9 @@ EasyMDE.prototype.render = function (el) {


function assignImageBlockAttributes(parentEl, img) {
parentEl.setAttribute('data-img-src', img.url);
parentEl.setAttribute('style', '--bg-image:url(' + img.url + ');--width:' + img.naturalWidth + 'px;--height:' + calcHeight(img.naturalWidth, img.naturalHeight));
var url = (new URL(img.url, document.baseURI)).href;
parentEl.setAttribute('data-img-src', url);
parentEl.setAttribute('style', '--bg-image:url(' + url + ');--width:' + img.naturalWidth + 'px;--height:' + calcHeight(img.naturalWidth, img.naturalHeight));
_vm.codemirror.setSize();
}

Expand Down

0 comments on commit 65dfecf

Please sign in to comment.