From c08ab8c67d8ef1cae0412f70e41a316d14178bef Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Fri, 29 Jan 2021 19:23:57 +0100 Subject: [PATCH] [react-script-editor] npm and doc updates --- samples/react-script-editor/README.md | 36 ++++++++++--------- .../config/package-solution.json | 2 +- samples/react-script-editor/gulpfile.js | 3 +- samples/react-script-editor/package.json | 12 +++---- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/samples/react-script-editor/README.md b/samples/react-script-editor/README.md index ed5b8bbb2..13c964088 100644 --- a/samples/react-script-editor/README.md +++ b/samples/react-script-editor/README.md @@ -17,6 +17,8 @@ extensions: This version works only for SharePoint Online. If you want a version for Sharepoint on-premises go to [react-script-editor-onprem](../react-script-editor-onprem). +**It's important you read and understand the notes on [deployment](#deploy-to-non-script-sites--modern-team-sites).** + ## Summary Coming from old classic SharePoint pages you might have existing script solutions you want to re-use on a modern page without having to repackage it as a new SharePoint Framework web part. This web part is similar to the classic @@ -129,6 +131,22 @@ element.innerHTML = "Team: " + _teamsContexInfo.teamName + "Channel: " + _t ![Script Editor web part in Teams](./assets/modern-script-editor-wp-teams.gif) +### Deploy to non-script sites / modern team sites +By default this web part is not allowed on no-script sites, as it allows execution of arbitrary script. This is by design as from a security and governance perspective you might not want arbitrary script added to your pages. This is typically something you want control over. + +If you however want to allow the web part for non-script sites like Office 365 Group modern team sites you have to edit `ScriptEditorWebPart.manifest.json` with the following change: +``` +"requiresCustomScript": false +``` + +### Deploy tenant wide +By default you have to install this web part per site collection where you want it availble. If you want it enabled by default on all sites you have to edit `package-solution.json` with the following change: +``` +"skipFeatureDeployment": true +``` + +In order to make it available to absolutely all sites you need apply the _Deploy to non-script sites / modern team site_ change as well. + ## Used SharePoint Framework Version ![drop](https://img.shields.io/badge/drop-1.10.0-green.svg) @@ -164,6 +182,7 @@ Version|Date|Comments 1.0.0.14|Oct 13th, 2019|Added resolve to fix pnpm issue. Updated author info. 1.0.0.15|Mar 16th, 2020|Upgrade to SPFx v1.10.0. Add support for Teams tab. Renamed package file. 1.0.0.16|April 1st, 2020|Improved how script tags are handled and cleaned up on smart page navigation. +1.0.17.0|January 29th, 2021|Changed versioning to 3 parts. Updated npm packages, restructured documentation, minor change to webpack analyzer setup. ## Disclaimer **THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** @@ -185,23 +204,6 @@ Version|Date|Comments * Upload .sppkg file from sharepoint\solution to your tenant App Catalog * E.g.: https://<tenant>.sharepoint.com/sites/AppCatalog/AppCatalog * Add the web part to a site collection, and test it on a page - -### Deploy to non-script sites / modern team sites -By default this web part is not allowed on no-script sites, as it allows execution of arbitrary script. This is by design as from a security and governance perspective you might not want arbitrary script added to your pages. This is typically something you want control over. - -If you however want to allow the web part for non-script sites like Office 365 Group modern team sites you have to edit `ScriptEditorWebPart.manifest.json` with the following change: -``` -"requiresCustomScript": false -``` - -### Deploy tenant wide -By default you have to install this web part per site collection where you want it availble. If you want it enabled by default on all sites you have to edit `package-solution.json` with the following change: -``` -"skipFeatureDeployment": true -``` - -In order to make it available to absolutely all sites you need apply the _Deploy to non-script sites / modern team site_ change as well. - ## Features This web part illustrates the following concepts on top of the SharePoint Framework: diff --git a/samples/react-script-editor/config/package-solution.json b/samples/react-script-editor/config/package-solution.json index 6c25bcb94..e0f4cff20 100644 --- a/samples/react-script-editor/config/package-solution.json +++ b/samples/react-script-editor/config/package-solution.json @@ -3,7 +3,7 @@ "solution": { "name": "Modern Script Editor web part by mikaelsvenson", "id": "1425175f-3ed8-44d2-8fc4-dd1497191294", - "version": "1.0.0.16", + "version": "1.0.17.0", "includeClientSideAssets": true, "skipFeatureDeployment": false, "isDomainIsolated": false diff --git a/samples/react-script-editor/gulpfile.js b/samples/react-script-editor/gulpfile.js index 2e718c8a2..15df2798d 100644 --- a/samples/react-script-editor/gulpfile.js +++ b/samples/react-script-editor/gulpfile.js @@ -13,8 +13,7 @@ build.configureWebpack.mergeConfig({ openAnalyzer: false, analyzerMode: 'static', reportFilename: path.join(dropPath, `${lastDirName}.stats.html`), - generateStatsFile: true, - statsFilename: path.join(dropPath, `${lastDirName}.stats.json`), + generateStatsFile: false, logLevel: 'error' })); diff --git a/samples/react-script-editor/package.json b/samples/react-script-editor/package.json index 6f020e3c9..8bf0d46f6 100644 --- a/samples/react-script-editor/package.json +++ b/samples/react-script-editor/package.json @@ -1,6 +1,6 @@ { "name": "pnp-script-editor", - "version": "1.0.0", + "version": "1.0.17", "private": true, "main": "lib/index.js", "engines": { @@ -15,13 +15,13 @@ "@microsoft/sp-lodash-subset": "1.10.0", "@microsoft/sp-property-pane": "1.10.0", "@microsoft/sp-webpart-base": "1.10.0", - "@pnp/spfx-controls-react": "1.16.0", - "@pnp/spfx-property-controls": "1.17.0", + "@pnp/spfx-controls-react": "2.4.0", + "@pnp/spfx-property-controls": "2.3.0", "@types/es6-promise": "0.0.33", "@types/react": "16.8.8", "@types/react-dom": "16.8.3", "@types/webpack-env": "1.13.1", - "office-ui-fabric-react": "6.189.2", + "office-ui-fabric-react": "6.214.0", "react": "16.8.5", "react-dom": "16.8.5" }, @@ -37,11 +37,11 @@ "ajv": "~5.2.2", "gulp": "~3.9.1", "tslint-microsoft-contrib": "5.0.0", - "webpack-bundle-analyzer": "^3.6.1" + "webpack-bundle-analyzer": "^4.4.0" }, "scripts": { "build": "gulp bundle", "clean": "gulp clean", "test": "gulp test" } -} +} \ No newline at end of file