File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
app/code/Magento/PageBuilder/view/adminhtml/web
ts/js/content-type/banner Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -512,6 +512,26 @@ export default class Preview extends BasePreview {
512
512
events . on ( `image:${ this . contentType . id } :uploadAfter` , ( ) => {
513
513
this . contentType . dataStore . set ( "background_type" , "image" ) ;
514
514
} ) ;
515
+ events . on ( `stage:${ this . contentType . stageId } :viewportChangeAfter` , ( ) => {
516
+ const style = this . wrapper . getAttribute ( "style" ) ||
517
+ this . wrapper . getAttribute ( "data-jarallax-original-styles" ) ;
518
+ let backgroundImage ;
519
+
520
+ if ( ! $ ( ".desktop-viewport" ) . length ) {
521
+ backgroundImage = this . contentType . dataStore . get ( "background_image" ) ;
522
+ }
523
+ if ( ! $ ( ".mobile-viewport" ) . length ) {
524
+ backgroundImage = this . contentType . dataStore . get ( "mobile_image" ) ;
525
+ }
526
+
527
+ jarallax ( this . wrapper , "destroy" ) ;
528
+ this . wrapper . setAttribute ( "style" , style ) ;
529
+ // @ts -ignore
530
+ if ( this . contentType . dataStore . get ( "background_type" ) as string !== "video" && backgroundImage . length ) {
531
+ // @ts -ignore
532
+ this . wrapper . style . backgroundImage = `url(${ backgroundImage [ 0 ] . url } )` ;
533
+ }
534
+ } ) ;
515
535
}
516
536
517
537
/**
You can’t perform that action at this time.
0 commit comments