Skip to content

How to set a function for Block's helpURL? #641

@pouyakary

Description

@pouyakary

Hy everyone.

I'm making a custom blockly language to replace RegEx's syntax:


You may find it here

Now as you may have noticed it runs inside of Electron hence I can't set a URL for it. So about the only thing I knew to make it work was to insert some JavaScript into the URL:

this.setHelpUrl(`javascript: void openHelpWindowAtReferenceId("${ block_id }")`);

But what happens is that nothing happens. I tried to see what goes wrong and did this:

this.setHelpUrl(`javascript: void ( ( ) => {
   try {
      openHelpWindowAtReferenceId("${ block_id }");
   } catch ( err ) {
      alert( err );
   }
})( )`);

And what I got was openHelpWindowAtReferenceId. So it was in the global namespace at first and changed it's place to be initialized before Blockly and changed the loading process so that could be loaded first. But still it's not defined.

All the basic JavaScript functions are available but none of my functions works there.

Why is that so? Is Blockly using any XSS blocker for URLs? What can I do to set a function for the block's Help property?

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