Skip to content

Commit a1ea675

Browse files
committed
added complete toolbox
1 parent 9ed7070 commit a1ea675

File tree

2 files changed

+2
-99
lines changed

2 files changed

+2
-99
lines changed

src/index.ts

Lines changed: 2 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,13 @@ import {
44
ILayoutRestorer
55
} from '@jupyterlab/application';
66

7-
// import {
8-
// ICommandPalette,
9-
// MainAreaWidget,
10-
// WidgetTracker
11-
// } from '@jupyterlab/apputils';
12-
13-
// import { Widget } from '@lumino/widgets';
14-
157
import { WidgetTracker } from '@jupyterlab/apputils';
168

17-
// import * as Blockly from 'blockly';
18-
199
import { BlocklyEditorFactory } from './factory';
2010

21-
// namespace CommandIDs {
22-
// export const open = 'jupyterlab-blocky:open-editor';
23-
// }
2411

2512
import { BlocklyEditor } from './widget';
2613

27-
// const TOOLBOX = {
28-
// kind: 'flyoutToolbox',
29-
// contents : [
30-
// {
31-
// kind : 'block',
32-
// type : 'controls_if'
33-
// },
34-
// {
35-
// kind : 'block',
36-
// type : 'controls_ifelse'
37-
// },
38-
// {
39-
// kind : 'block',
40-
// type : 'logic_compare'
41-
// },
42-
// {
43-
// kind : 'block',
44-
// type : 'logic_operation'
45-
// },
46-
// {
47-
// kind : 'block',
48-
// type : 'logic_boolean'
49-
// },
50-
// {
51-
// kind : 'block',
52-
// type : 'controls_whileUntil'
53-
// },
54-
// {
55-
// kind : 'block',
56-
// type : 'controls_repeat_ext'
57-
// },
58-
// {
59-
// kind : 'block',
60-
// type : 'controls_for'
61-
// },
62-
// {
63-
// kind : 'block',
64-
// type : 'math_number'
65-
// },
66-
// {
67-
// kind : 'block',
68-
// type : 'math_arithmetic'
69-
// }
70-
// ]
71-
// };
72-
7314
/**
7415
* The name of the factory that creates the editor widgets.
7516
*/
@@ -81,59 +22,26 @@ import { BlocklyEditor } from './widget';
8122
const plugin: JupyterFrontEndPlugin<void> = {
8223
id: 'jupyterlab-blocky:plugin',
8324
autoStart: true,
84-
// requires: [ICommandPalette, ILayoutRestorer],
85-
// activate: (
86-
// app: JupyterFrontEnd,
87-
// palette: ICommandPalette,
88-
// restorer: ILayoutRestorer
89-
// ) => {
9025
requires: [ILayoutRestorer],
9126
activate: (app: JupyterFrontEnd, restorer: ILayoutRestorer) => {
9227
console.log('JupyterLab extension jupyterlab-blocky is activated!');
9328

94-
// let editorPanel: MainAreaWidget | null = null;
95-
96-
// // Namespace for the tracker
97-
// const namespace = 'documents-example';
29+
// Namespace for the tracker
9830
const namespace = 'jupyterlab-blocky';
31+
9932
// Creating the tracker for the document
100-
// const tracker = new WidgetTracker<MainAreaWidget>({ namespace });
10133
const tracker = new WidgetTracker<BlocklyEditor>({ namespace });
10234

10335
// Handle state restoration.
10436
if (restorer) {
10537
// When restoring the app, if the document was open, reopen it
10638
restorer.restore(tracker, {
107-
// command: CommandIDs.open,
108-
// name: widget => ''
10939
command: 'docmanager:open',
11040
args: widget => ({ path: widget.context.path, factory: FACTORY }),
11141
name: widget => widget.context.path
11242
});
11343
}
11444

115-
// app.commands.addCommand(CommandIDs.open, {
116-
// label: 'Open Blockly Editor',
117-
// caption: 'Open Blockly Editor',
118-
// isEnabled: () => true,
119-
// execute: () => {
120-
// const content = new Widget();
121-
// content.id = 'jp-Blockly-container';
122-
// editorPanel = new MainAreaWidget({ content });
123-
// editorPanel.title.label = 'Blockly Editor';
124-
125-
// editorPanel.disposed.connect(() => {
126-
// editorPanel = null;
127-
// workspace.dispose();
128-
// });
129-
130-
// app.shell.add(editorPanel, 'main');
131-
132-
// const workspace = Blockly.inject(content.node, {
133-
// toolbox: TOOLBOX
134-
// });
135-
// console.debug('Blockly:', workspace);
136-
// }
13745
// Creating the widget factory to register it so the document manager knows about
13846
// our new DocumentWidget
13947
const widgetFactory = new BlocklyEditorFactory({
@@ -142,17 +50,12 @@ const plugin: JupyterFrontEndPlugin<void> = {
14250
fileTypes: ['json']
14351
});
14452

145-
// if (palette) {
146-
// palette.addItem({
147-
// command: CommandIDs.open,
148-
// category: 'Blockly Editor'
14953
// Add the widget to the tracker when it's created
15054
widgetFactory.widgetCreated.connect((sender, widget) => {
15155
// Notify the instance tracker if restore data needs to update.
15256
widget.context.pathChanged.connect(() => {
15357
tracker.save(widget);
15458
});
155-
// }
15659
tracker.add(widget);
15760
});
15861
// Registering the widget factory

untitled.json

Whitespace-only changes.

0 commit comments

Comments
 (0)