make MarkDown into a class and fixed emojis

This commit is contained in:
MathMan05 2024-07-20 19:05:23 -05:00
parent 36fc3fecc2
commit ec5b86b276
12 changed files with 957 additions and 848 deletions

View file

@ -1,7 +1,7 @@
import { Contextmenu } from "./contextmenu.js";
import { User } from "./user.js";
import { Member } from "./member.js";
import { markdown } from "./markdown.js";
import { MarkDown } from "./markdown.js";
import { Embed } from "./embed.js";
import { File } from "./file.js";
class Message {
@ -33,7 +33,7 @@ class Message {
}
static setupcmenu() {
Message.contextmenu.addbutton("Copy raw text", function () {
navigator.clipboard.writeText(this.content);
navigator.clipboard.writeText(this.content.rawString);
});
Message.contextmenu.addbutton("Reply", function (div) {
this.channel.setReplying(this);
@ -63,6 +63,10 @@ class Message {
}
continue;
}
else if (thing === "content") {
this.content = new MarkDown(messagejson[thing], this.channel);
continue;
}
this[thing] = messagejson[thing];
}
for (const thing in this.embeds) {
@ -204,7 +208,7 @@ class Message {
replyline.classList.add("replyflex");
this.channel.getmessage(this.message_reference.message_id).then(message => {
const author = message.author;
reply.appendChild(markdown(message.content, { stdsize: true }));
reply.appendChild(message.content.makeHTML({ stdsize: true }));
minipfp.src = author.getpfpsrc();
author.bind(minipfp);
username.textContent = author.username;
@ -266,7 +270,7 @@ class Message {
else {
div.classList.remove("topMessage");
}
const messaged = markdown(this.content);
const messaged = this.content.makeHTML();
div["txt"] = messaged;
const messagedwrap = document.createElement("div");
messagedwrap.classList.add("flexttb");