Fix links to user IDs.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3776 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2022-01-19 02:37:39 +00:00
parent 1515525a1b
commit 83fa488b8d
5 changed files with 23 additions and 14 deletions

View File

@ -1 +1 @@
{"type":"tildefriends-app","files":{"app.js":"&uXK7Jr1DcwfxabWjUOHVsElPbSyBB35bSrNSElnUlik=.sha256","index.html":"&k3P9dC0mRkGgSfykSKd+EAwUVIwQBJDBeTrqCq0JsOE=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&ZQuSBy1K3iASz/NVEa8ILA6aOefHZUmBa/Ddpcl7ZyI=.sha256","tf.js":"&21MCe6snZ7V+XGPIusw4lFgW6dDcSQlgM0m3Aebf3vI=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}}
{"type":"tildefriends-app","files":{"app.js":"&uXK7Jr1DcwfxabWjUOHVsElPbSyBB35bSrNSElnUlik=.sha256","index.html":"&eY9aBHpnmbMTXXnbzv9gxxXvJp8O5NpcqulQxdnsW/s=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&3dPiSNYjoJE3zn1oTT1SBhbvkW9MHr7ZUDxUJiBI1Ss=.sha256","tf.js":"&qaMkoT5UElfhFNFcDLimlm3asDLaYytsypoz7CJh9q0=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&Vi9pHWY2Dh6+cJlX0lLa4gxrC7VlkeWaU0fQidwzaQ0=.sha256"}}

View File

@ -8,6 +8,7 @@
<script src="vue.js"></script>
<script src="vue-material.js"></script>
<script src="commonmark.min.js"></script>
<script src="tf-shared.js"></script>
<script src="tf-user.js"></script>
<script src="tf-message.js"></script>
<script src="tf.js"></script>

View File

@ -19,11 +19,7 @@ Vue.component('tf-message', {
}
},
methods: {
markdown: function(md) {
var reader = new commonmark.Parser({safe: true});
var writer = new commonmark.HtmlRenderer();
return writer.render(reader.parse(md));
},
markdown: markdown,
set_reply: function() {
g_data.reply_root = this.content_json.root || this.message.id;
g_data.reply_branch = this.message.id;

View File

@ -0,0 +1,19 @@
"use strict";
function markdown(md) {
var reader = new commonmark.Parser({safe: true});
var writer = new commonmark.HtmlRenderer();
var parsed = reader.parse(md);
var walker = parsed.walker();
var event, node;
while ((event = walker.next())) {
node = event.node;
if (event.entering && node.type == 'link') {
if (node.destination.startsWith('@') &&
node.destination.endsWith('.ed25519')) {
node.destination = '#' + node.destination;
}
}
}
return writer.render(parsed);
}

View File

@ -194,14 +194,7 @@ window.addEventListener('load', function() {
return undefined;
}
},
markdown: function(md) {
if (!md) {
return;
}
var reader = new commonmark.Parser({safe: true});
var writer = new commonmark.HtmlRenderer();
return writer.render(reader.parse(md));
},
markdown: markdown,
refresh: function() {
window.parent.postMessage({refresh: true}, '*');
},