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) { for (const thing of response) {
const message = new Message(thing, this); const message = new Message(thing, this);
if (prev) { if (prev) {
this.idToNext.set(message.snowflake, prev.id); this.idToNext.set(message.snowflake, prev.snowflake);
this.idToPrev.set(prev.id, message.snowflake); this.idToPrev.set(prev.snowflake, message.snowflake);
} }
else { else {
this.lastmessage = message; this.lastmessage = message;

View file

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

View file

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