diff --git a/samples/react-script-editor/config/package-solution.json b/samples/react-script-editor/config/package-solution.json index d58872b45..94469da03 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 Puzzlepart", "id": "1425175f-3ed8-44d2-8fc4-dd1497191294", - "version": "1.0.0.8", + "version": "1.0.0.9", "includeClientSideAssets": true, "skipFeatureDeployment": false }, diff --git a/samples/react-script-editor/gulpfile.js b/samples/react-script-editor/gulpfile.js index 4a7fe74e4..77def8ee3 100644 --- a/samples/react-script-editor/gulpfile.js +++ b/samples/react-script-editor/gulpfile.js @@ -22,13 +22,4 @@ build.configureWebpack.mergeConfig({ } }); -let copyDynamic = build.subTask('copy-dynamic-load-files', function (gulp, buildOptions, done) { -gulp.src('./node_modules/sharepoint-modern-script-editor-propertypane/bundles/editor-pop-up.min.js') - .pipe(gulp.dest('./temp/deploy')) - .pipe(gulp.dest('./dist')); - -done(); -}); -build.rig.addPostBuildTask(copyDynamic); - build.initialize(gulp); \ No newline at end of file diff --git a/samples/react-script-editor/package-lock.json b/samples/react-script-editor/package-lock.json index 73d35f010..2786ebf11 100644 --- a/samples/react-script-editor/package-lock.json +++ b/samples/react-script-editor/package-lock.json @@ -688,8 +688,7 @@ "@microsoft/load-themed-styles": { "version": "1.7.53", "resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.7.53.tgz", - "integrity": "sha1-J7KoW8wJdoyOwrZS/9mIBCeah8U=", - "dev": true + "integrity": "sha1-J7KoW8wJdoyOwrZS/9mIBCeah8U=" }, "@microsoft/loader-cased-file": { "version": "1.5.1", @@ -2284,15 +2283,6 @@ "@types/q": "0.0.32" } }, - "@types/prop-types": { - "version": "15.5.5", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.5.5.tgz", - "integrity": "sha512-mOrlCEdwX3seT3n0AXNt4KNPAZZxcsABUHwBgFXOt+nvFUXkxCAO6UBJHPrDxWEa2KDMil86355fjo8jbZ+K0Q==", - "dev": true, - "requires": { - "@types/react": "15.6.6" - } - }, "@types/q": { "version": "0.0.32", "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", @@ -2466,7 +2456,6 @@ "version": "5.17.1", "resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-5.17.1.tgz", "integrity": "sha512-4/EtO6Ns7kNtKxC+6InShwVQeNQEDT5H8Ex7m/i4OrT9i7csje4YwBQPkkpm31qJwEZEyD7bbAwyLezI63sLhg==", - "dev": true, "requires": { "tslib": "1.8.1" } @@ -2475,7 +2464,6 @@ "version": "5.31.2", "resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-5.31.2.tgz", "integrity": "sha512-G7grRENxdB4NcUEtQmSisRDnIeQHQmAfcpIe5AWmVQxnB/e8U/jT+SzYqK6V12SnLf4ufN5nepZkdOjgbtuA1Q==", - "dev": true, "requires": { "@microsoft/load-themed-styles": "1.7.53", "@uifabric/merge-styles": "5.17.1", @@ -2487,7 +2475,6 @@ "version": "5.34.1", "resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-5.34.1.tgz", "integrity": "sha512-xUZ+KlCxmA9PCEOtutfeyYnPmySkEVA/ak3fb8Uj54684GlbrnlqrfNEencVG5YgQDcNEaztTwxW3I7jSCrYJQ==", - "dev": true, "requires": { "@uifabric/merge-styles": "5.17.1", "prop-types": "15.6.0", @@ -13661,7 +13648,7 @@ "resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-5.118.3.tgz", "integrity": "sha512-MYRah+boLs75UXkTjh1gYORitjtt7ixrfl5BFtFWkX8AGSau2ulZT4XQ0gOyKumvPfCqLzlNKXv//84tptUm0g==", "requires": { - "@microsoft/load-themed-styles": "1.7.74", + "@microsoft/load-themed-styles": "1.7.53", "@uifabric/icons": "5.8.0", "@uifabric/merge-styles": "5.17.1", "@uifabric/styling": "5.31.2", @@ -13670,11 +13657,6 @@ "tslib": "1.8.1" }, "dependencies": { - "@microsoft/load-themed-styles": { - "version": "1.7.74", - "resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.7.74.tgz", - "integrity": "sha512-zBCIhD3ETnNpPQuLRVFjCUoiLZp7H4BVXR9GDnFwkCP+Q0tBlGya1Q0Gw4iG5ngBUE8+cs3r3zZGDYvezJqJUg==" - }, "@uifabric/icons": { "version": "5.8.0", "resolved": "https://registry.npmjs.org/@uifabric/icons/-/icons-5.8.0.tgz", @@ -13683,35 +13665,6 @@ "@uifabric/styling": "5.31.2", "tslib": "1.8.1" } - }, - "@uifabric/merge-styles": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-5.17.1.tgz", - "integrity": "sha512-4/EtO6Ns7kNtKxC+6InShwVQeNQEDT5H8Ex7m/i4OrT9i7csje4YwBQPkkpm31qJwEZEyD7bbAwyLezI63sLhg==", - "requires": { - "tslib": "1.8.1" - } - }, - "@uifabric/styling": { - "version": "5.31.2", - "resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-5.31.2.tgz", - "integrity": "sha512-G7grRENxdB4NcUEtQmSisRDnIeQHQmAfcpIe5AWmVQxnB/e8U/jT+SzYqK6V12SnLf4ufN5nepZkdOjgbtuA1Q==", - "requires": { - "@microsoft/load-themed-styles": "1.7.74", - "@uifabric/merge-styles": "5.17.1", - "@uifabric/utilities": "5.34.1", - "tslib": "1.8.1" - } - }, - "@uifabric/utilities": { - "version": "5.34.1", - "resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-5.34.1.tgz", - "integrity": "sha512-xUZ+KlCxmA9PCEOtutfeyYnPmySkEVA/ak3fb8Uj54684GlbrnlqrfNEencVG5YgQDcNEaztTwxW3I7jSCrYJQ==", - "requires": { - "@uifabric/merge-styles": "5.17.1", - "prop-types": "15.6.0", - "tslib": "1.8.1" - } } } }, @@ -16556,20 +16509,6 @@ "safe-buffer": "5.1.1" } }, - "sharepoint-modern-script-editor-propertypane": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sharepoint-modern-script-editor-propertypane/-/sharepoint-modern-script-editor-propertypane-1.0.5.tgz", - "integrity": "sha512-CcLKJSHaf5hyCHB6O2bloahgfN9WZVp7CH/ROFhZ3d19KxhuoTS91HzPsn8bIB+qaKdimfva+f9ucxhF6AuMvg==", - "dev": true, - "requires": { - "@types/prop-types": "15.5.5", - "@types/react": "15.6.6", - "@types/react-dom": "15.5.6", - "office-ui-fabric-react": "5.118.3", - "react": "15.6.2", - "react-dom": "15.6.2" - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", diff --git a/samples/react-script-editor/package.json b/samples/react-script-editor/package.json index a151532e2..59544a2bc 100644 --- a/samples/react-script-editor/package.json +++ b/samples/react-script-editor/package.json @@ -8,12 +8,13 @@ "dependencies": { "@microsoft/sp-core-library": "1.5.1", "@microsoft/sp-webpart-base": "1.5.1", + "@types/es6-promise": "0.0.33", "@types/react": "15.6.6", "@types/react-dom": "15.5.6", "@types/webpack-env": "1.13.1", + "office-ui-fabric-react": "^5.118.3", "react": "15.6.2", - "react-dom": "15.6.2", - "@types/es6-promise": "0.0.33" + "react-dom": "15.6.2" }, "devDependencies": { "@microsoft/sp-build-web": "1.5.1", @@ -23,7 +24,6 @@ "@types/mocha": "2.2.38", "ajv": "~5.2.2", "gulp": "~3.9.1", - "sharepoint-modern-script-editor-propertypane": "^1.0.5", "webpack-bundle-analyzer": "^2.13.1" }, "scripts": { diff --git a/samples/react-script-editor/src/webparts/scriptEditor/1x1.png b/samples/react-script-editor/src/webparts/scriptEditor/1x1.png deleted file mode 100644 index 4b1bad2b7..000000000 Binary files a/samples/react-script-editor/src/webparts/scriptEditor/1x1.png and /dev/null differ diff --git a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts index 20cfb64d6..d9eaf4b3d 100644 --- a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts +++ b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts @@ -35,8 +35,11 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart = React.createElement( editorPopUp.default, { @@ -49,15 +52,6 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart { + constructor() { + super(); + + this._showDialog = this._showDialog.bind(this); + this._closeDialog = this._closeDialog.bind(this); + this._cancelDialog = this._cancelDialog.bind(this); + this._onScriptEditorTextChanged = this._onScriptEditorTextChanged.bind(this); + + const uiFabricCSS: string = ` + .pzl-bgColor-themeDark, .pzl-bgColor-themeDark--hover:hover { + background-color: "[theme:themeDark, default:#005a9e]"; + } + `; + loadStyles(uiFabricCSS); + this.state = { + showDialog: false + }; + } + + public componentDidMount(): void { + this.setState({ script: this.props.script, loaded: this.props.script }); + } + private _showDialog() { + this.setState({ showDialog: true }); + } + + private _closeDialog() { + this.setState({ showDialog: false }); + this.props.save(this.state.script); + } + + private _cancelDialog() { + this.props.save(this.state.loaded); + this.setState({ showDialog: false, script: this.state.loaded }); + } + + private _onScriptEditorTextChanged(text: string) { + this.setState({ script: text }); + } + + public render(): React.ReactElement { + const viewMode = ; + + return ( +
+
+
+
+
+ {this.props.title} +

+ Edit snippet +
+
+
+
+ + + + Save + Cancel + + {viewMode} + +
); + } +} \ No newline at end of file diff --git a/samples/react-script-editor/src/webparts/scriptEditor/components/overrides.css b/samples/react-script-editor/src/webparts/scriptEditor/components/overrides.css new file mode 100644 index 000000000..9070ce210 --- /dev/null +++ b/samples/react-script-editor/src/webparts/scriptEditor/components/overrides.css @@ -0,0 +1,4 @@ +.ScriptPart .ms-Dialog-main { + width: 65%; + max-width: 65%; +} \ No newline at end of file