Merge branch '4.12' into 4.13

This commit is contained in:
Steve Boyd 2023-05-08 12:56:33 +12:00
commit 4f963bef5b
3 changed files with 66 additions and 27 deletions

View File

@ -1 +1 @@
!function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./client/src/legacy/SilverStripeNavigator.js")}({"./client/src/legacy/SilverStripeNavigator.js":function(e,t,r){"use strict";function n(e){return document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_")+e}var i=r(0),o=function(e){return e&&e.__esModule?e:{default:e}}(i);(0,o.default)(document).ready(function(){(0,o.default)("#switchView a.newWindow").on("click",function(e){return window.open(this.href,n(this.target)).focus(),!1}),(0,o.default)("#SilverStripeNavigatorLink").on("click",function(e){return(0,o.default)("#SilverStripeNavigatorLinkPopup").toggle(),!1}),(0,o.default)("#SilverStripeNavigatorLinkPopup a.close").on("click",function(e){return(0,o.default)("#SilverStripeNavigatorLinkPopup").hide(),!1}),(0,o.default)("#SilverStripeNavigatorLinkPopup input").on("focus",function(e){this.select()})})},0:function(e,t){e.exports=jQuery}}); !function(e){function t(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="./client/src/legacy/SilverStripeNavigator.js")}({"./client/src/legacy/SilverStripeNavigator.js":function(e,t,r){"use strict";!function(){function e(e){return document.getElementsByTagName("base")[0].href.replace("http://","").replace(/\//g,"_").replace(/\./g,"_")+e}function t(e){var t=getComputedStyle(e).display;e.style.display="none",e.dataset.__toggle_display=t}function r(e){e.style.display=e.dataset.__toggle_display?e.dataset.__toggle_display:"block"}function n(e){"none"!==getComputedStyle(e).display?t(e):r(e)}var a=document.querySelectorAll("#switchView a.newWindow");if(a.length>0){var i=!0,l=!1,o=void 0;try{for(var u,c=a.values()[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var f=u.value;!function(t){t.addEventListener("click",function(r){return r.preventDefault(),window.open(t.href,e(t.target)).focus(),!1})}(f)}}catch(e){l=!0,o=e}finally{try{!i&&c.return&&c.return()}finally{if(l)throw o}}}var v=document.getElementById("SilverStripeNavigatorLinkPopup");if(v){var s=document.getElementById("SilverStripeNavigatorLink");s&&s.addEventListener("click",function(e){return e.preventDefault(),n(v),!1});var d=v.querySelectorAll("a.close");if(d.length>0){var y=!0,p=!1,g=void 0;try{for(var S,m=d.values()[Symbol.iterator]();!(y=(S=m.next()).done);y=!0)S.value.addEventListener("click",function(e){return e.preventDefault(),t(v),!1})}catch(e){p=!0,g=e}finally{try{!y&&m.return&&m.return()}finally{if(p)throw g}}}var h=v.querySelectorAll("input");if(h.length>0){var _=!0,w=!1,b=void 0;try{for(var x,E=h.values()[Symbol.iterator]();!(_=(x=E.next()).done);_=!0){var k=x.value;!function(e){e.addEventListener("focus",function(t){e.select()})}(k)}}catch(e){w=!0,b=e}finally{try{!_&&E.return&&E.return()}finally{if(w)throw b}}}}}()}});

View File

@ -1,29 +1,69 @@
import $ from 'jquery'; (function() {
function windowName(suffix) {
function windowName(suffix) { const base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_');
return base + suffix; return base + suffix;
} }
function displayHide(elem) {
const displayComputed = getComputedStyle(elem).display;
elem.style.display = 'none';
elem.dataset.__toggle_display = displayComputed;
}
$(document).ready(function() { function displayShow(elem) {
$('#switchView a.newWindow').on('click', function(e) { elem.style.display = elem.dataset.__toggle_display ? elem.dataset.__toggle_display : 'block';
var w = window.open(this.href, windowName(this.target)); }
function displayToggle(elem) {
const displayComputed = getComputedStyle(elem).display;
if (displayComputed !== 'none') {
displayHide(elem);
} else {
displayShow(elem);
}
}
const newWindowLinks = document.querySelectorAll('#switchView a.newWindow');
if (newWindowLinks.length > 0) {
for (const link of newWindowLinks.values()) {
link.addEventListener('click', function(e) {
e.preventDefault();
const w = window.open(link.href, windowName(link.target));
w.focus(); w.focus();
return false; return false;
}); });
}
}
$('#SilverStripeNavigatorLink').on('click', function(e) { const popup = document.getElementById('SilverStripeNavigatorLinkPopup');
$('#SilverStripeNavigatorLinkPopup').toggle(); if (popup) {
const navigatorLink = document.getElementById('SilverStripeNavigatorLink');
if (navigatorLink) {
navigatorLink.addEventListener('click', function(e) {
e.preventDefault();
displayToggle(popup);
return false; return false;
}); });
}
$('#SilverStripeNavigatorLinkPopup a.close').on('click', function(e) { const closeLinks = popup.querySelectorAll('a.close');
$('#SilverStripeNavigatorLinkPopup').hide(); if (closeLinks.length > 0) {
for (const link of closeLinks.values()) {
link.addEventListener('click', function(e) {
e.preventDefault();
displayHide(popup);
return false; return false;
}); });
}
}
$('#SilverStripeNavigatorLinkPopup input').on('focus',function(e) { const inputs = popup.querySelectorAll('input');
this.select(); if (inputs.length > 0) {
for (const input of inputs.values()) {
input.addEventListener('focus', function(e) {
input.select();
}); });
}); }
}
}
})();

View File

@ -352,7 +352,6 @@ class ContentController extends Controller
if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) { if (Director::isDev() || Permission::check('CMS_ACCESS_CMSMain') || Permission::check('VIEW_DRAFT_CONTENT')) {
if ($this->dataRecord) { if ($this->dataRecord) {
Requirements::css('silverstripe/cms: client/dist/styles/SilverStripeNavigator.css'); Requirements::css('silverstripe/cms: client/dist/styles/SilverStripeNavigator.css');
Requirements::javascript('silverstripe/admin: thirdparty/jquery/jquery.js');
Requirements::javascript('silverstripe/cms: client/dist/js/SilverStripeNavigator.js'); Requirements::javascript('silverstripe/cms: client/dist/js/SilverStripeNavigator.js');
$return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord); $return = $nav = SilverStripeNavigator::get_for_record($this->dataRecord);