old one basically bitrotted to death, may it rinse in prosciutto Reviewed-on: #1 Co-authored-by: flashwave <me@flash.moe> Co-committed-by: flashwave <me@flash.moe>
28 lines
715 B
JavaScript
28 lines
715 B
JavaScript
const MszImageEmbed = function(metadata, options, target) {
|
|
options = options || {};
|
|
|
|
const element = $element('img', {
|
|
alt: target.dataset.mszEmbedAlt || '',
|
|
src: metadata.url,
|
|
});
|
|
|
|
const pub = {
|
|
get element() { return element; },
|
|
appendTo: function(target) {
|
|
target.appendChild(element);
|
|
},
|
|
insertBefore: function(ref) {
|
|
$insertBefore(ref, element);
|
|
},
|
|
nuke: function() {
|
|
element.remove();
|
|
},
|
|
replaceElement(target) {
|
|
$insertBefore(target, element);
|
|
target.remove();
|
|
},
|
|
getType: function() { return 'external'; },
|
|
};
|
|
|
|
return pub;
|
|
};
|