mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-23 23:29:59 +08:00
Added code to handle scroll for markdown.
Signed-off-by: Abijeet <abijeetpatro@gmail.com>
This commit is contained in:
@ -222,7 +222,7 @@ class PageDisplay {
|
||||
}
|
||||
setupEditOnHeader() {
|
||||
const headingEditIcon = document.querySelector('.heading-edit-icon');
|
||||
if (headingEditIcon.length === 0) {
|
||||
if (headingEditIcon === null) {
|
||||
// user does not have permission to edit.
|
||||
return;
|
||||
}
|
||||
@ -239,7 +239,10 @@ class PageDisplay {
|
||||
const headingId = currHeading.id;
|
||||
|
||||
let editIcon = visibleHeadingEditIcon.cloneNode(true);
|
||||
editIcon.href += `#${headingId}`;
|
||||
|
||||
// get the first 50 characters.
|
||||
let queryContent = currHeading.textContent && currHeading.textContent.substring(0, 50);
|
||||
editIcon.href += `?content-id=${headingId}&content-text=${encodeURIComponent(queryContent)}`;
|
||||
|
||||
currHeading.appendChild(editIcon);
|
||||
}
|
||||
|
Reference in New Issue
Block a user