mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat(editor): Add undo/redo create connection in new canvas (no-changelog) (#10141)
This commit is contained in:
@@ -74,6 +74,32 @@ export function mapLegacyConnectionsToCanvasConnections(
|
||||
return mappedConnections;
|
||||
}
|
||||
|
||||
export function mapLegacyConnectionToCanvasConnection(
|
||||
sourceNode: INodeUi,
|
||||
targetNode: INodeUi,
|
||||
legacyConnection: [IConnection, IConnection],
|
||||
): Connection {
|
||||
const source = sourceNode.id;
|
||||
const sourceHandle = createCanvasConnectionHandleString({
|
||||
mode: CanvasConnectionMode.Output,
|
||||
type: legacyConnection[0].type,
|
||||
index: legacyConnection[0].index,
|
||||
});
|
||||
const target = targetNode.id;
|
||||
const targetHandle = createCanvasConnectionHandleString({
|
||||
mode: CanvasConnectionMode.Input,
|
||||
type: legacyConnection[1].type,
|
||||
index: legacyConnection[1].index,
|
||||
});
|
||||
|
||||
return {
|
||||
source,
|
||||
sourceHandle,
|
||||
target,
|
||||
targetHandle,
|
||||
};
|
||||
}
|
||||
|
||||
export function parseCanvasConnectionHandleString(handle: string | null | undefined) {
|
||||
const [mode, type, index] = (handle ?? '').split('/');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user