mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Added code to enable disable split cell icon (#17331)
* Added code to enable diable split cell icon * adding back the deleted code * refactored * minimized lines * simplified code * minor change * minor change * Addressed PR * Addressed PR * removing unused enum value
This commit is contained in:
@@ -17,7 +17,7 @@ import Severity from 'vs/base/common/severity';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { CellEditModes, MoveDirection } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
const moreActionsLabel = localize('moreActionsLabel', "More");
|
||||
|
||||
export class EditCellAction extends ToggleableAction {
|
||||
@@ -78,6 +78,11 @@ export class SplitCellAction extends CellActionBase {
|
||||
context.model?.splitCell(context.cell.cellType, this.notebookService, index);
|
||||
return Promise.resolve();
|
||||
}
|
||||
public setListener(context: CellContext) {
|
||||
this._register(context.cell.onCurrentEditModeChanged(currentMode => {
|
||||
this.enabled = currentMode === CellEditModes.WYSIWYG ? false : true;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export class MoveCellAction extends CellActionBase {
|
||||
|
||||
@@ -60,6 +60,8 @@ export class CellToolbarComponent {
|
||||
this._actionBar.context = context;
|
||||
|
||||
let splitCellButton = this.instantiationService.createInstance(SplitCellAction, 'notebook.SplitCellAtCursor', this.buttonSplitCell, 'masked-icon icon-split-cell');
|
||||
splitCellButton.setListener(context);
|
||||
splitCellButton.enabled = this.cellModel.cellType !== 'markdown';
|
||||
|
||||
let addCellsButton = this.instantiationService.createInstance(AddCellAction, 'notebook.AddCodeCell', localize('codeCellsPreview', "Add cell"), 'masked-pseudo code');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user