Fix linkifying urls with #fragments in them. Show when an about message is not about the author.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4145 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-01-22 17:25:37 +00:00
parent 5d5ff121f9
commit 0a6b842179
4 changed files with 8 additions and 5 deletions

View File

@ -39,7 +39,7 @@ function splitMatches(text, regexp) {
return result;
}
const regex = new RegExp("#[\\w-]+");
const regex = new RegExp("\\W#[\\w-]+");
function split(textNodes) {
const text = textNodes.map(n => n.literal).join("");

View File

@ -249,13 +249,16 @@ class TfMessageElement extends LitElement {
}
if (content.description !== undefined) {
description = html`
<div style="flex: 1 0 50%">
<div style="flex: 1 0 50%; overflow-wrap: anywhere">
<div>${unsafeHTML(tfutils.markdown(content.description))}</div>
</div>
`
}
let update = content.about == this.message.author ?
html`<div style="font-weight: bold">Updated profile.</div>` :
html`<div style="font-weight: bold">Updated profile for <tf-user id=${content.about} .users=${this.users}></tf-user>.</div>`;
return small_frame(html`
<div style="font-weight: bold">Updated profile.</div>
${update}
${name}
${image}
${description}

View File

@ -5,8 +5,8 @@ export function markdown(md) {
var reader = new commonmark.Parser({safe: true});
var writer = new commonmark.HtmlRenderer();
var parsed = reader.parse(md || '');
parsed = hashtagify.transform(parsed);
parsed = linkify.transform(parsed);
parsed = hashtagify.transform(parsed);
var walker = parsed.walker();
var event, node;
while ((event = walker.next())) {