1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

fixes #3051 broken image links

The image browser always returns image path relative to admin directory,
which doesn't work in case the target is a plugin.
Added a check for the target and modify the preview url in case
it is a plugin.
This commit is contained in:
Achim Ennenbach 2018-07-04 13:28:45 +02:00
parent 89e3716c3f
commit d8c63724b2
2 changed files with 12 additions and 0 deletions

View File

@ -41,6 +41,10 @@ e107::js('core', 'plupload/plupload.full.js', 'jquery', 2);
e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery');
e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.min.js', 'jquery', 2);
e107::js('core', 'core/mediaManager.js',"jquery",5);
// issue #3051 Preview url is wrong when target page is a plugin
// Using this variable to check for the plugins directory and replace with empty space in case of...
// see mediaManager.js (line ~399ff)
e107::js('inline', 'var e107_plugins_directory = "' . str_replace('../', '', e_PLUGIN) . '";');
e107::wysiwyg(true);
/*
* CLOSE - GO TO MAIN SCREEN

View File

@ -395,6 +395,14 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
{
preview = $htmlHolder.val();
}
// issue #3051 Preview url is wrong when target page is a plugin
var s = new RegExp('/' + e107_plugins_directory + '[\\w]+/', 'gmi');
if (window.top.document.URL.match(s))
{
preview = preview.replace(e107_plugins_directory, '');
}
}
$('div#' + target + "_prev", window.top.document).html(preview); // set new value