mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
scroll selected line to middle of the editor
This commit is contained in:
@@ -835,6 +835,9 @@ export default class CodeEditor extends React.Component {
|
|||||||
ch: 1
|
ch: 1
|
||||||
}
|
}
|
||||||
this.editor.setCursor(cursor)
|
this.editor.setCursor(cursor)
|
||||||
|
const top = this.editor.charCoords({line: num, ch: 0}, 'local').top
|
||||||
|
const middleHeight = this.editor.getScrollerElement().offsetHeight / 2
|
||||||
|
this.editor.scrollTo(null, top - middleHeight - 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
focus () {
|
focus () {
|
||||||
|
|||||||
Reference in New Issue
Block a user