提交 6667da2d 编写于 作者: R rebornix

focus top and bottom actions

上级 86db1ec2
......@@ -1090,3 +1090,67 @@ registerAction2(class extends Action2 {
viewModel.redo();
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.notebook.focusTop',
title: 'Notebook Focus First Cell',
keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyCode.Home,
mac: { primary: KeyMod.CtrlCmd | KeyCode.UpArrow },
weight: KeybindingWeight.WorkbenchContrib
}
});
}
async run(accessor: ServicesAccessor, context?: INotebookCellActionContext): Promise<void> {
if (!isCellActionContext(context)) {
context = getActiveCellContext(accessor);
if (!context) {
return;
}
}
const editor = context.notebookEditor;
if (!editor.viewModel || !editor.viewModel.length) {
return;
}
const firstCell = editor.viewModel.viewCells[0];
editor.focusNotebookCell(firstCell, false);
}
});
registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.notebook.focusBottom',
title: 'Notebook Focus Last Cell',
keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyCode.End,
mac: { primary: KeyMod.CtrlCmd | KeyCode.DownArrow },
weight: KeybindingWeight.WorkbenchContrib
}
});
}
async run(accessor: ServicesAccessor, context?: INotebookCellActionContext): Promise<void> {
if (!isCellActionContext(context)) {
context = getActiveCellContext(accessor);
if (!context) {
return;
}
}
const editor = context.notebookEditor;
if (!editor.viewModel || !editor.viewModel.length) {
return;
}
const firstCell = editor.viewModel.viewCells[editor.viewModel.length - 1];
editor.focusNotebookCell(firstCell, false);
}
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册