|
@@ -1,4 +1,4 @@
|
|
-import { getURI, isGIFURL, isImageDomainAllowed } from '@converse/headless/utils/url.js';
|
|
|
|
|
|
+import { getURI, isAudioURL, isGIFURL, isVideoURL, isImageDomainAllowed } from '@converse/headless/utils/url.js';
|
|
import { html } from 'lit';
|
|
import { html } from 'lit';
|
|
|
|
|
|
|
|
|
|
@@ -11,11 +11,15 @@ function isValidImage (image) {
|
|
return image && isImageDomainAllowed(image) && isValidURL(image);
|
|
return image && isImageDomainAllowed(image) && isValidURL(image);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function shouldHideMediaURL (o) {
|
|
|
|
+ return isGIFURL(o.url) || isVideoURL(o.url) || isAudioURL(o.url);
|
|
|
|
+}
|
|
|
|
+
|
|
const tpl_url_wrapper = (o, wrapped_template) =>
|
|
const tpl_url_wrapper = (o, wrapped_template) =>
|
|
(o.url && isValidURL(o.url) && !isGIFURL(o.url)) ?
|
|
(o.url && isValidURL(o.url) && !isGIFURL(o.url)) ?
|
|
html`<a href="${o.url}" target="_blank" rel="noopener">${wrapped_template(o)}</a>` : wrapped_template(o);
|
|
html`<a href="${o.url}" target="_blank" rel="noopener">${wrapped_template(o)}</a>` : wrapped_template(o);
|
|
|
|
|
|
-const tpl_image = (o) => html`<converse-rich-text class="card-img-top" text="${o.image}" show_images hide_media_urls .onImgLoad=${o.onload}></converse-rich-text>`;
|
|
|
|
|
|
+const tpl_image = (o) => html`<converse-rich-text class="card-img-top" text="${o.image}" show_images ?hide_media_urls=${shouldHideMediaURL(o.url)} .onImgLoad=${o.onload}></converse-rich-text>`;
|
|
|
|
|
|
export default (o) => {
|
|
export default (o) => {
|
|
const valid_image = isValidImage(o.image);
|
|
const valid_image = isValidImage(o.image);
|