retejs / rete

JavaScript framework for visual programming
https://retejs.org
MIT License
10.17k stars 653 forks source link

component title #593

Closed lexoring closed 1 year ago

lexoring commented 1 year ago

Hello. Please tell me how to set a second name when creating a component so that there is a different name in the editor in the header. For example, super("add1", "addition of numbers") test

unhott commented 1 year ago

You can simply change it to super(“Addition of Numbers”);

if you really want to keep the ‘add1’ you can try to add a multiline string.

super(“add1/nAddition of Numbers”);

lexoring commented 1 year ago

Thanks for the answer, but I really need to save the "Add1" and separately the text of the description of the block. Because the text "Addition of Numbers" will be in another language, and I need the name of the "Add1" block in English, then to process the name of the block at json. I need to have them separately.

I tried how you suggested super(“add1/nAddition of Numbers”); does not work like that.

Ni55aN commented 1 year ago

In order not to change the node identifier, you can change the title through a custom node component (check the readme of the specific render plugin you are using)

hedecai commented 1 year ago

Hi. Is there a way to change the socket show name, for example we want to internationalization the editor for users. Thanks.

Ni55aN commented 1 year ago

@hedecai there are a couple of approaches (if we are talking about dynamic update):

or you can set new Rete.Socket('<name>') before loading graph

hedecai commented 1 year ago

@hedecai there are a couple of approaches (if we are talking about dynamic update):

  • custom nodes: create custom Socket component (depending on render plugin)
  • change socket.name and call node.update() (may not work in vue render, then you need to manually update the vueContext's children)

or you can set new Rete.Socket('<name>') before loading graph

@Ni55aN Thanks.

We'll try it.

rete-js[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.