mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix preview bugs
autoscroll doesn't work at near end of note. missing event handler
This commit is contained in:
@@ -161,9 +161,9 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
for (let index = 0; index < blocks.length; index++) {
|
for (let index = 0; index < blocks.length; index++) {
|
||||||
let block = blocks[index]
|
let block = blocks[index]
|
||||||
let row = parseInt(block.getAttribute('data-line'))
|
let row = parseInt(block.getAttribute('data-line'))
|
||||||
if (row > targetRow) {
|
if (row > targetRow || index === blocks.length - 1) {
|
||||||
let targetAnchor = blocks[index - 1]
|
block = blocks[index - 1]
|
||||||
targetAnchor != null && this.getWindow().scrollTo(0, targetAnchor.offsetTop)
|
block != null && this.getWindow().scrollTo(0, block.offsetTop)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,7 +179,6 @@ export default class MarkdownPreview extends React.Component {
|
|||||||
style={style}
|
style={style}
|
||||||
tabIndex={tabIndex}
|
tabIndex={tabIndex}
|
||||||
ref='root'
|
ref='root'
|
||||||
onClick={(e) => this.handleClick(e)}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user