From ebfd03df0ed8a051c5b10491d2b114ddf980f5a7 Mon Sep 17 00:00:00 2001 From: Matteo Piovanelli Date: Thu, 17 Mar 2022 18:06:46 +0100 Subject: [PATCH] Use a variable with an actual path to a base url to find the actual path to (#8546) the medialibrary --- .../TinyMce/Scripts/plugins/medialibrary/plugin.js | 4 +--- .../TinyMce/Scripts/plugins/medialibrary/plugin.min.js | 5 +---- .../Modules/TinyMce/Views/Body-Html.Editor.cshtml | 8 +++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.js b/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.js index 26cf7fa8f..e2d2496c9 100644 --- a/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.js +++ b/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.js @@ -17,9 +17,7 @@ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceMediaPicker'); ed.addCommand('mceMediaLibrary', function () { ed.focus(); - var adminIndex = location.href.toLowerCase().indexOf("/admin/"); - if (adminIndex === -1) return; - var url = location.href.substr(0, adminIndex) + "/Admin/Orchard.MediaLibrary?dialog=true"; + var url = baseOrchardPath + "Admin/Orchard.MediaLibrary?dialog=true"; $.colorbox({ href: url, iframe: true, diff --git a/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.min.js b/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.min.js index 96ed4b31c..35bc0b3e0 100644 --- a/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.min.js +++ b/src/Orchard.Web/Modules/TinyMce/Scripts/plugins/medialibrary/plugin.min.js @@ -1,4 +1 @@ -(function(){tinymce.create("tinymce.plugins.Orchard.MediaLibrary",{init:function(n){n.addCommand("mceMediaLibrary",function(){var t,i;(n.focus(),t=location.href.toLowerCase().indexOf("/admin/"),t!==-1)&&(i=location.href.substr(0,t)+"/Admin/Orchard.MediaLibrary?dialog=true",$.colorbox({href:i,iframe:!0,reposition:!0,width:"90%",height:"90%",onLoad:function(){$("html, body").css("overflow","hidden")},onClosed:function(){var n,r,i,u;if($("html, body").css("overflow",""),n=$.colorbox.selectedData,n!=null){for(r="",i=0;i(); + var urlPrefix = WorkContext.Resolve().RequestUrlPrefix; + if (!string.IsNullOrWhiteSpace(urlPrefix)) { + urlPrefix += "/"; + } } @{