feat(core): Mixly.PagesManager中add方法允许使用Object对tab进行配置
This commit is contained in:
209
boards.json
209
boards.json
@@ -1,316 +1,161 @@
|
||||
[
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_esp32s2/media/mixgoce_compressed.png",
|
||||
|
||||
"boardType": "MixGo CE",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_esp32s2/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_esp32s3/media/mixgo_nova.png",
|
||||
|
||||
"boardType": "Python ESP32-S3",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_esp32s3/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_esp32c3/media/esp32c3_compressed.png",
|
||||
|
||||
"boardType": "Python ESP32-C3",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_esp32c3/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_esp32c2/media/esp32c2_compressed.png",
|
||||
|
||||
"boardType": "Python ESP32-C2",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_esp32c2/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_esp32/media/esp32_compressed.png",
|
||||
|
||||
"boardType": "Python ESP32",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_esp32/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/arduino_avr/media/uno_compressed.png",
|
||||
|
||||
"boardType": "Arduino AVR",
|
||||
|
||||
"boardIndex": "./boards/default/arduino_avr/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": false,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "C/C++"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/python_mixpy/media/py.png",
|
||||
|
||||
"boardType": "Python 3",
|
||||
|
||||
"boardIndex": "./boards/default/python_mixpy/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": false,
|
||||
|
||||
"webCompiler": false,
|
||||
|
||||
"webSocket": false
|
||||
|
||||
},
|
||||
|
||||
"language": "Python"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/python_skulpt/media/webpy.png",
|
||||
|
||||
"boardType": "Python 3 Lite",
|
||||
|
||||
"boardIndex": "./boards/default/python_skulpt/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "Python"
|
||||
|
||||
},
|
||||
|
||||
/*{
|
||||
|
||||
"boardImg": "./boards/default/python_skulpt/media/webpy.png",
|
||||
|
||||
"boardType": "Python 3 MixToy",
|
||||
|
||||
"boardIndex": "./boards/default/python_skulpt_mixtoy/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "Python"
|
||||
|
||||
},*/
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/python_skulpt/media/webpy.png",
|
||||
|
||||
"boardType": "Python 3 Car",
|
||||
|
||||
"boardIndex": "./boards/default/python_skulpt_car/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "Python"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/python_pyodide/media/webpy.png",
|
||||
|
||||
"boardType": "Python 3 Online",
|
||||
|
||||
"boardIndex": "./boards/default/python_pyodide/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": false,
|
||||
|
||||
"webSocket": false
|
||||
|
||||
},
|
||||
|
||||
"language": "Python"
|
||||
|
||||
},
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_robot/media/mixbot.png",
|
||||
|
||||
"boardType": "Python Robot",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_robot/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_k210_mixgoai/media/mixgoai_compressed.png",
|
||||
|
||||
"boardType": "MixGo AI",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_k210_mixgoai/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
/* {
|
||||
/* {
|
||||
"boardImg": "./boards/default/micropython_educore/media/educore.png",
|
||||
"boardType": "Python Educore",
|
||||
"boardIndex": "./boards/default/micropython_educore/index.xml",
|
||||
@@ -323,101 +168,51 @@
|
||||
"language": "MicroPython"
|
||||
},*/
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_nrf51822_mithoncc/media/mithon_compressed.png",
|
||||
|
||||
"boardType": "Mithon CC",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_nrf51822_mithoncc/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/micropython_nrf51822_microbit/media/microbit_compressed.png",
|
||||
|
||||
"boardType": "BBC micro:bit",
|
||||
|
||||
"boardIndex": "./boards/default/micropython_nrf51822_microbit/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": true,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "MicroPython"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/arduino_esp8266/media/esp8266_compressed.png",
|
||||
|
||||
"boardType": "Arduino ESP8266",
|
||||
|
||||
"boardIndex": "./boards/default/arduino_esp8266/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": false,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "C/C++"
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
"boardImg": "./boards/default/arduino_esp32/media/esp32_compressed.png",
|
||||
|
||||
"boardType": "Arduino ESP32",
|
||||
|
||||
"boardIndex": "./boards/default/arduino_esp32/index.xml",
|
||||
|
||||
"env": {
|
||||
|
||||
"electron": true,
|
||||
|
||||
"web": false,
|
||||
|
||||
"webCompiler": true,
|
||||
|
||||
"webSocket": true
|
||||
|
||||
},
|
||||
|
||||
"language": "C/C++"
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
|
||||
]
|
||||
@@ -1,7 +1,8 @@
|
||||
import * as goog from 'goog';
|
||||
import { Msg } from 'blockly/core';
|
||||
import { Workspace, ContextMenu } from 'mixly';
|
||||
import FSArduEsp32Handler from './fs-board-handler';
|
||||
import { Msg } from 'blockly/core';
|
||||
|
||||
|
||||
export default function addBoardFSItem () {
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
@@ -26,7 +27,12 @@ export default function addBoardFSItem () {
|
||||
isHtmlName: true,
|
||||
name: ContextMenu.getItem(Msg.BOARD_FS, ''),
|
||||
callback: () => {
|
||||
statusBarsManager.add('board-fs', 'board-fs', Msg.BOARD_FS, Msg.BOARD_FS);
|
||||
statusBarsManager.add({
|
||||
type: 'board-fs',
|
||||
id: 'board-fs',
|
||||
name: Msg.BOARD_FS,
|
||||
title: Msg.BOARD_FS
|
||||
});
|
||||
statusBarsManager.changeTo('board-fs');
|
||||
const fsStatusBar = statusBarsManager.getStatusBarById('board-fs');
|
||||
fsStatusBar.setHandler(new FSArduEsp32Handler());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as goog from 'goog';
|
||||
import { Msg } from 'blockly/core';
|
||||
import { Workspace, ContextMenu } from 'mixly';
|
||||
import FSArduEsp8266Handler from './fs-board-handler';
|
||||
import { Msg } from 'blockly/core';
|
||||
import * as goog from 'goog';
|
||||
|
||||
|
||||
export default function addBoardFSItem () {
|
||||
@@ -27,7 +27,12 @@ export default function addBoardFSItem () {
|
||||
isHtmlName: true,
|
||||
name: ContextMenu.getItem(Msg.BOARD_FS, ''),
|
||||
callback: () => {
|
||||
statusBarsManager.add('board-fs', 'board-fs', Msg.BOARD_FS, Msg.BOARD_FS);
|
||||
statusBarsManager.add({
|
||||
type: 'board-fs',
|
||||
id: 'board-fs',
|
||||
name: Msg.BOARD_FS,
|
||||
title: Msg.BOARD_FS
|
||||
});
|
||||
statusBarsManager.changeTo('board-fs');
|
||||
const fsStatusBar = statusBarsManager.getStatusBarById('board-fs');
|
||||
fsStatusBar.setHandler(new FSArduEsp8266Handler());
|
||||
|
||||
@@ -41,7 +41,12 @@ export default class StatusBarFileSystem extends PageBase {
|
||||
StatusBarsManager.typesRegistry.register(['file-system'], StatusBarFileSystem);
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
const statusBarsManager = mainWorkspace.getStatusBarsManager();
|
||||
statusBarsManager.add('file-system', 'file-system', Blockly.Msg.PYTHON_PYODIDE_FILE_SYSTEM);
|
||||
statusBarsManager.add({
|
||||
type: 'file-system',
|
||||
id: 'file-system',
|
||||
name: Blockly.Msg.PYTHON_PYODIDE_FILE_SYSTEM,
|
||||
title: Blockly.Msg.PYTHON_PYODIDE_FILE_SYSTEM
|
||||
});
|
||||
statusBarsManager.changeTo('output');
|
||||
return statusBarsManager.get('file-system');
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as Blockly from 'blockly/core';
|
||||
import $ from 'jquery';
|
||||
import { Msg } from 'blockly/core';
|
||||
import {
|
||||
PageBase,
|
||||
HTMLTemplate,
|
||||
StatusBarsManager,
|
||||
Workspace
|
||||
} from 'mixly';
|
||||
import $ from 'jquery';
|
||||
import '../language/loader';
|
||||
import STATUS_BAR_IMAGE_TEMPLATE from '../templates/html/statusbar-image.html';
|
||||
|
||||
@@ -21,7 +21,12 @@ export default class StatusBarImage extends PageBase {
|
||||
StatusBarsManager.typesRegistry.register(['images'], StatusBarImage);
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
const statusBarsManager = mainWorkspace.getStatusBarsManager();
|
||||
statusBarsManager.add('images', 'images', Blockly.Msg.PYTHON_PYODIDE_IMAGE);
|
||||
statusBarsManager.add({
|
||||
type: 'images',
|
||||
id: 'images',
|
||||
name: Msg.PYTHON_PYODIDE_IMAGE,
|
||||
title: Msg.PYTHON_PYODIDE_IMAGE
|
||||
});
|
||||
statusBarsManager.changeTo('output');
|
||||
return statusBarsManager.get('images');
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import STATUS_BAR_IMAGE_TEMPLATE from '../templates/html/statusbar-image.html';
|
||||
import $ from 'jquery';
|
||||
import { Msg } from 'blockly/core';
|
||||
import {
|
||||
PageBase,
|
||||
HTMLTemplate,
|
||||
StatusBarsManager,
|
||||
Workspace
|
||||
} from 'mixly';
|
||||
import $ from 'jquery';
|
||||
import STATUS_BAR_IMAGE_TEMPLATE from '../templates/html/statusbar-image.html';
|
||||
|
||||
|
||||
class StatusBarImage extends PageBase {
|
||||
static {
|
||||
@@ -18,7 +20,12 @@ class StatusBarImage extends PageBase {
|
||||
StatusBarsManager.typesRegistry.register(['images'], StatusBarImage);
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
const statusBarsManager = mainWorkspace.getStatusBarsManager();
|
||||
statusBarsManager.add('images', 'images', '图像');
|
||||
statusBarsManager.add({
|
||||
type: 'images',
|
||||
id: 'images',
|
||||
name: Msg.MIXLY_MICROBIT_IMAGE,
|
||||
title: Msg.MIXLY_MICROBIT_IMAGE
|
||||
});
|
||||
statusBarsManager.changeTo('output');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import STATUS_BAR_IMAGE_TEMPLATE from '../templates/html/statusbar-image.html';
|
||||
import $ from 'jquery';
|
||||
import { Msg } from 'blockly/core';
|
||||
import {
|
||||
PageBase,
|
||||
HTMLTemplate,
|
||||
StatusBarsManager,
|
||||
Workspace
|
||||
} from 'mixly';
|
||||
import $ from 'jquery';
|
||||
import STATUS_BAR_IMAGE_TEMPLATE from '../templates/html/statusbar-image.html';
|
||||
|
||||
|
||||
class StatusBarImage extends PageBase {
|
||||
static {
|
||||
@@ -18,7 +20,12 @@ class StatusBarImage extends PageBase {
|
||||
StatusBarsManager.typesRegistry.register(['images'], StatusBarImage);
|
||||
const mainWorkspace = Workspace.getMain();
|
||||
const statusBarsManager = mainWorkspace.getStatusBarsManager();
|
||||
statusBarsManager.add('images', 'images', '图像');
|
||||
statusBarsManager.add({
|
||||
type: 'images',
|
||||
id: 'images',
|
||||
name: Msg.MIXLY_MICROBIT_IMAGE,
|
||||
title: Msg.MIXLY_MICROBIT_IMAGE
|
||||
});
|
||||
statusBarsManager.changeTo('output');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +105,12 @@ class App extends Component {
|
||||
this.#nav_ = new Nav();
|
||||
this.#nav_.mountOn($content.find('.mixly-nav'));
|
||||
this.#workspace_ = new Workspace($content.find('.mixly-workspace')[0]);
|
||||
this.#workspace_.getEditorsManager().getTabs().addTab({
|
||||
const editorsManager = this.#workspace_.getEditorsManager();
|
||||
editorsManager.add({
|
||||
type: '.mix',
|
||||
id: 'Untitled-1.mix',
|
||||
name: 'Untitled-1.mix',
|
||||
title: 'Untitled-1.mix',
|
||||
type: '.mix',
|
||||
favicon: 'fileicon-mix'
|
||||
});
|
||||
this.#footerbar_ = new FooterBar();
|
||||
|
||||
@@ -152,12 +152,19 @@ class PagesManager extends Component {
|
||||
return this.get(this.#activeId_);
|
||||
}
|
||||
|
||||
add(type, id, name = null, title = null, favicon = null) {
|
||||
this.#tabs_.addTab({
|
||||
name: name ?? id,
|
||||
title: title ?? id,
|
||||
type, favicon, id
|
||||
});
|
||||
add(...args) {
|
||||
if (args[0] && typeof args[0] === 'object') {
|
||||
this.#tabs_.addTab(args[0]);
|
||||
} else {
|
||||
const [type, id, name, title, favicon] = args;
|
||||
this.#tabs_.addTab({
|
||||
type,
|
||||
id,
|
||||
name: name ?? id,
|
||||
title: title ?? id,
|
||||
favicon
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
remove(id) {
|
||||
|
||||
@@ -200,7 +200,12 @@ class StatusBarsManager extends PagesManager {
|
||||
isHtmlName: true,
|
||||
name: ContextMenu.getItem(Msg.Lang['statusbar.ampy'], ''),
|
||||
callback: (key, opt) => {
|
||||
this.add('ampy', 'ampy', Msg.Lang['statusbar.ampy'], '');
|
||||
this.add({
|
||||
type: 'ampy',
|
||||
id: 'ampy',
|
||||
name: Msg.Lang['statusbar.ampy'],
|
||||
title: Msg.Lang['statusbar.ampy']
|
||||
});
|
||||
this.changeTo('ampy');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,12 @@ class Workspace extends Component {
|
||||
this.#$dragVRight_ = $content.find('.drag-v-right');
|
||||
this.#$dragH_ = $content.find('.drag-h');
|
||||
this.#statusBarsManager_ = new StatusBarsManager($content.find('.statusbars')[0]);
|
||||
this.#statusBarsManager_.add('terminal', 'output', Msg.Lang['statusbar.output']);
|
||||
this.#statusBarsManager_.add({
|
||||
type: 'terminal',
|
||||
id: 'output',
|
||||
name: Msg.Lang['statusbar.output'],
|
||||
title: Msg.Lang['statusbar.output']
|
||||
});
|
||||
this.#statusBarsManager_.changeTo('output');
|
||||
this.#editorsManager_ = new EditorsManager($content.find('.editors')[0]);
|
||||
this.#leftSideBarsManager_ = new LeftSideBarsManager($content.find('.left-sidebars')[0]);
|
||||
|
||||
Reference in New Issue
Block a user