@@ -126,6 +126,33 @@ export class WorkflowPasteShortcutsContribution
126126 } ) ;
127127 return nodes ;
128128 }
129+ /** Apply clipboard data */
130+ public async apply (
131+ data : WorkflowClipboardData ,
132+ ) : Promise < WorkflowNodeEntity [ ] > {
133+ const { source, json : rawJSON } = data ;
134+ const json = generateUniqueWorkflow ( {
135+ json : rawJSON ,
136+ isUniqueId : ( id : string ) => ! this . entityManager . getEntityById ( id ) ,
137+ } ) ;
138+
139+ // You need to initialize the node data before rebuilding the node
140+ await this . saveService . initNodeData ( json . nodes as WorkflowNodeJSON [ ] ) ;
141+
142+ const titleCache : string [ ] = [ ] ;
143+ const offset = this . calcPasteOffset ( data . bounds ) ;
144+ const container = this . getSelectedContainer ( ) ;
145+ const nodes = await this . render ( {
146+ json,
147+ source,
148+ titleCache,
149+ offset,
150+ parent : container ,
151+ toContainer : container ,
152+ } ) ;
153+ this . selectNodes ( nodes ) ;
154+ return nodes ;
155+ }
129156 /** Handling replication events */
130157 private async handle (
131158 _event : KeyboardEvent ,
@@ -161,33 +188,6 @@ export class WorkflowPasteShortcutsContribution
161188 return ;
162189 }
163190 }
164- /** Apply clipboard data */
165- private async apply (
166- data : WorkflowClipboardData ,
167- ) : Promise < WorkflowNodeEntity [ ] > {
168- const { source, json : rawJSON } = data ;
169- const json = generateUniqueWorkflow ( {
170- json : rawJSON ,
171- isUniqueId : ( id : string ) => ! this . entityManager . getEntityById ( id ) ,
172- } ) ;
173-
174- // You need to initialize the node data before rebuilding the node
175- await this . saveService . initNodeData ( json . nodes as WorkflowNodeJSON [ ] ) ;
176-
177- const titleCache : string [ ] = [ ] ;
178- const offset = this . calcPasteOffset ( data . bounds ) ;
179- const container = this . getSelectedContainer ( ) ;
180- const nodes = await this . render ( {
181- json,
182- source,
183- titleCache,
184- offset,
185- parent : container ,
186- toContainer : container ,
187- } ) ;
188- this . selectNodes ( nodes ) ;
189- return nodes ;
190- }
191191 /** Calculate Paste Offset */
192192 private calcPasteOffset ( boundsData : WorkflowClipboardRect ) : IPoint {
193193 const { x, y, width, height } = boundsData ;
0 commit comments