![JC Brand](/assets/img/avatar_default.png)
even if the global configuration is to disallow it. * When parsing, include all media URLs, not just the ones from allowed domains. That makes it possible to change allowed domains on-the-fly, while still allowing media in individual messages to be shown manually (via the message actions dropdown). * Merge `embed_audio`, `embed_video` and `show_images_inline` into `render_media` * Create new config settings for allowable domains for images, video and audio * Check the URL domain against a whitelist for the message actions dropdown
28 lines
820 B
JavaScript
28 lines
820 B
JavaScript
import log from '@converse/headless/log.js';
|
|
import { Directive, directive } from 'lit/directive.js';
|
|
import { RichText } from 'shared/rich-text.js';
|
|
import { html } from 'lit';
|
|
import { until } from 'lit/directives/until.js';
|
|
|
|
async function transform (t) {
|
|
try {
|
|
await t.addTemplates();
|
|
} catch (e) {
|
|
log.error(e);
|
|
}
|
|
return t.payload;
|
|
}
|
|
|
|
class StylingDirective extends Directive {
|
|
render (txt, offset, options) { // eslint-disable-line class-methods-use-this
|
|
const t = new RichText(
|
|
txt,
|
|
offset,
|
|
Object.assign(options, { 'show_images': false, 'embed_videos': false, 'embed_audio': false })
|
|
);
|
|
return html`${until(transform(t), html`${t}`)}`;
|
|
}
|
|
}
|
|
|
|
export const renderStylingDirectiveBody = directive(StylingDirective);
|