diff --git a/samples/react-script-editor/README.md b/samples/react-script-editor/README.md index 8c2ac34b9..32cdcfa4f 100644 --- a/samples/react-script-editor/README.md +++ b/samples/react-script-editor/README.md @@ -7,35 +7,44 @@ Script Editor Web Part, and allows you do drop arbitrary script or html on a mod > Notice. All client-side web parts are deployed or enabled to be available in site level by tenant administrator using tenant app catalog. If there are concerns on enabling script options in a tenant, this web part or a approach should not be approved by tenant administrators. -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. +As an example add the following scripts to the web part in order to show stock ticker info on your page. First *tv.js* is loaded, and then the script block is executed to show the ticker information. ```html -
- - - + + ``` 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/assets/modern-script-editor-wp.gif b/samples/react-script-editor/assets/modern-script-editor-wp.gif index 16384a1fd..573473c86 100644 Binary files a/samples/react-script-editor/assets/modern-script-editor-wp.gif and b/samples/react-script-editor/assets/modern-script-editor-wp.gif differ diff --git a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts index 07e521f00..055043f94 100644 --- a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts +++ b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts @@ -30,7 +30,7 @@ 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); @@ -166,11 +169,21 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPartSPComponentLoader)._instance; + hackReload._systemJsLoader.delete(urls[i]); + } + } catch (silent) { } await SPComponentLoader.loadScript(urls[i], { globalExportsName: "ScriptGlobal" }); } catch (error) { - console.error(error); + if (console.error) { + console.error(error); + } } } if (oldamd) {