diff --git a/samples/react-script-editor/README.md b/samples/react-script-editor/README.md index 32cdcfa4f..af35187c1 100644 --- a/samples/react-script-editor/README.md +++ b/samples/react-script-editor/README.md @@ -39,12 +39,6 @@ The web part works by loading each script in a ` -``` - If all you want is to add markup on the page, you can do that as well. Adding the following html would show a headline and a list. ```html diff --git a/samples/react-script-editor/config/package-solution.json b/samples/react-script-editor/config/package-solution.json index 5cd166d8c..8110fd898 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.10", + "version": "1.0.0.11", "includeClientSideAssets": true, "skipFeatureDeployment": false }, diff --git a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts index 055043f94..669973996 100644 --- a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts +++ b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts @@ -13,6 +13,7 @@ import { IScriptEditorWebPartProps } from './IScriptEditorWebPartProps'; import PropertyPaneLogo from './PropertyPaneLogo'; export default class ScriptEditorWebPart extends BaseClientSideWebPart { + public save: (script: string) => void = (script: string) => { this.properties.script = script; this.render(); @@ -149,14 +150,10 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart 0) { urls.push(scriptTag.src); - if (scriptTag.attributes["reload"]) { - forceReload.push(scriptTag.src); - } } if (scriptTag.onload && scriptTag.onload.length > 0) { onLoads.push(scriptTag.onload); @@ -172,14 +169,12 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPartSPComponentLoader)._instance; - hackReload._systemJsLoader.delete(urls[i]); - } - } catch (silent) { } - await SPComponentLoader.loadScript(urls[i], { globalExportsName: "ScriptGlobal" }); + let scriptUrl = urls[i]; + if (this.renderedOnce) { + let prefix = scriptUrl.indexOf('?') === -1 ? '?' : '&'; + scriptUrl += prefix + 'cow=' + new Date().getTime(); + } + await SPComponentLoader.loadScript(scriptUrl, { globalExportsName: "ScriptGlobal" }); } catch (error) { if (console.error) { console.error(error);