提交 e012490d 编写于 作者: R rebornix

readonly cells should not support join and split

上级 6b7643eb
......@@ -1333,7 +1333,7 @@ registerAction2(class extends NotebookAction {
category: NOTEBOOK_ACTIONS_CATEGORY,
menu: {
id: MenuId.NotebookCellTitle,
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_TYPE.isEqualTo('code'), NOTEBOOK_EDITOR_EDITABLE, InputFocusedContext),
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_TYPE.isEqualTo('code'), NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, InputFocusedContext),
order: CellToolbarOrder.SplitCell
},
icon: { id: 'codicon/split-vertical' },
......
......@@ -896,6 +896,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return null;
}
if (!cell.metadata?.editable) {
return null;
}
let splitPoints = cell.getSelectionsStartPosition();
if (splitPoints && splitPoints.length > 0) {
await cell.resolveTextModel();
......@@ -932,6 +936,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return null;
}
if (!cell.metadata?.editable) {
return null;
}
if (constraint && cell.cellKind !== constraint) {
return null;
}
......@@ -951,6 +959,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return null;
}
if (!above.metadata?.editable) {
return null;
}
await above.resolveTextModel();
if (!above.hasModel()) {
return null;
......@@ -971,6 +983,10 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return null;
}
if (!below.metadata?.editable) {
return null;
}
await cell.resolveTextModel();
if (!cell.hasModel()) {
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册