1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-27 06:01:54 +03:00

Fixed md editor refactoring issues after manual test

Testing was a full manual feature test of each piece of supported logic
defined in the code.
This commit is contained in:
Dan Brown
2022-11-26 21:33:39 +00:00
parent 63d6272282
commit 8e4bb32b77
3 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ export class Display {
this.doc.body.className = 'page-content';
// Prevent markdown display link click redirect
this.doc.addEventListener('click', this.onDisplayClick)
this.doc.addEventListener('click', this.onDisplayClick.bind(this));
}
/**
@ -91,8 +91,8 @@ export class Display {
* @param {Number} index
*/
scrollToIndex(index) {
const elems = this.doc.body.children;
if (elems.length <= index) return;
const elems = this.doc.body?.children[0]?.children;
if (elems && elems.length <= index) return;
const topElem = (index === -1) ? elems[elems.length-1] : elems[index];
topElem.scrollIntoView({ block: 'start', inline: 'nearest', behavior: 'smooth'});