Split notebookcell (#17185)

* Initial Split code

* minor change

* minor changes

* Added split cell button to initActionBar, created split cell class to pss cell context.

* added changes

* fixed index

* Split Cell Working in markdown mode

* Fixed highlighting

* Preserve the edit state

* Added new icon and updated styles and cellToolbar component with new icon name.

* Addressed PR

* Addressed PR

* Added back isEditMode flag

* Moved split action to after edit toggle.

* Fixed typo

* Addressed PR

* Addressed PR

* Removed deletion of the cell

* fixed the comments

Co-authored-by: Hale Rankin <harankin@microsoft.com>
This commit is contained in:
rajeshka
2021-10-06 18:18:22 -07:00
committed by GitHub
parent 95a4366edb
commit 671c062e59
10 changed files with 172 additions and 12 deletions

View File

@@ -18,7 +18,6 @@ import { INotebookService } from 'sql/workbench/services/notebook/browser/notebo
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';
const moreActionsLabel = localize('moreActionsLabel', "More");
export class EditCellAction extends ToggleableAction {
@@ -58,6 +57,29 @@ export class EditCellAction extends ToggleableAction {
}
}
export class SplitCellAction extends CellActionBase {
public cellType: CellType;
constructor(
id: string,
label: string,
cssClass: string,
@INotificationService notificationService: INotificationService,
@INotebookService private notebookService: INotebookService,
) {
super(id, label, cssClass, notificationService);
this._cssClass = cssClass;
this._tooltip = label;
this._label = '';
}
doRun(context: CellContext): Promise<void> {
let model = context.model;
let index = model.cells.findIndex((cell) => cell.id === context.cell.id);
context.model?.splitCell(context.cell.cellType, this.notebookService, index);
return Promise.resolve();
}
}
export class MoveCellAction extends CellActionBase {
constructor(
id: string,