diff --git a/samples/react-script-editor/.editorconfig b/samples/react-script-editor/.editorconfig new file mode 100644 index 000000000..8ffcdc4ec --- /dev/null +++ b/samples/react-script-editor/.editorconfig @@ -0,0 +1,25 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# editorconfig.org + +root = true + + +[*] + +# change these settings to your own preference +indent_style = space +indent_size = 2 + +# we recommend you to keep these unchanged +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[{package,bower}.json] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/samples/react-script-editor/.gitattributes b/samples/react-script-editor/.gitattributes new file mode 100644 index 000000000..212566614 --- /dev/null +++ b/samples/react-script-editor/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/samples/react-script-editor/.gitignore b/samples/react-script-editor/.gitignore new file mode 100644 index 000000000..b19bbe123 --- /dev/null +++ b/samples/react-script-editor/.gitignore @@ -0,0 +1,32 @@ +# Logs +logs +*.log +npm-debug.log* + +# Dependency directories +node_modules + +# Build generated files +dist +lib +solution +temp +*.sppkg + +# Coverage directory used by tools like istanbul +coverage + +# OSX +.DS_Store + +# Visual Studio files +.ntvs_analysis.dat +.vs +bin +obj + +# Resx Generated Code +*.resx.ts + +# Styles Generated Code +*.scss.ts diff --git a/samples/react-script-editor/.npmignore b/samples/react-script-editor/.npmignore new file mode 100644 index 000000000..2c93a9384 --- /dev/null +++ b/samples/react-script-editor/.npmignore @@ -0,0 +1,14 @@ +# Folders +.vscode +coverage +node_modules +sharepoint +src +temp + +# Files +*.csproj +.git* +.yo-rc.json +gulpfile.js +tsconfig.json diff --git a/samples/react-script-editor/.yo-rc.json b/samples/react-script-editor/.yo-rc.json new file mode 100644 index 000000000..c58215deb --- /dev/null +++ b/samples/react-script-editor/.yo-rc.json @@ -0,0 +1,8 @@ +{ + "@microsoft/generator-sharepoint": { + "libraryName": "pzl-script-editor", + "framework": "react", + "version": "1.0.0", + "libraryId": "1425175f-3ed8-44d2-8fc4-dd1497191294" + } +} \ No newline at end of file diff --git a/samples/react-script-editor/README.md b/samples/react-script-editor/README.md new file mode 100644 index 000000000..54bf2884a --- /dev/null +++ b/samples/react-script-editor/README.md @@ -0,0 +1,85 @@ +# Script editor web part for modern pages built in React + +## 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 +Script Editor Web Part, and allows you do drop arbitrary script or html on a modern page. + +As an example add the following scripts to the web part in order to show weather info on your page. First *jQuery* is loaded, then the *simpleWeather* extension, and finally the last script block is executed to show the weather. + +```html +
+ + + +``` + +The web part works by loading each script in a `