Monday, March 26, 2018

Updated Modern Script Editor Web Part with fix for AMD modules and exposing _spPageContextInfo

image

The web part haven’t change much, but the following configuration options are now available:

  • Keep or remove padding on the web part zone – useful if you have script which does not output any markup.
  • Set the _spPageContextInfo variable – useful if you have old scripts using this variable on classic SharePoint pages.

I have also fixed the code so that it won’t fail when loading AMD module scripts – meaning the scripts will not detect themselves as module scripts, but load globally instead.

You can get the code from https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-script-editor.

3 comments:

  1. Want to thank you for your efforts in this. This part is a life saver!

    ReplyDelete
  2. Awesome part! I'm having issues with huge white spaces on the right side of the page using the part on modern pages. Tried with team site and communication sites template.

    ReplyDelete
    Replies
    1. Can you give a sample with screenshot in edit mode, and log it as an issue on github. Makes it easier to track. And tag @wobba in the issue.

      Delete