@@ -25,7 +25,7 @@ define(function(require){
2525
2626 this . on ( 'contextMenu:component:edit' , this . loadComponentEdit ) ;
2727 this . on ( 'contextMenu:component:copy' , this . onCopy ) ;
28- this . on ( 'contextMenu:component:copyID' , this . onCopyID ) ,
28+ this . on ( 'contextMenu:component:copyID' , this . onCopyID ) ;
2929 this . on ( 'contextMenu:component:cut' , this . onCut ) ;
3030 this . on ( 'contextMenu:component:delete' , this . deleteComponentPrompt ) ;
3131 } ,
@@ -93,7 +93,10 @@ define(function(require){
9393 view . offsetTopFromWindow = view . $el . offset ( ) . top - $ ( window ) . scrollTop ( ) ;
9494 // This is in the helper method because the height needs to be
9595 // manipulated before the drag start method due to adding drop zones
96- view . showDropZones ( ) ;
96+ // Passing the supported layout as a parameter allows the method to
97+ // determine which drop zones should be displayed
98+ var supportedLayout = view . getSupportedLayout ( ) ;
99+ view . showDropZones ( supportedLayout ) ;
97100 $ ( this ) . attr ( 'data-component-id' , view . model . get ( '_id' ) ) ;
98101 $ ( this ) . attr ( 'data-block-id' , view . model . get ( '_parentId' ) ) ;
99102 return $ ( '<div class="drag-helper">' + view . model . get ( 'title' ) + '</div>' ) ;
@@ -133,29 +136,49 @@ define(function(require){
133136 } ) ;
134137 } ,
135138
139+ getSupportedLayout : function ( ) {
140+ var componentType = _ . find ( Origin . editor . data . componenttypes . models , function ( type ) {
141+ return type . get ( 'component' ) === this . model . get ( '_component' ) ;
142+ } , this ) ;
143+
144+ var supportedLayout = componentType . get ( 'properties' ) . _supportedLayout ;
145+
146+ return {
147+ full : _ . indexOf ( supportedLayout . enum , 'full-width' ) > - 1 ,
148+ half : _ . indexOf ( supportedLayout . enum , 'half-width' ) > - 1
149+ }
150+ } ,
151+
136152 evaluateLayout : function ( ) {
153+ var supportedLayout = this . getSupportedLayout ( ) ;
154+ var isFullWidthSupported = supportedLayout . full ;
155+ var isHalfWidthSupported = supportedLayout . half ;
156+
137157 var movePositions = {
138158 left : false ,
139159 right : false ,
140160 full : false
141161 } ;
142162
143- var siblings = this . model . getSiblings ( ) ;
144- var showFull = ! siblings . length ;
145- var type = this . model . get ( '_layout' ) ;
146- switch ( type ) {
147- case 'left' :
148- movePositions . right = true ;
149- movePositions . full = showFull ;
150- break ;
151- case 'right' :
152- movePositions . left = true ;
153- movePositions . full = showFull ;
154- break ;
155- case 'full' :
156- movePositions . left = true ;
157- movePositions . right = true ;
158- break
163+ if ( isHalfWidthSupported ) {
164+ var siblings = this . model . getSiblings ( ) ;
165+ var showFull = ! siblings . length && isFullWidthSupported ;
166+ var type = this . model . get ( '_layout' ) ;
167+
168+ switch ( type ) {
169+ case 'left' :
170+ movePositions . right = true ;
171+ movePositions . full = showFull ;
172+ break ;
173+ case 'right' :
174+ movePositions . left = true ;
175+ movePositions . full = showFull ;
176+ break ;
177+ case 'full' :
178+ movePositions . left = true ;
179+ movePositions . right = true ;
180+ break
181+ }
159182 }
160183
161184 this . model . set ( '_movePositions' , movePositions ) ;
0 commit comments