Node-red-contrib-blockly 1.1.0 released

Hi folks,

Mister Blockly (alias @cymplecy) has granted me permission to publish version 1.1.0 on NPM.

For those not following all our discussions, here is a summary of all functionality that has been added:

  • A new timestamp block has been added, which generates a timestamp (as a number similar to the Inject node):
  • A new date conversion block has been added, which can extract various information from a timestamp:
  • Copy/paste between separate blockly nodes is now possible. Restriction: only 1 block or (horizontal) chain of blocks can be copied. It is unfortunately not possible to copy a series of statement blocks at once.
  • Multi language support has been added. Currently the blocks can be displayed in english, french, dutch, japanese. Thanks to @tilleul and @utaani for their translations!
  • A new comment block has been added, to generate Javascript comments:
  • A new Javascript block has been added, in case no blocks are available for the required functionality:
    Caution: try to avoid using this block as much as possible, since this doesn't really fit into the philosophy of Blockly ...
  • Fix for getting 'keys' for normal Javascript objects (i.e. non Node-RED memory)
  • Support for nested properties in both object-set block and object-get blocks, using the dot-notation:
  • A new 'has property' option has been added to the object-get block, to check whether a specified property exists in an object (or in flow/global/node memory):
  • A new 'remove property' option has been added to the object-get block, to remove a specified property from an object (or from flow/global/node memory):
  • A warning icon is displayed on the property-get block, if the input is not a string literal (but e.g. a variable). This indicates that nested properties are not allowed in this case.

Have fun !
We will continue discussing here bugs or new feature requests ...


My additions to Bart's notes

My workaround is to surround the wanted blocks in a while loop - then do the CTRL-C, restore original code and then past with CTRL-V where I want to

+1000 :slight_smile:
(But I've used it myself!)

But note a limitation that you can't use a variable for the property value if it has dots in it
But you can actually put one get inside another get if needed

This is intended to be "long-term" (until Christmas ) release so don't wait around for new features to appear - try it out now :slight_smile:


Since Christmas is coming, I thought I'd make a small request :slight_smile:

Now that we have persistent context storage, its easy to make useful nodes that retain values but there's always the problem of when they are copied and re-used elsewhere - all context values are lost.

So the node needs to have initialisation code to set them to sensible values

I used to use a compicated if statement to check if context exists but decided to try and use the well used equivalent of

context.set('value', (context.get('value') || 0))

but it won't let me stick a 0 in the slot


so I have to do


Just something to consider for the fabled 1.2.0 release :slight_smile:

Oh no, now I'm going to relate Christmas to Mister Blockly. That won't be fun anymore :rofl:

So you want the OR-block to accept the zero? If so I will have a look at it. But it is a non-custom block, so not sure I can workaround it...

Well - what we really should have is a simple to use initialise block that does the work for us :slight_smile:

initialise [context dropdown menu] [property] [value]

or maybe call it default?
default [context dropdown menu] [property] to [value]