markdown compiled, plus bug fix

This commit is contained in:
MathMan05 2024-07-24 12:59:35 -05:00
parent 7d767d1914
commit a1e805aa7f
3 changed files with 16 additions and 19 deletions

View file

@ -551,8 +551,8 @@ class Channel {
for (const thing of response) {
const message = new Message(thing, this);
if (prev) {
this.idToNext.set(message.snowflake, prev.id);
this.idToPrev.set(prev.id, message.snowflake);
this.idToNext.set(message.snowflake, prev.snowflake);
this.idToPrev.set(prev.snowflake, message.snowflake);
}
else {
this.lastmessage = message;

View file

@ -500,16 +500,14 @@ class MarkDown {
restore();
}
static gatherBoxText(element) {
const children = element.childNodes;
if (element.tagName.toLowerCase() === "img") {
return element.alt;
}
if (element.tagName.toLowerCase() === "br") {
return "\n";
}
if (children.length !== 0) {
let build = "";
for (const thing of children) {
for (const thing of element.childNodes) {
if (thing instanceof Text) {
const text = thing.textContent;
build += text;
@ -522,7 +520,6 @@ class MarkDown {
}
return build;
}
}
}
//solution from https://stackoverflow.com/questions/4576694/saving-and-restoring-caret-position-for-contenteditable-div
function saveCaretPosition(context) {

View file

@ -557,12 +557,12 @@ class Channel{
if(response.length!==100){
this.allthewayup=true;
}
let prev=undefined;
let prev:Message=undefined;
for(const thing of response){
const message=new Message(thing,this);
if(prev){
this.idToNext.set(message.snowflake,prev.id);
this.idToPrev.set(prev.id,message.snowflake);
this.idToNext.set(message.snowflake,prev.snowflake);
this.idToPrev.set(prev.snowflake,message.snowflake);
}else{
this.lastmessage=message;
}