From b3a87a76721a261c78d683b3ccad0bb48e6adb3f Mon Sep 17 00:00:00 2001 From: Mikael Svenson Date: Mon, 20 Aug 2018 12:08:16 +0200 Subject: [PATCH] Use a supported workaround to get the script root. --- .../src/webparts/scriptEditor/1x1.png | Bin 0 -> 156 bytes .../webparts/scriptEditor/ScriptEditorWebPart.ts | 15 ++++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 samples/react-script-editor/src/webparts/scriptEditor/1x1.png diff --git a/samples/react-script-editor/src/webparts/scriptEditor/1x1.png b/samples/react-script-editor/src/webparts/scriptEditor/1x1.png new file mode 100644 index 0000000000000000000000000000000000000000..4b1bad2b7cdd89aa9794bc5cb3bf9a0f08f08fbc GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^j3CUx1SBVv2j2s6ii6yp7}lMWc?smOq&xaLGB9lH z=l+w(3gmMZctjR6Fz_7)VaDV6D^h@hk|nMYCBgY=CFO}lsSE{)nRz98d8s7|CVB>X tMus01GN%F+@p!s8hDd}b|M>sko`Llr)4%1WjV(ZN22WQ%mvv4FO#lXzDk1;? literal 0 HcmV?d00001 diff --git a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts index 6534afe5a..20cfb64d6 100644 --- a/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts +++ b/samples/react-script-editor/src/webparts/scriptEditor/ScriptEditorWebPart.ts @@ -36,11 +36,7 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPartthis.context.manifest).loaderConfig.internalModuleBaseUrls[0]; - if (scriptRoot.indexOf("localhost") != -1) { - scriptRoot += "dist/"; - } - const editorPopUp: any = await SPComponentLoader.loadScript(scriptRoot + '/editor-pop-up.min.js', { globalExportsName: "EditorPopUp" }); + const editorPopUp: any = await SPComponentLoader.loadScript(this.getScriptRoot() + '/editor-pop-up.min.js', { globalExportsName: "EditorPopUp" }); const element: React.ReactElement = React.createElement( editorPopUp.default, { @@ -53,6 +49,15 @@ export default class ScriptEditorWebPart extends BaseClientSideWebPart