set up block defaults

This commit is contained in:
Loren Norman 2023-12-20 15:42:13 -05:00
parent 47cbcd23c2
commit 4d20186879
3 changed files with 10 additions and 6 deletions

View file

@ -12,7 +12,6 @@ export default {
},
visualization: {
inputsInline: false,
colour: 230
},

3
src/blocks/defaults.js Normal file
View file

@ -0,0 +1,3 @@
export default {
inputsInline: false
}

View file

@ -1,6 +1,7 @@
import { map } from 'lodash-es'
import Blockly from 'blockly'
import blockDefaults from './defaults.js'
import ALL_BLOCKS from './all.js'
import { toBlockJSON } from '../tools/tools.js'
import { getBlockType } from '../tools/util.js'
@ -20,11 +21,12 @@ const processCommonBlock = commonBlock => {
}
const processCustomBlock = customBlock => {
customBlocksJson.push(
customBlock.type
? toBlockJSON(customBlock)
: customBlock.json
)
customBlocksJson.push({
...blockDefaults,
...customBlock.type
? toBlockJSON(customBlock)
: customBlock.json
})
}