Skip to content

Commit 184e821

Browse files
Align BaseNotebook with Notebook feat'; part 1 (#350)
* Fix shortcuts * More shortcuts fixes * Fix completer * Finalize cell sidebar as extension Remove store from `BaseNotebook` * Use extension for cell sidebar * Use homogeneous `commands` name for command registry * Migrate all sidebar as extension * Fix styling for sidebar as extension * Fix cell sidebar styling * Restore ipywidgets * Remove obsolete FIXME * Automatic application of license header --------- Co-authored-by: Frédéric Collonval <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 484b11f commit 184e821

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1603
-1445
lines changed

packages/react/src/app/tabs/components/NotebookComponent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* MIT License
55
*/
66

7+
import { CellSidebarExtension } from '../../../components';
78
import Notebook from '../../../components/notebook/Notebook';
8-
import CellSidebarNew from './../../../components/notebook/cell/sidebar/CellSidebarButton';
9-
109
import nbformat from './../../..//examples/notebooks/NotebookExample1.ipynb.json';
10+
import CellSidebarNew from './../../../components/notebook/cell/sidebar/CellSidebarButton';
1111

1212
export const NotebookComponent = () => {
1313
return (
@@ -18,7 +18,7 @@ export const NotebookComponent = () => {
1818
id="notebook-id"
1919
cellSidebarMargin={60}
2020
height="calc(100vh - 2.6rem)" // (Height - Toolbar Height).
21-
CellSidebar={CellSidebarNew}
21+
extensions={[new CellSidebarExtension({ factory: CellSidebarNew })]}
2222
/>
2323
</>
2424
);

packages/react/src/components/cell/CellCommands.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ const cmdIds = {
1515
};
1616

1717
export const CellCommands = (
18-
commandRegistry: CommandRegistry,
18+
commands: CommandRegistry,
1919
cell: CodeCell | MarkdownCell | RawCell,
2020
completerHandler: CompletionHandler,
2121
cellAdapter: CellAdapter,
2222
): void => {
23-
commandRegistry.addCommand(cmdIds.invoke, {
23+
commands.addCommand(cmdIds.invoke, {
2424
label: 'Completer: Invoke',
2525
execute: () => completerHandler.invoke(),
2626
});
27-
commandRegistry.addCommand(cmdIds.select, {
27+
commands.addCommand(cmdIds.select, {
2828
label: 'Completer: Select',
2929
execute: () => completerHandler.completer.selectActive(),
3030
});
31-
commandRegistry.addCommand('run:cell', {
31+
commands.addCommand('run:cell', {
3232
execute: () => {
3333
if (cell instanceof CodeCell) {
3434
cellAdapter.execute();
@@ -37,12 +37,12 @@ export const CellCommands = (
3737
}
3838
},
3939
});
40-
commandRegistry.addKeyBinding({
40+
commands.addKeyBinding({
4141
selector: '.jp-InputArea-editor.jp-mod-completer-enabled',
4242
keys: ['Tab'],
4343
command: cmdIds.invoke,
4444
});
45-
commandRegistry.addKeyBinding({
45+
commands.addKeyBinding({
4646
selector: '.jp-InputArea-editor',
4747
keys: ['Shift Enter'],
4848
command: 'run:cell',
@@ -54,7 +54,7 @@ export const CellCommands = (
5454
command: cmdIds.select,
5555
},
5656
];
57-
bindings.map(binding => commandRegistry.addKeyBinding(binding));
57+
bindings.map(binding => commands.addKeyBinding(binding));
5858
};
5959

6060
export default CellCommands;

0 commit comments

Comments
 (0)