disable dnd if the document is readonly

This commit is contained in:
rebornix 2021-06-23 14:13:09 -07:00
parent 0cdbc33aa6
commit 3ff9d40542

View file

@ -299,7 +299,7 @@ export class CellDragAndDropController extends Disposable {
dragHandle.setAttribute('draggable', 'true');
templateData.disposables.add(DOM.addDisposableListener(dragHandle, DOM.EventType.DRAG_END, () => {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled || !!this.notebookEditor.viewModel?.options.isReadOnly) {
return;
}
@ -313,7 +313,7 @@ export class CellDragAndDropController extends Disposable {
return;
}
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled || !!this.notebookEditor.viewModel?.options.isReadOnly) {
return;
}
@ -330,7 +330,7 @@ export class CellDragAndDropController extends Disposable {
}
public startExplicitDrag(cell: ICellViewModel, _dragOffsetY: number) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled || !!this.notebookEditor.viewModel?.options.isReadOnly) {
return;
}
@ -339,7 +339,7 @@ export class CellDragAndDropController extends Disposable {
}
public explicitDrag(cell: ICellViewModel, dragOffsetY: number) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled) {
if (!this.notebookEditor.notebookOptions.getLayoutConfiguration().dragAndDropEnabled || !!this.notebookEditor.viewModel?.options.isReadOnly) {
return;
}