Skip to content

Blocks for adding elements to array #249

@aolney

Description

@aolney

I'm using a custom blocks palette and have a block for an array of objects (ELIZA rules):

rules = 
  [ 
    { pattern: /(.*)you remember(.*)/, position: 2, response: 'Do you often think of #'}
  ]

Pedagogically I'd like to give this block as an example and then another block with a rule template:

{ pattern: /``/, position: ``, response: ``}

The problem is that although I can make this block appear in the palette, it does not have a "notch" and so will not drag/drop into the correct insertion point in the rules array. This block instead is a a "flat" block typical of parameters.

I have a work around for this which is to use an IIFE, but pedagogically that is not so nice:

do -> return { pattern: /``/, position: ``, response: ``}

This drag/drops with the desired behavior.

It seems obvious this is a UI issue, so if there is a way of forcing notches from the palette itself, I could solve the problem that way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions