Added`Center Cursor` command

pull/483/head
Zef Hemel 2023-07-24 11:27:46 +02:00
parent 2a697332e8
commit 1a33b213be
2 changed files with 10 additions and 0 deletions

View File

@ -26,6 +26,11 @@ functions:
path: "./editor.ts:toggleDarkMode"
command:
name: "Editor: Toggle Dark Mode"
centerCursor:
path: "./editor.ts:centerCursorCommand"
command:
name: "Editor: Center Cursor"
key: "Ctrl-Alt-l"
clearPageIndex:
path: "./page.ts:clearPageIndex"
events:

View File

@ -37,3 +37,8 @@ export async function foldAllCommand() {
export async function unfoldAllCommand() {
await editor.unfoldAll();
}
export async function centerCursorCommand() {
const pos = await editor.getCursor();
await editor.moveCursor(pos, true);
}