-
-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
Description
Now editor.addConnection passed pure data:
context.editor.addConnection({
id: getUID(),
source: source.nodeId,
sourceOutput: source.key,
target: target.nodeId,
targetInput: target.key
})But we can use cusom Connection class, f.e.: https://github.com/Ni55aN/allmatter/blob/main/src/editor/connections/index.ts
import { ClassicPreset } from 'rete'
import { Node } from '../types';
export class Connection<A extends Node, B extends Node> extends ClassicPreset.Connection<A, B> { }https://github.com/Ni55aN/allmatter/blob/main/src/editor/import-export.ts#L81-L83
const conn = new Connection(source, c.sourceOutput, target, c.targetInput);
await di.editor.addConnection(conn);I want to have ability to provide connection class resolver (middleware) like this
render.addPreset(Presets.classic.setup({
customize: {
control(data) {
if (data.payload instanceof ColorPicker) return ColorPickerUI
if (data.payload instanceof Preview) return PreviewUI
return Presets.classic.InputControl as any
},
}
}));Thanks!
Reactions are currently unavailable