2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-07-05 09:04:28 -06:00

Merge pull request #591 from p1gp1g/fix/relative-img-url

Fix relative image url fetched from stylesheet domain
This commit is contained in:
Jeroen Akkerman 2024-06-07 12:18:18 +02:00 committed by GitHub
commit 65dfecf484
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}