mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
NEW Open external links in preview mode in new window (fixes #7652)
Rather than disabling the links altogether, which is counter-intuitive to most users. See https://github.com/silverstripe/sapphire/pull/638. Also hide a duplicate $SilverStripeNavigator on the previewed website (in case it has been manually applied to the template).
This commit is contained in:
parent
dddc5bdf46
commit
1d2288b091
@ -138,9 +138,17 @@
|
||||
var href = links[i].getAttribute('href');
|
||||
if(!href) continue;
|
||||
|
||||
// Disable external links
|
||||
if (href.match(/^http:\/\//)) links[i].setAttribute('href', 'javascript:false');
|
||||
// Open external links in new window to avoid "escaping" the
|
||||
// internal page context in the preview iframe,
|
||||
// which is important to stay in for the CMS logic.
|
||||
if (href.match(/^http:\/\//)) links[i].setAttribute('target', '_blank');
|
||||
}
|
||||
|
||||
// Hide duplicate navigator, as it replicates existing UI in the CMS
|
||||
var navi = doc.getElementById('SilverStripeNavigator');
|
||||
if(navi) navi.style.display = 'none';
|
||||
var naviMsg = doc.getElementById('SilverStripeNavigatorMessage');
|
||||
if(naviMsg) naviMsg.style.display = 'none';
|
||||
},
|
||||
|
||||
expand: function(inclMenu) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user