.CanvasZoneContainer class no longer available in Publish mode

%3CLINGO-SUB%20id%3D%22lingo-sub-2017640%22%20slang%3D%22en-US%22%3E.CanvasZoneContainer%20class%20no%20longer%20available%20in%20Publish%20mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2017640%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20custom%20webpart%20code%20created%20using%20spfx%20react%20framework.%20For%20a%20specific%20requirement%20to%20set%20a%20webpart%20background%2C%20we%20are%20using%20below%20custom%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3BjQuery('.CanvasZoneContainer%3Afirst').css(%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22background-image%22%3A%22url(%22%2Bthis.props.context.pageContext.web.absoluteUrl%2B%22%2FSiteAssets%2Fcontent.jpg)%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22height%22%3A%22200px%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22background-position%22%3A%2240%25%26nbsp%3B60%25%22%2C%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D)%3B%26nbsp%3B%3CBR%20%2F%3EThis%20used%20to%20set%20the%20background%20image%20and%20was%20working%20fine%20earlier.%20Now%20from%20past%20few%20days%2C%20this%20is%20setting%20background%20image%20of%20webpart%20only%20in%20edit%20mode%20of%20page%20but%20not%20in%20publish%20mode%20of%20page.%3CBR%20%2F%3EWe%20have%20checked%20'.CanvasZoneContainer'%20is%20now%20present%20only%20in%20sharepoint%20web%20page%20edit%20mode%20but%20no%20longer%20available%20in%20publish%20mode%20%2C%20suspecting%20of%20page%20layout%20change%20from%20Microsoft.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Visitor

We have a custom webpart code created using spfx react framework. For a specific requirement to set a webpart background, we are using below custom code:

 jQuery('.CanvasZoneContainer:first').css({
      "background-image":"url("+this.props.context.pageContext.web.absoluteUrl+"/SiteAssets/content.jpg)",
      "height":"200px",
      "background-position":"40% 60%",
    }); 
This used to set the background image and was working fine earlier. Now from past few days, this is setting background image of webpart only in edit mode of page but not in publish mode of page.
We have checked '.CanvasZoneContainer' is now present only in sharepoint web page edit mode but no longer available in publish mode , suspecting of page layout change from Microsoft.

0 Replies