Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1 Enhancements/7377.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add left side navigation bar to native editor
30 changes: 30 additions & 0 deletions src/datascience-ui/native-editor/nativeCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class NativeCell extends React.Component<INativeCellProps, INativeCellSta
return (
<div className={cellWrapperClass} role={this.props.role} ref={this.wrapperRef} tabIndex={0} onKeyDown={this.onOuterKeyDown} onClick={this.onMouseClick} onDoubleClick={this.onMouseDoubleClick}>
<div className={cellOuterClass}>
{this.renderNavbar()}
{this.renderControls()}
<div className='content-div'>
{content}
Expand Down Expand Up @@ -473,6 +474,35 @@ export class NativeCell extends React.Component<INativeCellProps, INativeCellSta
}
}

private renderNavbar = () => {
const cellId = this.props.cellVM.cell.id;

const moveUp = () => {
this.moveCellUp();
this.props.stateController.sendCommand(NativeCommandType.MoveCellUp, 'mouse');
};
const moveDown = () => {
this.moveCellDown();
this.props.stateController.sendCommand(NativeCommandType.MoveCellDown, 'mouse');
};
const canMoveUp = this.props.stateController.canMoveUp(cellId);
const canMoveDown = this.props.stateController.canMoveDown(cellId);

return (
<div className='navbar-div'>
<div>
<ImageButton baseTheme={this.props.baseTheme} onClick={moveUp} disabled={!canMoveUp} tooltip={getLocString('DataScience.moveCellUp', 'Move cell up')}>
<Image baseTheme={this.props.baseTheme} class='image-button-image' image={ImageName.Up} />
</ImageButton>
</div>
<div>
<ImageButton baseTheme={this.props.baseTheme} onClick={moveDown} disabled={!canMoveDown} tooltip={getLocString('DataScience.moveCellDown', 'Move cell down')}>
<Image baseTheme={this.props.baseTheme} class='image-button-image' image={ImageName.Down} />
</ImageButton>
</div>
</div>
);
}
private renderMiddleToolbar = () => {
const cellId = this.props.cellVM.cell.id;
const deleteCell = () => {
Expand Down
26 changes: 25 additions & 1 deletion src/datascience-ui/native-editor/nativeEditor.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@
overflow-x: scroll;
}

.cell-outer {
display:grid;
grid-template-columns:auto auto 1fr;
}

.cell-outer-editable {
display:grid;
grid-template-columns:auto auto 1fr;
margin-top: 0px;
}

Expand Down Expand Up @@ -108,15 +115,24 @@
background: var(--override-widget-background, var(--vscode-notifications-background));
}

.content-div {
grid-column: 3;
}

.controls-div {
grid-column: 1;
grid-column: 2;
grid-template-columns: max-content min-content ;
justify-content: end;
display: grid;
min-width: 50px;
grid-template-rows: min-content max-content;
}

.navbar-div {
grid-column: 1;
visibility: hidden;
}

.execution-count {
justify-self: end;
}
Expand All @@ -135,6 +151,14 @@
visibility: collapse;
}

.cell-wrapper-selected .navbar-div {
visibility: visible;
}

.cell-wrapper-focused .navbar-div {
visibility: visible;
}

.cell-wrapper-selected .native-editor-celltoolbar-middle {
visibility: visible;
}
Expand Down