mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
@@ -659,7 +659,7 @@ registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: EXECUTE_CELL_SELECT_BELOW,
|
||||
precondition: ContextKeyExpr.or(executeCellCondition, NOTEBOOK_CELL_TYPE.isEqualTo('markdown')),
|
||||
precondition: ContextKeyExpr.or(executeCellCondition, NOTEBOOK_CELL_TYPE.isEqualTo('markup')),
|
||||
title: localize('notebookActions.executeAndSelectBelow', "Execute Notebook Cell and Select Below"),
|
||||
keybinding: {
|
||||
when: NOTEBOOK_CELL_LIST_FOCUSED,
|
||||
@@ -890,10 +890,10 @@ registerAction2(class ChangeCellToCodeAction extends NotebookCellAction {
|
||||
primary: KeyCode.KEY_Y,
|
||||
weight: KeybindingWeight.WorkbenchContrib
|
||||
},
|
||||
precondition: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_TYPE.isEqualTo('markdown')),
|
||||
precondition: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_TYPE.isEqualTo('markup')),
|
||||
menu: {
|
||||
id: MenuId.NotebookCellTitle,
|
||||
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_TYPE.isEqualTo('markdown')),
|
||||
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_TYPE.isEqualTo('markup')),
|
||||
group: CellOverflowToolbarGroups.Edit,
|
||||
}
|
||||
});
|
||||
@@ -1273,7 +1273,7 @@ registerAction2(class EditCellAction extends NotebookCellAction {
|
||||
menu: {
|
||||
id: MenuId.NotebookCellTitle,
|
||||
when: ContextKeyExpr.and(
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markdown'),
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markup'),
|
||||
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.toNegated(),
|
||||
NOTEBOOK_CELL_EDITABLE),
|
||||
order: CellToolbarOrder.EditCell,
|
||||
@@ -1304,7 +1304,7 @@ registerAction2(class QuitEditCellAction extends NotebookCellAction {
|
||||
menu: {
|
||||
id: MenuId.NotebookCellTitle,
|
||||
when: ContextKeyExpr.and(
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markdown'),
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markup'),
|
||||
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE,
|
||||
NOTEBOOK_CELL_EDITABLE),
|
||||
order: CellToolbarOrder.SaveCell,
|
||||
@@ -1320,7 +1320,7 @@ registerAction2(class QuitEditCellAction extends NotebookCellAction {
|
||||
{
|
||||
when: ContextKeyExpr.and(
|
||||
quitEditCondition,
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markdown')),
|
||||
NOTEBOOK_CELL_TYPE.isEqualTo('markup')),
|
||||
primary: KeyMod.WinCtrl | KeyCode.Enter,
|
||||
win: {
|
||||
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter
|
||||
|
||||
@@ -54,7 +54,7 @@ export const NOTEBOOK_USE_CONSOLIDATED_OUTPUT_BUTTON = new RawContextKey<boolean
|
||||
|
||||
// Cell keys
|
||||
export const NOTEBOOK_VIEW_TYPE = new RawContextKey<string>('notebookType', undefined);
|
||||
export const NOTEBOOK_CELL_TYPE = new RawContextKey<string>('notebookCellType', undefined); // code, markdown
|
||||
export const NOTEBOOK_CELL_TYPE = new RawContextKey<'code' | 'markup'>('notebookCellType', undefined);
|
||||
export const NOTEBOOK_CELL_EDITABLE = new RawContextKey<boolean>('notebookCellEditable', false); // bool
|
||||
export const NOTEBOOK_CELL_FOCUSED = new RawContextKey<boolean>('notebookCellFocused', false); // bool
|
||||
export const NOTEBOOK_CELL_EDITOR_FOCUSED = new RawContextKey<boolean>('notebookCellEditorFocused', false); // bool
|
||||
|
||||
@@ -12,7 +12,7 @@ import { NotebookCellExecutionState } from 'vs/workbench/contrib/notebook/common
|
||||
|
||||
export class CellContextKeyManager extends Disposable {
|
||||
|
||||
private cellType!: IContextKey<string>;
|
||||
private cellType!: IContextKey<'code' | 'markup'>;
|
||||
private cellEditable!: IContextKey<boolean>;
|
||||
private cellFocused!: IContextKey<boolean>;
|
||||
private cellEditorFocused!: IContextKey<boolean>;
|
||||
@@ -62,7 +62,7 @@ export class CellContextKeyManager extends Disposable {
|
||||
|
||||
this.element = element;
|
||||
if (this.element instanceof MarkdownCellViewModel) {
|
||||
this.cellType.set('markdown');
|
||||
this.cellType.set('markup');
|
||||
} else if (this.element instanceof CodeCellViewModel) {
|
||||
this.cellType.set('code');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user