Skip to content

Commit 65dfecf

Browse files
authored
Merge pull request Ionaru#591 from p1gp1g/fix/relative-img-url
Fix relative image url fetched from stylesheet domain
2 parents f039bae + 9b420ac commit 65dfecf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/js/easymde.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,8 +2233,9 @@ EasyMDE.prototype.render = function (el) {
22332233

22342234

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

0 commit comments

Comments
 (0)