Focus the editor after restoring a stored cursor position (#7628)

GitOrigin-RevId: d4564f14503957a0fc8a02cef21064777e2e961d
This commit is contained in:
Alf Eaton 2022-04-22 10:43:26 +01:00 committed by Copybot
parent e644c2a531
commit b70e63e893
2 changed files with 6 additions and 1 deletions

View file

@ -50,4 +50,8 @@ export default CursorPositionAdapter = class CursorPositionAdapter {
const position = EditorShareJsCodec.shareJsOffsetToRowColumn(offset, lines)
return this.gotoLine(position.row + 1, position.column)
}
focus() {
this.editor.focus()
}
}

View file

@ -113,6 +113,7 @@ export default CursorPositionManager = class CursorPositionManager {
}
const pos = this.localStorage(`doc.position.${this.doc_id}`) || {}
this.adapter.setCursor(pos)
return this.adapter.setEditorScrollPosition(pos)
this.adapter.setEditorScrollPosition(pos)
this.adapter.focus()
}
}