Show audio: references inline, too, and now we don't have to show audio: and video: in the references section.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4254 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-04-12 00:32:14 +00:00
parent 8f2d3e3bcd
commit 1f3f6e2b92
2 changed files with 11 additions and 4 deletions

View File

@ -168,10 +168,7 @@ class TfMessageElement extends LitElement {
render_mentions() { render_mentions() {
let mentions = this.message?.content?.mentions || []; let mentions = this.message?.content?.mentions || [];
mentions = mentions.filter(x => mentions = mentions.filter(x => this.message?.content?.text?.indexOf(x.link) === -1);
x.name?.startsWith('audio:') ||
x.name?.startsWith('video:') ||
this.message?.content?.text?.indexOf(x.link) === -1);
if (mentions.length) { if (mentions.length) {
let self = this; let self = this;
return html` return html`

View File

@ -13,6 +13,16 @@ function image(node, entering) {
this.disableTags -= 1; this.disableTags -= 1;
this.lit('</video>'); this.lit('</video>');
} }
} else if (node.firstChild?.type === 'text' &&
node.firstChild.literal.startsWith('audio:')) {
if (entering) {
this.lit('<audio style="height: 32px; max-width: 100%" title="' + this.esc(node.firstChild?.literal) + '" controls>');
this.lit('<source src="' + this.esc(node.destination) + '"></source>');
this.disableTags += 1;
} else {
this.disableTags -= 1;
this.lit('</audio>');
}
} else { } else {
if (entering) { if (entering) {
if (this.disableTags === 0) { if (this.disableTags === 0) {