misuzu/assets/misuzu.js/iembed.js

35 lines
764 B
JavaScript

#include utils.js
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;
};