1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

no more line anchors

This commit is contained in:
Dick Choi
2016-07-26 17:07:56 +09:00
parent c6eff157de
commit 49a4b5feb4
3 changed files with 19 additions and 22 deletions

View File

@@ -141,11 +141,11 @@ export default class MarkdownPreview extends React.Component {
}
scrollTo (targetRow) {
let lineAnchors = this.getWindow().document.querySelectorAll('a.lineAnchor')
let lineAnchors = this.getWindow().document.querySelectorAll('[data-line]')
for (let index = 0; index < lineAnchors.length; index++) {
let lineAnchor = lineAnchors[index]
let row = parseInt(lineAnchor.getAttribute('data-key'))
let row = parseInt(lineAnchor.getAttribute('data-line'))
if (row > targetRow) {
let targetAnchor = lineAnchors[index - 1]
targetAnchor != null && this.getWindow().scrollTo(0, targetAnchor.offsetTop)