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

fix preview bugs

autoscroll doesn't work at near end of note.
missing event handler
This commit is contained in:
Dick Choi
2016-07-27 14:13:42 +09:00
parent e4238f9283
commit 3e699a99d5

View File

@@ -161,9 +161,9 @@ export default class MarkdownPreview extends React.Component {
for (let index = 0; index < blocks.length; index++) {
let block = blocks[index]
let row = parseInt(block.getAttribute('data-line'))
if (row > targetRow) {
let targetAnchor = blocks[index - 1]
targetAnchor != null && this.getWindow().scrollTo(0, targetAnchor.offsetTop)
if (row > targetRow || index === blocks.length - 1) {
block = blocks[index - 1]
block != null && this.getWindow().scrollTo(0, block.offsetTop)
break
}
}
@@ -179,7 +179,6 @@ export default class MarkdownPreview extends React.Component {
style={style}
tabIndex={tabIndex}
ref='root'
onClick={(e) => this.handleClick(e)}
/>
)
}