Commit 696e5f29 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[!!!][TASK] remove iframe / navFrameScript and legacy JS functionality

Resolves: #96125
Related: #94058
Releases: main
Change-Id: I34d9fe4c02d2a44d4cfb401e73c49c239264d9c4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72347


Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 64204e04
......@@ -163,7 +163,6 @@ body {
background: white;
}
.scaffold-content-navigation-iframe,
.scaffold-content-module-iframe {
display: block;
border: none;
......
......@@ -22,5 +22,4 @@ export enum ScaffoldIdentifierEnum {
contentNavigation = '.t3js-scaffold-content-navigation',
contentNavigationDataComponent = '.t3js-scaffold-content-navigation [data-component]',
contentNavigationSwitcher = '.t3js-scaffold-content-navigation-switcher',
contentNavigationIframe = '.t3js-scaffold-content-navigation-iframe',
}
......@@ -28,8 +28,6 @@ export interface Module {
name: string;
component: string;
navigationComponentId: string;
navigationFrameScript: string;
navigationFrameScriptParam: string;
link: string;
}
......@@ -48,8 +46,6 @@ export function getRecordFromName(name: string): Module {
name: name,
component: '',
navigationComponentId: '',
navigationFrameScript: '',
navigationFrameScriptParam: '',
link: ''
};
}
......@@ -57,8 +53,6 @@ export function getRecordFromName(name: string): Module {
name: name,
component: moduleElement.dataset.component,
navigationComponentId: moduleElement.dataset.navigationcomponentid,
navigationFrameScript: moduleElement.dataset.navigationframescript,
navigationFrameScriptParam: moduleElement.dataset.navigationframescriptparameters,
link: moduleElement.getAttribute('href')
};
}
......@@ -75,7 +75,7 @@ class ModuleMenu {
* @return {string}
*/
private static includeId(moduleData: Module, params: string): string {
if (!moduleData.navigationComponentId && !moduleData.navigationFrameScript) {
if (!moduleData.navigationComponentId) {
return params;
}
// get id
......@@ -221,7 +221,6 @@ class ModuleMenu {
* Hint: This method can't be static (yet), as this must be bound to the ModuleMenu instance.
*/
public reloadFrames(): void {
Viewport.NavigationContainer.refresh();
Viewport.ContentContainer.refresh();
}
......@@ -422,27 +421,11 @@ class ModuleMenu {
$('#' + moduleName).focus();
this.loadedModule = moduleName;
// compatibility, will be removed in TYPO3 v12.0.
top.currentSubScript = moduleData.link;
// compatibility, will be removed in TYPO3 v12.0.
top.currentModuleLoaded = moduleName;
// Synchronisze navigation container if module is a standalone module (linked via ModuleMenu).
// Synchronise navigation container if module is a standalone module (linked via ModuleMenu).
// Do not hide navigation for intermediate modules like record_edit, which may be used
// with our without a navigation component, depending on the context.
if (moduleData.navigationComponentId) {
Viewport.NavigationContainer.showComponent(moduleData.navigationComponentId);
} else if (moduleData.navigationFrameScript) {
Viewport.NavigationContainer.show('typo3-navigationIframe');
const interactionRequest = new ClientRequest('typo3.showModule', event);
this.openInNavFrame(
moduleData.navigationFrameScript,
moduleData.navigationFrameScriptParam,
new TriggerRequest(
'typo3.loadModuleComponents',
new ClientRequest('typo3.showModule', null)
),
);
} else {
Viewport.NavigationContainer.hide(false);
}
......@@ -472,16 +455,6 @@ class ModuleMenu {
deferred.then((): void => {
if (moduleData.navigationComponentId) {
Viewport.NavigationContainer.showComponent(moduleData.navigationComponentId);
} else if (moduleData.navigationFrameScript) {
Viewport.NavigationContainer.show('typo3-navigationIframe');
this.openInNavFrame(
moduleData.navigationFrameScript,
moduleData.navigationFrameScriptParam,
new TriggerRequest(
'typo3.loadModuleComponents',
interactionRequest,
),
);
} else {
Viewport.NavigationContainer.hide(true);
}
......@@ -498,40 +471,10 @@ class ModuleMenu {
interactionRequest,
),
);
// compatibility, will be removed in TYPO3 v12.0.
top.currentSubScript = moduleData.link;
// compatibility, will be removed in TYPO3 v12.0.
top.currentModuleLoaded = moduleName;
});
return deferred;
}
/**
* @param {string} url
* @param {string} params
* @param {InteractionRequest} interactionRequest
* @returns {JQueryDeferred<TriggerRequest>}
*/
private openInNavFrame(url: string, params: string, interactionRequest: InteractionRequest): JQueryDeferred<TriggerRequest> {
const navUrl = url + (params ? (url.includes('?') ? '&' : '?') + params : '');
const currentUrl = Viewport.NavigationContainer.getUrl();
const deferred = Viewport.NavigationContainer.setUrl(
url,
new TriggerRequest('typo3.openInNavFrame', interactionRequest),
);
if (currentUrl !== navUrl) {
// if deferred is already resolved, execute directly
if (deferred.state() === 'resolved') {
Viewport.NavigationContainer.refresh();
// otherwise hand in future callback
} else {
deferred.then(Viewport.NavigationContainer.refresh);
}
}
return deferred;
}
/**
* @param {string} module
* @param {string} url
......@@ -540,26 +483,12 @@ class ModuleMenu {
* @returns {JQueryDeferred<TriggerRequest>}
*/
private openInContentContainer(module: string, url: string, params: string, interactionRequest: InteractionRequest): JQueryDeferred<TriggerRequest> {
let deferred;
if (top.nextLoadModuleUrl) {
console.warn('Using nextLoadModuleUrl is deprecated, and will not work in TYPO3 v12.0. anymores.');
deferred = Viewport.ContentContainer.setUrl(
top.nextLoadModuleUrl,
new TriggerRequest('typo3.openInContentFrame', interactionRequest),
null
);
top.nextLoadModuleUrl = '';
} else {
const urlToLoad = url + (params ? (url.includes('?') ? '&' : '?') + params : '');
deferred = Viewport.ContentContainer.setUrl(
urlToLoad,
new TriggerRequest('typo3.openInContentFrame', interactionRequest),
module
);
}
return deferred;
const urlToLoad = url + (params ? (url.includes('?') ? '&' : '?') + params : '');
return Viewport.ContentContainer.setUrl(
urlToLoad,
new TriggerRequest('typo3.openInContentFrame', interactionRequest),
module
);
}
}
......
......@@ -120,33 +120,9 @@ class NavigationContainer extends AbstractContainer {
);
deferred.then((): void => {
this.parent.classList.add('scaffold-content-navigation-expanded');
const iFrameElement = this.getIFrameElement();
if (iFrameElement) {
iFrameElement.setAttribute('src', urlToLoad);
}
});
return deferred;
}
public getUrl(): string {
const iFrameElement = this.getIFrameElement();
if (iFrameElement) {
return iFrameElement.getAttribute('src');
}
return '';
}
public refresh(): any {
const iFrameElement = this.getIFrameElement();
if (iFrameElement) {
return iFrameElement.contentWindow.location.reload();
}
return undefined;
}
private getIFrameElement(): HTMLIFrameElement|null {
return this.container.querySelector(ScaffoldIdentifierEnum.contentNavigationIframe) as HTMLIFrameElement;
}
}
export = NavigationContainer;
......@@ -127,10 +127,7 @@ interface Window {
require: Function;
list_frame: Window;
jump: Function;
currentSubScript: string;
currentModuleLoaded: string;
fsMod: { [key: string]: any };
nextLoadModuleUrl: string;
// required for Paste.ts
// TODO these should be passed as data attributes
......
......@@ -45,12 +45,6 @@ class BackendModule
*/
protected $component = '';
/**
* @var string
* @deprecated using inline JavaScript is deprecated, will be removed in TYPO3 v12.0
*/
protected $onClick = '';
/**
* @var string
*/
......@@ -61,18 +55,6 @@ class BackendModule
*/
protected $navigationComponentId = '';
/**
* @var string
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
protected $navigationFrameScript = '';
/**
* @var string
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
protected $navigationFrameScriptParameters = '';
/**
* @var \SplObjectStorage
*/
......@@ -268,66 +250,6 @@ class BackendModule
return $this->navigationComponentId;
}
/**
* @param string $navigationFrameScript
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
public function setNavigationFrameScript($navigationFrameScript)
{
$this->navigationFrameScript = $navigationFrameScript;
}
/**
* @return string
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
public function getNavigationFrameScript()
{
return $this->navigationFrameScript;
}
/**
* @param string $navigationFrameScriptParameters
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
public function setNavigationFrameScriptParameters($navigationFrameScriptParameters)
{
$this->navigationFrameScriptParameters = $navigationFrameScriptParameters;
}
/**
* @return string
* @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
*/
public function getNavigationFrameScriptParameters()
{
return $this->navigationFrameScriptParameters;
}
/**
* Set onClick
*
* @param string $onClick
* @deprecated using inline JavaScript is deprecated, will be removed in TYPO3 v12.0
*/
public function setOnClick($onClick)
{
trigger_error('BackendModule::setOnClick() is deprecated and will be removed in v12.', E_USER_DEPRECATED);
$this->onClick = $onClick;
}
/**
* Get onClick
*
* @return string
* @deprecated using inline JavaScript is deprecated, will be removed in TYPO3 v12.0
*/
public function getOnClick()
{
trigger_error('BackendModule::getOnClick() is deprecated and will be removed in v12.', E_USER_DEPRECATED);
return $this->onClick;
}
public function setCollapsed(bool $collapsed): void
{
$this->collapsed = $collapsed;
......
......@@ -161,10 +161,6 @@ class BackendModuleRepository implements SingletonInterface
if (!empty($module['title']) && is_string($module['title'])) {
$entry->setTitle($this->getLanguageService()->sL($module['title']));
}
// @deprecated using inline JavaScript is deprecated, will be removed in TYPO3 v12.0
if (!empty($module['onclick']) && is_string($module['onclick'])) {
$entry->setOnClick($module['onclick']);
}
if (!empty($module['link']) && is_string($module['link'])) {
$entry->setLink($module['link']);
} elseif (empty($module['link']) && !empty($module['path']) && is_string($module['path'])) {
......@@ -182,17 +178,6 @@ class BackendModuleRepository implements SingletonInterface
if (!empty($module['navigationComponentId']) && is_string($module['navigationComponentId'])) {
$entry->setNavigationComponentId($module['navigationComponentId']);
}
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
if (!empty($module['navigationFrameScript']) && is_string($module['navigationFrameScript'])) {
$entry->setNavigationFrameScript($module['navigationFrameScript']);
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
} elseif (!empty($module['parentNavigationFrameScript']) && is_string($module['parentNavigationFrameScript'])) {
$entry->setNavigationFrameScript($module['parentNavigationFrameScript']);
}
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
if (!empty($module['navigationFrameScriptParam']) && is_string($module['navigationFrameScriptParam'])) {
$entry->setNavigationFrameScriptParameters($module['navigationFrameScriptParam']);
}
if (!empty($module['standalone'])) {
$entry->setStandalone((bool)$module['standalone']);
}
......@@ -280,8 +265,6 @@ class BackendModuleRepository implements SingletonInterface
'component' => $moduleComponent,
'originalLink' => $moduleLink,
'description' => $moduleLabels['shortdescription'] ?? '',
'navigationFrameScript' => null,
'navigationFrameScriptParam' => null,
'navigationComponentId' => null,
];
} elseif (is_array($moduleData['sub'] ?? null)) {
......@@ -296,8 +279,6 @@ class BackendModuleRepository implements SingletonInterface
$submoduleLabels = $moduleLoader->getLabelsForModule($submoduleKey);
$submoduleDescription = $submoduleLabels['shortdescription'];
$originalLink = $submoduleLink;
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
$navigationFrameScript = $submoduleData['navFrameScript'] ?? null;
$modules[$moduleKey]['subitems'][$submoduleKey] = [
'name' => $moduleName . '_' . $submoduleName,
'title' => $submoduleLabels['title'],
......@@ -306,18 +287,8 @@ class BackendModuleRepository implements SingletonInterface
'component' => $submoduleComponent,
'originalLink' => $originalLink,
'description' => $submoduleDescription,
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
'navigationFrameScript' => $navigationFrameScript,
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
'navigationFrameScriptParam' => $submoduleData['navFrameScriptParam'] ?? null,
'navigationComponentId' => $submoduleData['navigationComponentId'] ?? null,
];
// if the main module has a navframe script, inherit to the submodule,
// but only if it is not disabled explicitly (option is set to FALSE)
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
if (($moduleData['navFrameScript'] ?? false) && $submoduleData['inheritNavigationComponentFromMainModule'] !== false) {
$modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
}
}
}
}
......
......@@ -181,16 +181,6 @@ class ModuleLoader
$finalModuleConfiguration['component'] = 'TYPO3/CMS/Backend/Module/Iframe';
}
// @deprecated since TYPO3 v11, will be removed in TYPO3 v12.0
if (!empty($setupInformation['configuration']['navigationFrameModule'])) {
$finalModuleConfiguration['navFrameScript'] = (string)$uriBuilder->buildUriFromRoute(
$setupInformation['configuration']['navigationFrameModule'],
!empty($setupInformation['configuration']['navigationFrameModuleParameters'])
? $setupInformation['configuration']['navigationFrameModuleParameters']
: []
);
}
// Check if this is a submodule
$mainModule = '';
if (str_contains($name, '_')) {
......
......@@ -57,8 +57,6 @@
{f:if(condition: module.link, then: 'href="{module.link}"')}
{f:if(condition: module.component, then: 'data-component="{module.component}"')}
{f:if(condition: module.navigationComponentId, then: 'data-navigationcomponentid="{module.navigationComponentId}"')}
{f:if(condition: module.navigationFrameScript, then: 'data-navigationframescript="{module.navigationFrameScript}"')}
{f:if(condition: module.navigationFrameScriptParameters, then: 'data-navigationframescriptparameters="{module.navigationFrameScriptParameters}"')}
{f:if(condition: showChildren, then: 'aria-haspopup="true" aria-expanded="{f:if(condition: module.collapsed, then: \'false\', else: \'true\')}"')}
>
<span class="modulemenu-icon" aria-hidden="true"><f:format.raw>{module.icon}</f:format.raw></span>
......
......@@ -16,8 +16,6 @@
data-modulename="{module.name}"
{f:if(condition: module.link, then: 'href="{module.link}"')}
{f:if(condition: module.navigationComponentId, then: 'data-navigationcomponentid="{module.navigationComponentId}"')}
{f:if(condition: module.navigationFrameScript, then: 'data-navigationframescript="{module.navigationFrameScript}"')}
{f:if(condition: module.navigationFrameScriptParameters, then: 'data-navigationframescriptparameters="{module.navigationFrameScriptParameters}"')}
>
<span class="modulemenu-icon" aria-hidden="true"><f:format.raw>{module.icon}</f:format.raw></span>
<span class="modulemenu-name">{module.title}</span>
......
......@@ -15,8 +15,6 @@
data-modulename="{module.name}"
{f:if(condition: module.link, then: 'href="{module.link}"')}
{f:if(condition: module.navigationComponentId, then: 'data-navigationcomponentid="{module.navigationComponentId}"')}
{f:if(condition: module.navigationFrameScript, then: 'data-navigationframescript="{module.navigationFrameScript}"')}
{f:if(condition: module.navigationFrameScriptParameters, then: 'data-navigationframescriptparameters="{module.navigationFrameScriptParameters}"')}
>
<span class="modulemenu-icon" aria-hidden="true"><f:format.raw>{module.icon}</f:format.raw></span>
<span class="modulemenu-name">{module.title}</span>
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports"],(function(t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ScaffoldIdentifierEnum=void 0,function(t){t.scaffold=".t3js-scaffold",t.header=".t3js-scaffold-header",t.moduleMenu=".t3js-scaffold-modulemenu",t.content=".t3js-scaffold-content",t.contentModule=".t3js-scaffold-content-module",t.contentModuleRouter="typo3-backend-module-router",t.contentModuleIframe=".t3js-scaffold-content-module-iframe",t.contentNavigation=".t3js-scaffold-content-navigation",t.contentNavigationDataComponent=".t3js-scaffold-content-navigation [data-component]",t.contentNavigationSwitcher=".t3js-scaffold-content-navigation-switcher",t.contentNavigationIframe=".t3js-scaffold-content-navigation-iframe"}(n.ScaffoldIdentifierEnum||(n.ScaffoldIdentifierEnum={}))}));
\ No newline at end of file
define(["require","exports"],(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ScaffoldIdentifierEnum=void 0,function(t){t.scaffold=".t3js-scaffold",t.header=".t3js-scaffold-header",t.moduleMenu=".t3js-scaffold-modulemenu",t.content=".t3js-scaffold-content",t.contentModule=".t3js-scaffold-content-module",t.contentModuleRouter="typo3-backend-module-router",t.contentModuleIframe=".t3js-scaffold-content-module-iframe",t.contentNavigation=".t3js-scaffold-content-navigation",t.contentNavigationDataComponent=".t3js-scaffold-content-navigation [data-component]",t.contentNavigationSwitcher=".t3js-scaffold-content-navigation-switcher"}(e.ScaffoldIdentifierEnum||(e.ScaffoldIdentifierEnum={}))}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports"],(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getRecordFromName=void 0,e.getRecordFromName=function(t){const e=document.getElementById(t);return e?{name:t,component:e.dataset.component,navigationComponentId:e.dataset.navigationcomponentid,navigationFrameScript:e.dataset.navigationframescript,navigationFrameScriptParam:e.dataset.navigationframescriptparameters,link:e.getAttribute("href")}:{name:t,component:"",navigationComponentId:"",navigationFrameScript:"",navigationFrameScriptParam:"",link:""}}}));
\ No newline at end of file
define(["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getRecordFromName=void 0,n.getRecordFromName=function(e){const n=document.getElementById(e);return n?{name:e,component:n.dataset.component,navigationComponentId:n.dataset.navigationcomponentid,link:n.getAttribute("href")}:{name:e,component:"",navigationComponentId:"",link:""}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","./Module","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/Event/RegularEvent","./Storage/ModuleStateStorage"],(function(e,t,n,o,a,l,i,r,s,d,u,m){"use strict";a=__importDefault(a);class c{constructor(){this.loadedModule=null,this.spaceKeyPressedOnCollapsible=!1,a.default(()=>this.initialize())}static getCollapsedMainMenuItems(){return l.isset("modulemenu")?JSON.parse(l.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=c.getCollapsedMainMenuItems();t[e]=!0,l.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],l.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId&&!e.navigationFrameScript)return t;let n="";n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0];const o=m.ModuleStateStorage.current(n);return o.selection&&(t="id="+o.selection+"&"+t),t}static toggleMenu(e){const t=a.default(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||a.default(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),l.set("BackendComponents.States.typo3-module-menu",{collapsed:e})}static toggleModuleGroup(e){const t=e.closest(".modulemenu-group"),n=t.querySelector(".modulemenu-group-container"),o="true"===e.attributes.getNamedItem("aria-expanded").value;o?c.addCollapsedMainMenuItem(e.id):c.removeCollapseMainMenuItem(e.id),t.classList.toggle("modulemenu-group-collapsed",o),t.classList.toggle("modulemenu-group-expanded",!o),e.attributes.getNamedItem("aria-expanded").value=(!o).toString(),a.default(n).stop().slideToggle()}static highlightModuleMenuItem(e){a.default(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active").removeAttr("aria-current"),a.default("#"+e).addClass("modulemenu-action-active").attr("aria-current","location")}static getPreviousItem(e){let t=e.parentElement.previousElementSibling;return null===t?c.getLastItem(e):t.firstElementChild}static getNextItem(e){let t=e.parentElement.nextElementSibling;return null===t?c.getFirstItem(e):t.firstElementChild}static getFirstItem(e){return e.parentElement.parentElement.firstElementChild.firstElementChild}static getLastItem(e){return e.parentElement.parentElement.lastElementChild.firstElementChild}static getParentItem(e){return e.parentElement.parentElement.parentElement.firstElementChild}static getFirstChildItem(e){return e.nextElementSibling.firstElementChild.firstElementChild}static getLastChildItem(e){return e.nextElementSibling.lastElementChild.firstElementChild}refreshMenu(){new d(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,this.initializeModuleMenuEvents(),this.loadedModule&&c.highlightModuleMenuItem(this.loadedModule)})}getCurrentModule(){return this.loadedModule}reloadFrames(){i.NavigationContainer.refresh(),i.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const a=o.getRecordFromName(e);return this.loadModuleComponents(a,t,new r("typo3.showModule",n))}initialize(){if(null===document.querySelector(".t3js-modulemenu"))return;let e=a.default.Deferred();e.resolve(),e.then(()=>{this.initializeModuleMenuEvents(),i.Topbar.Toolbar.registerEvent(()=>{document.querySelector(".t3js-scaffold-toolbar")&&this.initializeTopBarEvents()})})}keyboardNavigation(e,t,n=!1){const o=t.parentElement.attributes.getNamedItem("data-level").value;let a=null;switch(n&&(this.spaceKeyPressedOnCollapsible=!1),e.code){case"ArrowUp":a=c.getPreviousItem(t);break;case"ArrowDown":a=c.getNextItem(t);break;case"ArrowLeft":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&c.toggleModuleGroup(t),a=c.getLastChildItem(t)):"2"===o&&(a=c.getPreviousItem(c.getParentItem(t)));break;case"ArrowRight":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&c.toggleModuleGroup(t),a=c.getFirstChildItem(t)):"2"===o&&(a=c.getNextItem(c.getParentItem(t)));break;case"Home":a=e.ctrlKey&&"2"===o?c.getFirstItem(c.getParentItem(t)):c.getFirstItem(t);break;case"End":a=e.ctrlKey&&"2"===o?c.getLastItem(c.getParentItem(t)):c.getLastItem(t);break;case"Space":case"Enter":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")&&("Enter"===e.code&&e.preventDefault(),c.toggleModuleGroup(t),"true"===t.attributes.getNamedItem("aria-expanded").value&&(a=c.getFirstChildItem(t),"Space"===e.code&&(this.spaceKeyPressedOnCollapsible=!0)));break;case"Esc":case"Escape":"2"===o&&(a=c.getParentItem(t),c.toggleModuleGroup(a));break;default:a=null}null!==a&&(e.defaultPrevented||e.preventDefault(),a.focus())}initializeModuleMenuEvents(){const e=document.querySelector(".t3js-modulemenu"),t=function(e){"Space"===e.code&&this.spaceKeyPressedOnCollapsible&&(e.preventDefault(),this.spaceKeyPressedOnCollapsible=!1)}.bind(this);new u("keydown",this.keyboardNavigation).delegateTo(e,".t3js-modulemenu-action"),e.querySelectorAll('[data-level="2"] a.t3js-modulemenu-action[href]').forEach(e=>{e.addEventListener("keyup",t)}),new u("keyup",(e,t)=>{"Space"===e.code&&e.preventDefault()}).delegateTo(e,".t3js-modulemenu-collapsible"),new u("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new u("click",(e,t)=>{e.preventDefault(),c.toggleModuleGroup(t)}).delegateTo(e,".t3js-modulemenu-collapsible")}initializeTopBarEvents(){const e=document.querySelector(".t3js-scaffold-toolbar");new u("keydown",(e,t)=>{this.keyboardNavigation(e,t)}).delegateTo(e,".t3js-modulemenu-action"),new u("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new u("click",e=>{e.preventDefault(),c.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new u("click",e=>{e.preventDefault(),c.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay"));const t=e=>{const t=e.detail.module;if(!t||this.loadedModule===t)return;const n=o.getRecordFromName(t);if(n.link)if(c.highlightModuleMenuItem(t),a.default("#"+t).focus(),this.loadedModule=t,top.currentSubScript=n.link,top.currentModuleLoaded=t,n.navigationComponentId)i.NavigationContainer.showComponent(n.navigationComponentId);else if(n.navigationFrameScript){i.NavigationContainer.show("typo3-navigationIframe");new r("typo3.showModule",event);this.openInNavFrame(n.navigationFrameScript,n.navigationFrameScriptParam,new s("typo3.loadModuleComponents",new r("typo3.showModule",null)))}else i.NavigationContainer.hide(!1)};document.addEventListener("typo3-module-load",t),document.addEventListener("typo3-module-loaded",t)}loadModuleComponents(e,t,n){const o=e.name,a=i.ContentContainer.beforeSetUrl(n);return a.then(()=>{e.navigationComponentId?i.NavigationContainer.showComponent(e.navigationComponentId):e.navigationFrameScript?(i.NavigationContainer.show("typo3-navigationIframe"),this.openInNavFrame(e.navigationFrameScript,e.navigationFrameScriptParam,new s("typo3.loadModuleComponents",n))):i.NavigationContainer.hide(!0),c.highlightModuleMenuItem(o),this.loadedModule=o,t=c.includeId(e,t),this.openInContentContainer(o,e.link,t,new s("typo3.loadModuleComponents",n)),top.currentSubScript=e.link,top.currentModuleLoaded=o}),a}openInNavFrame(e,t,n){const o=e+(t?(e.includes("?")?"&":"?")+t:""),a=i.NavigationContainer.getUrl(),l=i.NavigationContainer.setUrl(e,new s("typo3.openInNavFrame",n));return a!==o&&("resolved"===l.state()?i.NavigationContainer.refresh():l.then(i.NavigationContainer.refresh)),l}openInContentContainer(e,t,n,o){let a;if(top.nextLoadModuleUrl)console.warn("Using nextLoadModuleUrl is deprecated, and will not work in TYPO3 v12.0. anymores."),a=i.ContentContainer.setUrl(top.nextLoadModuleUrl,new s("typo3.openInContentFrame",o),null),top.nextLoadModuleUrl="";else{const l=t+(n?(t.includes("?")?"&":"?")+n:"");a=i.ContentContainer.setUrl(l,new s("typo3.openInContentFrame",o),e)}return a}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new c});return top.TYPO3.ModuleMenu}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","./Enum/Viewport/ScaffoldIdentifier","./Module","jquery","./Storage/Persistent","./Viewport","./Event/ClientRequest","./Event/TriggerRequest","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Core/Event/RegularEvent","./Storage/ModuleStateStorage"],(function(e,t,n,o,l,a,i,s,r,d,u,m){"use strict";l=__importDefault(l);class c{constructor(){this.loadedModule=null,this.spaceKeyPressedOnCollapsible=!1,l.default(()=>this.initialize())}static getCollapsedMainMenuItems(){return a.isset("modulemenu")?JSON.parse(a.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=c.getCollapsedMainMenuItems();t[e]=!0,a.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],a.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId)return t;let n="";n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0];const o=m.ModuleStateStorage.current(n);return o.selection&&(t="id="+o.selection+"&"+t),t}static toggleMenu(e){const t=l.default(n.ScaffoldIdentifierEnum.scaffold);void 0===e&&(e=t.hasClass("scaffold-modulemenu-expanded")),t.toggleClass("scaffold-modulemenu-expanded",!e),e||l.default(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),a.set("BackendComponents.States.typo3-module-menu",{collapsed:e})}static toggleModuleGroup(e){const t=e.closest(".modulemenu-group"),n=t.querySelector(".modulemenu-group-container"),o="true"===e.attributes.getNamedItem("aria-expanded").value;o?c.addCollapsedMainMenuItem(e.id):c.removeCollapseMainMenuItem(e.id),t.classList.toggle("modulemenu-group-collapsed",o),t.classList.toggle("modulemenu-group-expanded",!o),e.attributes.getNamedItem("aria-expanded").value=(!o).toString(),l.default(n).stop().slideToggle()}static highlightModuleMenuItem(e){l.default(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active").removeAttr("aria-current"),l.default("#"+e).addClass("modulemenu-action-active").attr("aria-current","location")}static getPreviousItem(e){let t=e.parentElement.previousElementSibling;return null===t?c.getLastItem(e):t.firstElementChild}static getNextItem(e){let t=e.parentElement.nextElementSibling;return null===t?c.getFirstItem(e):t.firstElementChild}static getFirstItem(e){return e.parentElement.parentElement.firstElementChild.firstElementChild}static getLastItem(e){return e.parentElement.parentElement.lastElementChild.firstElementChild}static getParentItem(e){return e.parentElement.parentElement.parentElement.firstElementChild}static getFirstChildItem(e){return e.nextElementSibling.firstElementChild.firstElementChild}static getLastChildItem(e){return e.nextElementSibling.lastElementChild.firstElementChild}refreshMenu(){new d(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,this.initializeModuleMenuEvents(),this.loadedModule&&c.highlightModuleMenuItem(this.loadedModule)})}getCurrentModule(){return this.loadedModule}reloadFrames(){i.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const l=o.getRecordFromName(e);return this.loadModuleComponents(l,t,new s("typo3.showModule",n))}initialize(){if(null===document.querySelector(".t3js-modulemenu"))return;let e=l.default.Deferred();e.resolve(),e.then(()=>{this.initializeModuleMenuEvents(),i.Topbar.Toolbar.registerEvent(()=>{document.querySelector(".t3js-scaffold-toolbar")&&this.initializeTopBarEvents()})})}keyboardNavigation(e,t,n=!1){const o=t.parentElement.attributes.getNamedItem("data-level").value;let l=null;switch(n&&(this.spaceKeyPressedOnCollapsible=!1),e.code){case"ArrowUp":l=c.getPreviousItem(t);break;case"ArrowDown":l=c.getNextItem(t);break;case"ArrowLeft":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&c.toggleModuleGroup(t),l=c.getLastChildItem(t)):"2"===o&&(l=c.getPreviousItem(c.getParentItem(t)));break;case"ArrowRight":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&c.toggleModuleGroup(t),l=c.getFirstChildItem(t)):"2"===o&&(l=c.getNextItem(c.getParentItem(t)));break;case"Home":l=e.ctrlKey&&"2"===o?c.getFirstItem(c.getParentItem(t)):c.getFirstItem(t);break;case"End":l=e.ctrlKey&&"2"===o?c.getLastItem(c.getParentItem(t)):c.getLastItem(t);break;case"Space":case"Enter":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")&&("Enter"===e.code&&e.preventDefault(),c.toggleModuleGroup(t),"true"===t.attributes.getNamedItem("aria-expanded").value&&(l=c.getFirstChildItem(t),"Space"===e.code&&(this.spaceKeyPressedOnCollapsible=!0)));break;case"Esc":case"Escape":"2"===o&&(l=c.getParentItem(t),c.toggleModuleGroup(l));break;default:l=null}null!==l&&(e.defaultPrevented||e.preventDefault(),l.focus())}initializeModuleMenuEvents(){const e=document.querySelector(".t3js-modulemenu"),t=function(e){"Space"===e.code&&this.spaceKeyPressedOnCollapsible&&(e.preventDefault(),this.spaceKeyPressedOnCollapsible=!1)}.bind(this);new u("keydown",this.keyboardNavigation).delegateTo(e,".t3js-modulemenu-action"),e.querySelectorAll('[data-level="2"] a.t3js-modulemenu-action[href]').forEach(e=>{e.addEventListener("keyup",t)}),new u("keyup",(e,t)=>{"Space"===e.code&&e.preventDefault()}).delegateTo(e,".t3js-modulemenu-collapsible"),new u("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new u("click",(e,t)=>{e.preventDefault(),c.toggleModuleGroup(t)}).delegateTo(e,".t3js-modulemenu-collapsible")}initializeTopBarEvents(){const e=document.querySelector(".t3js-scaffold-toolbar");new u("keydown",(e,t)=>{this.keyboardNavigation(e,t)}).delegateTo(e,".t3js-modulemenu-action"),new u("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new u("click",e=>{e.preventDefault(),c.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new u("click",e=>{e.preventDefault(),c.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay"));const t=e=>{const t=e.detail.module;if(!t||this.loadedModule===t)return;const n=o.getRecordFromName(t);n.link&&(c.highlightModuleMenuItem(t),l.default("#"+t).focus(),this.loadedModule=t,n.navigationComponentId?i.NavigationContainer.showComponent(n.navigationComponentId):i.NavigationContainer.hide(!1))};document.addEventListener("typo3-module-load",t),document.addEventListener("typo3-module-loaded",t)}loadModuleComponents(e,t,n){const o=e.name,l=i.ContentContainer.beforeSetUrl(n);return l.then(()=>{e.navigationComponentId?i.NavigationContainer.showComponent(e.navigationComponentId):i.NavigationContainer.hide(!0),c.highlightModuleMenuItem(o),this.loadedModule=o,t=c.includeId(e,t),this.openInContentContainer(o,e.link,t,new r("typo3.loadModuleComponents",n))}),l}openInContentContainer(e,t,n,o){const l=t+(n?(t.includes("?")?"&":"?")+n:"");return i.ContentContainer.setUrl(l,new r("typo3.openInContentFrame",o),e)}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new c});return top.TYPO3.ModuleMenu}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","./AbstractContainer","../Event/TriggerRequest"],(function(t,e,n,i,o){"use strict";class a extends i.AbstractContainer{constructor(t){super(t),this.switcher=null,this.activeComponentId="",this.parent=document.querySelector(n.ScaffoldIdentifierEnum.scaffold),this.container=document.querySelector(n.ScaffoldIdentifierEnum.contentNavigation),this.switcher=document.querySelector(n.ScaffoldIdentifierEnum.contentNavigationSwitcher)}showComponent(e){if(this.show(e),e===this.activeComponentId)return;if(""!==this.activeComponentId){let t=this.container.querySelector("#navigationComponent-"+this.activeComponentId.replace(/[/]/g,"_"));t&&(t.style.display="none")}const n="navigationComponent-"+e.replace(/[/]/g,"_");if(1===this.container.querySelectorAll('[data-component="'+e+'"]').length)return this.show(e),void(this.activeComponentId=e);t([e],t=>{if("string"==typeof t.navigationComponentName){const i=t.navigationComponentName,o=document.createElement(i);o.setAttribute("id",n),o.classList.add("scaffold-content-navigation-component"),o.dataset.component=e,this.container.append(o)}else{this.container.insertAdjacentHTML("beforeend",'<div class="scaffold-content-navigation-component" data-component="'+e+'" id="'+n+'"></div>');Object.values(t)[0].initialize("#"+n)}this.show(e),this.activeComponentId=e})}hide(t){this.parent.classList.remove("scaffold-content-navigation-expanded"),this.parent.classList.remove("scaffold-content-navigation-available"),t&&this.switcher&&(this.switcher.style.display="none")}show(t){if(this.container.querySelectorAll(n.ScaffoldIdentifierEnum.contentNavigationDataComponent).forEach(t=>t.style.display="none"),void 0!==typeof t){this.parent.classList.add("scaffold-content-navigation-expanded"),this.parent.classList.add("scaffold-content-navigation-available");const e=this.container.querySelector('[data-component="'+t+'"]');e&&(e.style.display=null)}this.switcher&&(this.switcher.style.display=null)}setUrl(t,e){const n=this.consumerScope.invoke(new o("typo3.setUrl",e));return n.then(()=>{this.parent.classList.add("scaffold-content-navigation-expanded");const e=this.getIFrameElement();e&&e.setAttribute("src",t)}),n}getUrl(){const t=this.getIFrameElement();return t?t.getAttribute("src"):""}refresh(){const t=this.getIFrameElement();if(t)return t.contentWindow.location.reload()}getIFrameElement(){return this.container.querySelector(n.ScaffoldIdentifierEnum.contentNavigationIframe)}}return a}));
\ No newline at end of file
define(["require","exports","../Enum/Viewport/ScaffoldIdentifier","./AbstractContainer","../Event/TriggerRequest"],(function(t,e,n,i,o){"use strict";class a extends i.AbstractContainer{constructor(t){super(t),this.switcher=null,this.activeComponentId="",this.parent=document.querySelector(n.ScaffoldIdentifierEnum.scaffold),this.container=document.querySelector(n.ScaffoldIdentifierEnum.contentNavigation),this.switcher=document.querySelector(n.ScaffoldIdentifierEnum.contentNavigationSwitcher)}showComponent(e){if(this.show(e),e===this.activeComponentId)return;if(""!==this.activeComponentId){let t=this.container.querySelector("#navigationComponent-"+this.activeComponentId.replace(/[/]/g,"_"));t&&(t.style.display="none")}const n="navigationComponent-"+e.replace(/[/]/g,"_");if(1===this.container.querySelectorAll('[data-component="'+e+'"]').length)return this.show(e),void(this.activeComponentId=e);t([e],t=>{if("string"==typeof t.navigationComponentName){const i=t.navigationComponentName,o=document.createElement(i);o.setAttribute("id",n),o.classList.add("scaffold-content-navigation-component"),o.dataset.component=e,this.container.append(o)}else{this.container.insertAdjacentHTML("beforeend",'<div class="scaffold-content-navigation-component" data-component="'+e+'" id="'+n+'"></div>');Object.values(t)[0].initialize("#"+n)}this.show(e),this.activeComponentId=e})}hide(t){this.parent.classList.remove("scaffold-content-navigation-expanded"),this.parent.classList.remove("scaffold-content-navigation-available"),t&&this.switcher&&(this.switcher.style.display="none")}show(t){if(this.container.querySelectorAll(n.ScaffoldIdentifierEnum.contentNavigationDataComponent).forEach(t=>t.style.display="none"),void 0!==typeof t){this.parent.classList.add("scaffold-content-navigation-expanded"),this.parent.classList.add("scaffold-content-navigation-available");const e=this.container.querySelector('[data-component="'+t+'"]');e&&(e.style.display=null)}this.switcher&&(this.switcher.style.display=null)}setUrl(t,e){const n=this.consumerScope.invoke(new o("typo3.setUrl",e));return n.then(()=>{this.parent.classList.add("scaffold-content-navigation-expanded")}),n}}return a}));
\ No newline at end of file
......@@ -21,42 +21,3 @@ window.opener = undefined;
* common storage and global object, could later hold more information about the current user etc.
*/
var TYPO3 = TYPO3 || {};
/**
* jump the backend to a module
* @deprecated will be removed in TYPO3 v12.0.
*/
function jump(url, modName, mainModName, pageId) {
console.warn('Using jump is deprecated, use `typo3-backend-module-router` instead.');
require(['TYPO3/CMS/Backend/Storage/ModuleStateStorage'], () => {