2024-01-24 21:53:26 +00:00
|
|
|
#include utility.js
|
2023-07-17 14:37:39 +00:00
|
|
|
|
2023-01-29 21:06:03 +00:00
|
|
|
const MszImageEmbed = function(metadata, options, target) {
|
|
|
|
options = options || {};
|
|
|
|
|
|
|
|
const image = $e({
|
|
|
|
tag: 'img',
|
|
|
|
attrs: {
|
|
|
|
alt: target.dataset.mszEmbedAlt || '',
|
|
|
|
src: metadata.url,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const pub = {
|
|
|
|
getElement: function() {
|
|
|
|
return image;
|
|
|
|
},
|
|
|
|
appendTo: function(target) {
|
|
|
|
target.appendChild(image);
|
|
|
|
},
|
|
|
|
insertBefore: function(ref) {
|
|
|
|
$ib(ref, image);
|
|
|
|
},
|
|
|
|
nuke: function() {
|
|
|
|
$r(image);
|
|
|
|
},
|
|
|
|
replaceElement(target) {
|
|
|
|
$ib(target, image);
|
|
|
|
$r(target);
|
|
|
|
},
|
|
|
|
getType: function() { return 'external'; },
|
|
|
|
};
|
|
|
|
|
|
|
|
return pub;
|
|
|
|
};
|