markdown compiled, plus bug fix
This commit is contained in:
parent
7d767d1914
commit
a1e805aa7f
3 changed files with 16 additions and 19 deletions
|
@ -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;
|
||||
|
|
|
@ -500,28 +500,25 @@ 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) {
|
||||
if (thing instanceof Text) {
|
||||
const text = thing.textContent;
|
||||
build += text;
|
||||
continue;
|
||||
}
|
||||
const text = this.gatherBoxText(thing);
|
||||
if (text) {
|
||||
build += text;
|
||||
}
|
||||
let build = "";
|
||||
for (const thing of element.childNodes) {
|
||||
if (thing instanceof Text) {
|
||||
const text = thing.textContent;
|
||||
build += text;
|
||||
continue;
|
||||
}
|
||||
const text = this.gatherBoxText(thing);
|
||||
if (text) {
|
||||
build += text;
|
||||
}
|
||||
return build;
|
||||
}
|
||||
return build;
|
||||
}
|
||||
}
|
||||
//solution from https://stackoverflow.com/questions/4576694/saving-and-restoring-caret-position-for-contenteditable-div
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue