rete icon indicating copy to clipboard operation
rete copied to clipboard

Unhandled Rejection (Error): The event multiselectnode does not exist

Open benswinburne opened this issue 4 years ago • 4 comments

I was trying to use the mutliselectnode event which admittedly doesn't appear to be documented but it seems to be in the codebase and I've seen it in a few responses to issues here.

However, I'm getting the error seen in the title when attaching this event to my editor.

  editor.on('multiselectnode', (nodes) => {
    console.log(nodes);
  });
    "rete": "^1.4.4",
    "rete-area-plugin": "0.2.1",
    "rete-auto-arrange-plugin": "^0.4.0",
    "rete-comment-plugin": "^0.7.0-rc.1",
    "rete-connection-path-plugin": "^0.3.1",
    "rete-connection-plugin": "0.7.2",
    "rete-dock-plugin": "^0.2.1",
    "rete-history-plugin": "^0.2.1",
    "rete-minimap-plugin": "^0.3.1",
    "rete-react-render-plugin": "0.2.0",

benswinburne avatar Jul 07 '20 21:07 benswinburne

@benswinburne I checked the code and only see the trigger executed here: https://github.com/retejs/rete/blob/88373184be4b6fda65048a0e262563bf87f7bbdf/src/view/node.ts#L77 I tested it locally and it will trigger on select. So I don't get the error. The result is exactly the same as if you check for selectnode.

    editor.on('selectnode', (nodes) => {
      console.log('selectnode', nodes);
    });

Is selectnode working? If you need your selections you can use editor.selected.list

creadicted avatar Jul 09 '20 18:07 creadicted

@creadicted I'd come to the same conclusion and used another event. I also can't replicate the problem on codesandbox to show you now so I'll work out what might be different about my local copy.

I've used which is sufficient for now.

  editor.on('nodeselected', (node) => {
    options.setSelected([...editor.selected.list]);
  });

That said, it'd be nice if the multiselectnode event fired only when 1 or more nodes were selected and passed in [nodes] instead of just node perhaps.

I'll try and get this replicated and post later.

benswinburne avatar Jul 09 '20 21:07 benswinburne

That said, it'd be nice if the multiselectnode event fired only when 1 or more nodes were selected and passed in [nodes] instead of just node perhaps.

I added a Pullrequest. I would argue that mutliselectnode should be triggered if its higher than one. https://github.com/retejs/rete/pull/462

creadicted avatar Jul 10 '20 13:07 creadicted

That's what I meant :) makes sense for multi when > 1 is selected, definitely.

benswinburne avatar Jul 10 '20 22:07 benswinburne

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.

rete-js[bot] avatar Jul 13 '23 10:07 rete-js[bot]