mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-06-27 21:21:02 -06:00
Fix relative image url fetched from stylesheet domain
Partial URLs are interpreted relative to the source of the style sheet, not relative to the document https://www.w3.org/TR/CSS1/
This commit is contained in:
parent
f039bae67f
commit
9b420ac103
@ -2233,8 +2233,9 @@ EasyMDE.prototype.render = function (el) {
|
|||||||
|
|
||||||
|
|
||||||
function assignImageBlockAttributes(parentEl, img) {
|
function assignImageBlockAttributes(parentEl, img) {
|
||||||
parentEl.setAttribute('data-img-src', img.url);
|
var url = (new URL(img.url, document.baseURI)).href;
|
||||||
parentEl.setAttribute('style', '--bg-image:url(' + img.url + ');--width:' + img.naturalWidth + 'px;--height:' + calcHeight(img.naturalWidth, img.naturalHeight));
|
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();
|
_vm.codemirror.setSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user