diff --git a/frontend/task/blocks/blocks.ts b/frontend/task/blocks/blocks.ts index d7529bb1..074e8a67 100644 --- a/frontend/task/blocks/blocks.ts +++ b/frontend/task/blocks/blocks.ts @@ -25,12 +25,13 @@ interface BlockInfo { yieldsValue: string|boolean, params: any[], nbsArgs: any[], + hidden?: boolean, } export const CONSTRUCTOR_NAME = '__constructor'; export function generateBlockInfo(block: QuickalgoLibraryBlock, typeName: string): BlockInfo { - const blockInfo = { + const blockInfo: BlockInfo = { nbArgs: 0, // handled below type: typeName, yieldsValue: block.yieldsValue, @@ -47,6 +48,9 @@ export function generateBlockInfo(block: QuickalgoLibraryBlock, typeName: string blockInfo.nbsArgs.push(variants[i].length); } } + if (block.hidden) { + blockInfo.hidden = true; + } return blockInfo; } @@ -71,6 +75,7 @@ function getBlockFromBlockInfo(generatorName: string, blockName: string, blockIn caption: code, code, returnType, + showInBlocks: !blockInfo?.hidden, } } diff --git a/frontend/task/libs/quickalgo_library.ts b/frontend/task/libs/quickalgo_library.ts index 67340cfd..c5af238b 100644 --- a/frontend/task/libs/quickalgo_library.ts +++ b/frontend/task/libs/quickalgo_library.ts @@ -26,6 +26,7 @@ export interface QuickalgoLibraryBlock { blocklyJson?: any, anyArgs?: boolean, variants?: any, + hidden?: boolean, } export interface QuickAlgoCustomClass {