File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -303,10 +303,23 @@ export default class WizardBuilder extends WebformBuilder {
303
303
if ( component instanceof WizardBuilder ) {
304
304
return ;
305
305
}
306
+ if ( ! window . sessionStorage ) {
307
+ return console . warn ( this . t ( 'sessionStorageSupportError' ) ) ;
308
+ }
309
+ // If pasting after the Wizard's page, check if a full Wizard page was copied and pass it to addPage method
306
310
if ( this . _form . components . find ( comp => _ . isEqual ( component . component , comp ) ) ) {
307
- this . addPage ( component ) ;
311
+ const data = window . sessionStorage . getItem ( 'formio.clipboard' ) ;
312
+ if ( data ) {
313
+ const schema = JSON . parse ( data ) ;
314
+ // If the copied component is not a Wizard's page, do nothing since we can't paste outside the panel in Wizard
315
+ if ( schema . type !== 'panel' ) {
316
+ return ;
317
+ }
318
+ this . addPage ( schema ) ;
319
+ }
308
320
}
309
321
else {
322
+ // If we are not trying to paster after the current Wizard's page, just pass it to the WebformBuilder
310
323
return super . pasteComponent ( component ) ;
311
324
}
312
325
}
You can’t perform that action at this time.
0 commit comments