diff --git a/packages/ui-default/build/config/webpack.js b/packages/ui-default/build/config/webpack.js index 9c8dbfac0..ed510e195 100644 --- a/packages/ui-default/build/config/webpack.js +++ b/packages/ui-default/build/config/webpack.js @@ -130,11 +130,6 @@ export default function (env = {}) { maxInitialRequests: 3, automaticNameDelimiter: '-', cacheGroups: { - blockly: { - test: /[\\/]@?blockly[\\/]/, - priority: 10, - name: 'blockly', - }, monaco: { test: /[\\/]monaco-editor[\\/]/, priority: 9, diff --git a/packages/ui-default/components/scratchpad/ScratchpadEditorContainer.jsx b/packages/ui-default/components/scratchpad/ScratchpadEditorContainer.jsx index 70cb14600..e09eb81eb 100644 --- a/packages/ui-default/components/scratchpad/ScratchpadEditorContainer.jsx +++ b/packages/ui-default/components/scratchpad/ScratchpadEditorContainer.jsx @@ -22,22 +22,9 @@ const mapDispatchToProps = (dispatch) => ({ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor extends React.PureComponent { disposable = []; - blockly = false; - componentDidMount() { const value = this.props.value || ''; const { language, theme } = this.props; - if (this.props.language === 'blockly') { - if (!this.blockly) { - import('./blockly').then(({ default: Blockly }) => { - if (!this.blockly) return; - Blockly.inject(this.containerElement, { - }); - }); - } - this.blockly = true; - return; - } this.model = monaco.editor.createModel(value, language, monaco.Uri.parse('file://model')); if (this.containerElement) { /** @type {monaco.editor.IStandaloneEditorConstructionOptions} */ @@ -67,19 +54,6 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e } componentDidUpdate(prevProps) { - if (this.props.language === 'blockly') { - if (!this.blockly) { - this.editor.dispose(); - import('./blockly').then(({ default: Blockly, toolbox }) => { - if (!this.blockly) return; - Blockly.inject(this.containerElement, { - toolbox, - }); - }); - } - this.blockly = true; - return; - } const { value, language, theme, mainSize, recordSize, pretestSize, } = this.props; diff --git a/packages/ui-default/components/scratchpad/blockly.jsx b/packages/ui-default/components/scratchpad/blockly.jsx deleted file mode 100644 index 22023c9dd..000000000 --- a/packages/ui-default/components/scratchpad/blockly.jsx +++ /dev/null @@ -1,337 +0,0 @@ -import ReactDOMServer from 'react-dom/server'; -import * as Blockly from 'blockly/core'; -import 'blockly/blocks'; -import 'blockly/python'; -import 'blockly/javascript'; -import 'blockly/php'; -import * as zhHans from 'blockly/msg/zh-hans'; -import * as zhHant from 'blockly/msg/zh-hant'; -import * as ko from 'blockly/msg/ko'; -import * as en from 'blockly/msg/en'; - -const locales = { - zh: zhHans, - zh_CN: zhHans, - zh_TW: zhHant, - ko, - ko_KR: ko, - en, - en_US: en, -}; - -Blockly.setLocale(locales[UserContext.viewLang] || locales.en); - -export default Blockly; -export const toolbox = ReactDOMServer.renderToString( - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - i - - - 1 - - - - - 10 - - - - - 1 - - - - - - - - - 123 - - - - - - - - - - - - - 1 - - - - - 100 - - - - - - - 1 - - - - - 100 - - - - - - - - - - - - - 5 - - - - - - - - - - - - - - - - - - - - - - randomize - - - x - - - 1 - - - - - - - list - - - - - - - 1 - - - - - y - - - - - 1 - - - - - - - list - - - - - - - - - temp - - - - GET - FROM_START - - - y - - - - - list - - - - - - - - - y - - - - - list - - - - - - GET - FROM_START - - - x - - - - - list - - - - - - - - - x - - - - - list - - - - - temp - - - - - - - - - - - - - - - - - - - 'Twas brillig, and the slithy toves - - - - - - - Did gyre and gimble in the wabe: - - - - - - - All mimsy were the borogroves, - - - - - - - And the mome raths outgrabe. - - - - - - - - - - - - - "Beware the Jabberwock, my son! - - - - - - - The jaws that bite, the claws that catch! - - - - - - - Beware the Jubjub bird, and shun - - - - - - - The frumious Bandersnatch!" - - - - - - - - - - - - -); diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 636171b1d..2c919c14b 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/ui-default", - "version": "4.23.2", + "version": "4.24.0", "author": "undefined ", "license": "AGPL-3.0", "main": "hydro.js", @@ -10,10 +10,8 @@ "lint": "eslint ." }, "devDependencies": { - "@blockly/block-extension-tooltip": "^1.0.19", "@blueprintjs/core": "^3.51.0", "@blueprintjs/icons": "^3.30.2", - "@blueprintjs/select": "^3.18.7", "@hydrooj/utils": "workspace:*", "@types/jquery": "^3.5.6", "@types/json-schema": "^7.0.9", @@ -22,7 +20,6 @@ "@undefined-moe/monaco-yaml": "^2.5.0", "ansi_up": "^5.0.1", "autoprefixer": "^9.8.8", - "blockly": "^6.20210701.0", "chalk": "^4.1.2", "classnames": "^2.3.1", "clean-webpack-plugin": "^4.0.0",