The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/oembed/client/baseWidget.js

27 lines
847 B

import { Template } from 'meteor/templating';
import { createCollapseable } from '../../ui-utils';
createCollapseable(Template.oembedBaseWidget, (instance) => instance.data.settings.collapseMediaByDefault || false);
Template.oembedBaseWidget.helpers({
template() {
const { collapsedMedia } = Template.instance();
this.collapsedMediaVar = () => collapsedMedia;
this.collapsed = collapsedMedia.get();
if (this.headers?.contentType?.match(/image\/.*/)) {
return 'oembedImageWidget';
}
if (this.headers?.contentType?.match(/audio\/.*/)) {
return 'oembedAudioWidget';
}
if (this.headers?.contentType?.match(/video\/.*/) || this.meta?.twitterPlayerStreamContentType?.match(/video\/.*/)) {
return 'oembedVideoWidget';
}
if (this.meta?.oembedHtml) {
return 'oembedFrameWidget';
}
return 'oembedUrlWidget';
},
});