Custom blocks (Part 1)

Could you please provide a project link?

I don't have a project that has it (at the moment).
But if you want the code for quick copy-pasting, then here you are:

let result = false;

function menuFromItems( lstItems){
let menu = new MenuMorph( item=>result=item);
lstItems.asArray().forEach( it=>{ 
let itName = itVal = it;
if( it instanceof List){
      [ itName, itVal] = [it.at(1), it.cdr()];
      itVal = menuFromItems( itVal);
      menu.addPair( itName, itVal, '\u25ba');
    }
    else if( it == "~")
menu.addLine();
else if( it == "")
menu.addItem( "close", true);
else menu.addItem( itName, itVal);
 });
 return menu;
} 
let m = menuFromItems( items); 
m.title = ti;
m._destroy = m.destroy;
m.destroy= ()=>{ result ||= true; m._destroy()};
m.popUpAtHand( this.world());

return ()=>result;

Here's the code for the blockJS-13.0 script pic (3) block:

Can you show me the code?

Simpler:
untitled script pic (100)


You forgot to add inputs for the menu block.

OK.

How to make submenus?

<p> tags ugh.

That isnt related to the topic.

Put a list into one of the item inputs. Like this:

What’s wrong with <p> tags?

preview disappears

Wdym?

Why would you put those inside <p>

Without <p>:
[scratchblocks]
@addInput
[/scratchblocks]

With <p>:

[scratchblocks] @addInput [/scratchblocks]

Why would you use <p> on scratchblocks

This topic was automatically closed after reaching the maximum limit of 100 replies. Continue discussion at Custom blocks (Part 2).