提交 ec1f0e32 编写于 作者: R rebornix

fix #104176.

上级 16fb610b
...@@ -399,6 +399,10 @@ export class NotebookService extends Disposable implements INotebookService, ICu ...@@ -399,6 +399,10 @@ export class NotebookService extends Disposable implements INotebookService, ICu
return false; return false;
} }
if (!viewModel.metadata.editable) {
return false;
}
const currCellIndex = viewModel.getCellIndex(activeCell); const currCellIndex = viewModel.getCellIndex(activeCell);
let topPastedCell: CellViewModel | undefined = undefined; let topPastedCell: CellViewModel | undefined = undefined;
...@@ -442,6 +446,10 @@ export class NotebookService extends Disposable implements INotebookService, ICu ...@@ -442,6 +446,10 @@ export class NotebookService extends Disposable implements INotebookService, ICu
return false; return false;
} }
if (!viewModel.metadata.editable) {
return false;
}
const clipboardService = accessor.get<IClipboardService>(IClipboardService); const clipboardService = accessor.get<IClipboardService>(IClipboardService);
const notebookService = accessor.get<INotebookService>(INotebookService); const notebookService = accessor.get<INotebookService>(INotebookService);
clipboardService.writeText(activeCell.getText()); clipboardService.writeText(activeCell.getText());
......
...@@ -1070,6 +1070,10 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD ...@@ -1070,6 +1070,10 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
} }
async undo() { async undo() {
if (!this.metadata.editable) {
return;
}
const editStack = this._undoService.getElements(this.uri); const editStack = this._undoService.getElements(this.uri);
const element = editStack.past.length ? editStack.past[editStack.past.length - 1] : undefined; const element = editStack.past.length ? editStack.past[editStack.past.length - 1] : undefined;
...@@ -1083,6 +1087,10 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD ...@@ -1083,6 +1087,10 @@ export class NotebookViewModel extends Disposable implements EditorFoldingStateD
} }
async redo() { async redo() {
if (!this.metadata.editable) {
return;
}
const editStack = this._undoService.getElements(this.uri); const editStack = this._undoService.getElements(this.uri);
const element = editStack.future[0]; const element = editStack.future[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册