2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-09-24 16:40:55 -06:00

Avoid data attribute namespace conflicts

This commit is contained in:
Jonathan 2022-05-19 00:54:58 +02:00 committed by GitHub
parent aca4b5c816
commit 5692a7ab33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2183,7 +2183,7 @@ EasyMDE.prototype.render = function (el) {
function assignImageBlockAttributes(parentEl, img) { function assignImageBlockAttributes(parentEl, img) {
parentEl.setAttribute('data-img-src', img.url); parentEl.setAttribute('data-mde-img-src', img.url);
parentEl.setAttribute('style', '--bg-image:url(' + img.url + ');--width:' + img.naturalWidth + 'px;--height:' + calcHeight(img.naturalWidth, img.naturalHeight)); parentEl.setAttribute('style', '--bg-image:url(' + img.url + ');--width:' + img.naturalWidth + 'px;--height:' + calcHeight(img.naturalWidth, img.naturalHeight));
_vm.codemirror.setSize(); _vm.codemirror.setSize();
} }
@ -2199,7 +2199,7 @@ EasyMDE.prototype.render = function (el) {
// if img pasted on the same line with other text, don't preview, preview only images on separate line // if img pasted on the same line with other text, don't preview, preview only images on separate line
return; return;
} }
if (!parentEl.hasAttribute('data-img-src')) { if (!parentEl.hasAttribute('data-mde-img-src')) {
var srcAttr = parentEl.innerText.match('\\((.*)\\)'); // might require better parsing according to markdown spec var srcAttr = parentEl.innerText.match('\\((.*)\\)'); // might require better parsing according to markdown spec
if (!window.EMDEimagesCache) { if (!window.EMDEimagesCache) {
window.EMDEimagesCache = {}; window.EMDEimagesCache = {};