typo3-typescript-sources 14.3.9 → 14.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/.last-synced-tag +1 -1
  2. package/README.md +1 -1
  3. package/backend/bookmark/bookmark-manager.ts +2 -1
  4. package/backend/bookmark/bookmark-store.ts +8 -12
  5. package/backend/clipboard-panel.ts +9 -3
  6. package/backend/context-menu-actions.ts +14 -12
  7. package/backend/context-menu.ts +2 -1
  8. package/backend/contextual-record-edit.ts +2 -1
  9. package/backend/date-time-picker.ts +2 -1
  10. package/backend/drag-uploader.ts +2 -1
  11. package/backend/element/contextual-record-edit-trigger.ts +7 -6
  12. package/backend/element/datetime-element.ts +2 -1
  13. package/backend/element/editable-page-title.ts +2 -1
  14. package/backend/element/pseudo-button.ts +29 -5
  15. package/backend/element/qrcode-modal-button.ts +2 -2
  16. package/backend/element/sidebar-toggle-element.ts +1 -15
  17. package/backend/element-browser.ts +4 -3
  18. package/backend/event/event-dispatcher.ts +4 -2
  19. package/backend/form-engine/element/extra/char-counter.ts +1 -1
  20. package/backend/form-engine.ts +4 -3
  21. package/backend/hotkeys.ts +2 -1
  22. package/backend/image-manipulation.ts +2 -1
  23. package/backend/info-window.ts +4 -3
  24. package/backend/layout-module/drag-drop.ts +2 -1
  25. package/backend/live-search/live-search-configurator.ts +4 -3
  26. package/backend/live-search/live-search-shortcut.ts +2 -1
  27. package/backend/live-search/live-search.ts +4 -3
  28. package/backend/live-search/result-types/default-result-type.ts +2 -1
  29. package/backend/localization/label-provider.ts +2 -1
  30. package/backend/login-refresh.ts +4 -24
  31. package/backend/login.ts +3 -2
  32. package/backend/modal.ts +9 -15
  33. package/backend/module-menu.ts +4 -3
  34. package/backend/multi-record-selection-edit-action.ts +3 -2
  35. package/backend/new-record-wizard.ts +2 -1
  36. package/backend/notification.ts +3 -19
  37. package/backend/recordlist.ts +6 -4
  38. package/backend/security/element/sudo-mode.ts +6 -7
  39. package/backend/settings/type/page.ts +3 -2
  40. package/backend/severity.ts +2 -22
  41. package/backend/storage/module-state-storage.ts +3 -1
  42. package/backend/storage/persistent.ts +15 -3
  43. package/backend/switch-user.ts +3 -2
  44. package/backend/tests/element/pseudo-button-test.ts +95 -0
  45. package/backend/tests/notification-test.ts +1 -1
  46. package/backend/tree/file-storage-browser.ts +5 -3
  47. package/backend/tree/file-storage-tree-container.ts +8 -6
  48. package/backend/tree/page-browser.ts +2 -1
  49. package/backend/tree/page-position-select.ts +2 -1
  50. package/backend/tree/page-tree-element.ts +5 -4
  51. package/backend/tree/tree.ts +2 -1
  52. package/backend/user-settings-manager.ts +2 -1
  53. package/backend/utility/drag-drop-utility.ts +2 -1
  54. package/backend/utility/top-level-module-import.ts +3 -1
  55. package/backend/viewport/content-container.ts +2 -1
  56. package/backend/viewport/content-navigation-toggle.ts +3 -10
  57. package/backend/viewport.ts +5 -4
  58. package/backend/window-manager.ts +5 -4
  59. package/backend/wizard/finisher/noop-finisher.ts +3 -2
  60. package/backend/wizard/finisher/redirect-finisher.ts +4 -3
  61. package/backend/wizard/finisher/reload-finisher.ts +3 -2
  62. package/backend/wizard/move-page.ts +2 -1
  63. package/core/java-script-item-processor.ts +3 -1
  64. package/core/lit-helper.ts +5 -2
  65. package/core/tests/utility/top-window-test.ts +121 -0
  66. package/core/utility/top-window.ts +99 -0
  67. package/dashboard/dashboard.ts +2 -1
  68. package/extensionmanager/dependency-check.ts +2 -1
  69. package/extensionmanager/extension-toggle-button.ts +2 -1
  70. package/extensionmanager/repository.ts +2 -1
  71. package/filelist/context-menu-actions.ts +20 -19
  72. package/filelist/file-delete.ts +4 -3
  73. package/filelist/file-list-dragdrop.ts +3 -2
  74. package/filelist/file-list-rename-handler.ts +2 -1
  75. package/filelist/file-list-replace-handler.ts +2 -1
  76. package/filelist/file-list-transfer-handler.ts +5 -4
  77. package/filelist/file-list.ts +7 -6
  78. package/impexp/context-menu-actions.ts +5 -3
  79. package/install/installer.ts +2 -1
  80. package/install/module/abstract-interactable-module.ts +2 -2
  81. package/install/module/maintenance/language-packs.ts +2 -1
  82. package/install/module/settings/extension-configuration.ts +3 -4
  83. package/install/renderable/flash-message.ts +2 -2
  84. package/install/renderable/info-box.ts +2 -2
  85. package/opendocs/open-document-store.ts +5 -4
  86. package/package.json +2 -2
  87. package/recycler/recycler.ts +2 -1
  88. package/redirects/event-handler.ts +2 -1
  89. package/scheduler/scheduler-add-group.ts +2 -1
  90. package/workspaces/backend.ts +8 -6
  91. package/workspaces/preview.ts +3 -2
  92. package/workspaces/workspace-state.ts +5 -4
@@ -26,6 +26,7 @@ import { isContentTypeAllowedInColumn } from '@typo3/backend/layout-module/colum
26
26
  import type ResponseInterface from '../ajax-data-handler/response-interface';
27
27
  import type { DragDropThumbnail, DragTooltipMetadata } from '@typo3/backend/drag-tooltip';
28
28
  import DragDropUtility from '@typo3/backend/utility/drag-drop-utility';
29
+ import { topDocument } from '@typo3/core/utility/top-window';
29
30
 
30
31
  interface Parameters {
31
32
  cmd?: { [key: string]: { [key: string]: any } };
@@ -108,7 +109,7 @@ class DragDrop {
108
109
 
109
110
  new RegularEvent('drop', this.onDrop.bind(this), { capture: true, passive: true }).delegateTo(document, Identifiers.dropZone);
110
111
 
111
- new RegularEvent('typo3:page-layout-drag-drop:elementChanged', this.onBroadcastElementChanged.bind(this)).bindTo(top.document);
112
+ new RegularEvent('typo3:page-layout-drag-drop:elementChanged', this.onBroadcastElementChanged.bind(this)).bindTo(topDocument);
112
113
  }
113
114
 
114
115
  protected onDragEnter(event: DragEvent): void {
@@ -13,6 +13,7 @@
13
13
 
14
14
  import type { ResultItemActionInterface, ResultItemInterface } from '@typo3/backend/live-search/element/result/item/item';
15
15
  import type { TemplateResult } from 'lit';
16
+ import { topWindow } from '@typo3/core/utility/top-window';
16
17
 
17
18
  type RendererCallback = (resultItem: ResultItemInterface) => TemplateResult;
18
19
  type InvokeCallback = (resultItem: ResultItemInterface, action: ResultItemActionInterface) => void;
@@ -43,11 +44,11 @@ class LiveSearchConfigurator {
43
44
  }
44
45
 
45
46
  let configuratorObject: LiveSearchConfigurator;
46
- if (!top.TYPO3.LiveSearchConfigurator) {
47
+ if (!topWindow.TYPO3.LiveSearchConfigurator) {
47
48
  configuratorObject = new LiveSearchConfigurator();
48
- top.TYPO3.LiveSearchConfigurator = configuratorObject;
49
+ topWindow.TYPO3.LiveSearchConfigurator = configuratorObject;
49
50
  } else {
50
- configuratorObject = top.TYPO3.LiveSearchConfigurator;
51
+ configuratorObject = topWindow.TYPO3.LiveSearchConfigurator;
51
52
  }
52
53
 
53
54
  export default configuratorObject;
@@ -1,5 +1,6 @@
1
1
  import Hotkeys from '@typo3/backend/hotkeys';
2
2
  import DocumentService from '@typo3/core/document-service';
3
+ import { topDocument } from '@typo3/core/utility/top-window';
3
4
 
4
5
  class LiveSearchShortcut {
5
6
  public constructor() {
@@ -7,7 +8,7 @@ class LiveSearchShortcut {
7
8
  Hotkeys.register([Hotkeys.normalizedCtrlModifierKey, 'k'], (e: KeyboardEvent): void => {
8
9
  e.preventDefault();
9
10
 
10
- top.document.dispatchEvent(new CustomEvent('typo3:live-search:trigger-open'));
11
+ topDocument.dispatchEvent(new CustomEvent('typo3:live-search:trigger-open'));
11
12
  }, { allowOnEditables: true /* @todo: bindElement cannot be used at the moment as the suitable element exists twice! */ });
12
13
  });
13
14
  }
@@ -26,6 +26,7 @@ import BrowserSession from '@typo3/backend/storage/browser-session';
26
26
  import { componentName as resultContainerComponentName, type ResultContainer } from '@typo3/backend/live-search/element/result/result-container';
27
27
  import { ModuleStateStorage } from '@typo3/backend/storage/module-state-storage';
28
28
  import type { ResultItemInterface } from '@typo3/backend/live-search/element/result/item/item';
29
+ import { topWindow } from '@typo3/core/utility/top-window';
29
30
  import type { Pagination, ResultPagination } from '@typo3/backend/live-search/element/result/result-pagination';
30
31
  import coreLabels from '~labels/core.core';
31
32
 
@@ -266,11 +267,11 @@ class LiveSearch {
266
267
  }
267
268
 
268
269
  let liveSearchObject: LiveSearch;
269
- if (!top.TYPO3.LiveSearch) {
270
+ if (!topWindow.TYPO3.LiveSearch) {
270
271
  liveSearchObject = new LiveSearch();
271
- top.TYPO3.LiveSearch = liveSearchObject;
272
+ topWindow.TYPO3.LiveSearch = liveSearchObject;
272
273
  } else {
273
- liveSearchObject = top.TYPO3.LiveSearch;
274
+ liveSearchObject = topWindow.TYPO3.LiveSearch;
274
275
  }
275
276
 
276
277
  export default liveSearchObject;
@@ -5,6 +5,7 @@ import Notification from '@typo3/backend/notification';
5
5
  import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
6
6
  import type { ResultItemActionInterface, ResultItemInterface } from '@typo3/backend/live-search/element/result/item/item';
7
7
  import windowManager from '@typo3/backend/window-manager';
8
+ import { topWindow } from '@typo3/core/utility/top-window';
8
9
 
9
10
  export function registerType(type: string) {
10
11
  LiveSearchConfigurator.addInvokeHandler(type, 'switch_backend_user', (resultItem: ResultItemInterface): void => {
@@ -13,7 +14,7 @@ export function registerType(type: string) {
13
14
  }).then(async (response: AjaxResponse): Promise<void> => {
14
15
  const data = await response.resolve();
15
16
  if (data.success === true && data.url) {
16
- top.window.location.href = data.url;
17
+ topWindow.location.href = data.url;
17
18
  } else {
18
19
  Notification.error('Switching to user went wrong.');
19
20
  }
@@ -14,6 +14,7 @@
14
14
  import { IntlMessageFormat, type PrimitiveType, type FormatXMLElementFn, type Formatters } from 'intl-messageformat';
15
15
  import type { DateConfiguration } from '@typo3/backend/type/date-configuration';
16
16
  import { DateTime } from 'luxon';
17
+ import { openerTopWindow, topWindow } from '@typo3/core/utility/top-window';
17
18
 
18
19
  type ChunkCallback = (chunks: unknown[]) => unknown;
19
20
  type NamedParameters = Record<string, PrimitiveType | ChunkCallback>;
@@ -170,7 +171,7 @@ function memoize<F extends Factory>(context: string, factory: F): F {
170
171
 
171
172
  function getConfiguredDateFormats(): DateConfiguration | null {
172
173
  try {
173
- const root = (typeof opener?.top?.TYPO3 !== 'undefined' ? opener.top : top);
174
+ const root = openerTopWindow() ?? topWindow;
174
175
  return root.TYPO3.settings.DateConfiguration;
175
176
  } catch {
176
177
  return null;
@@ -19,6 +19,7 @@ import AjaxRequest from '@typo3/core/ajax/ajax-request';
19
19
  import Notification from '@typo3/backend/notification';
20
20
  import '@typo3/backend/element/progress-bar-element';
21
21
  import coreLabels from '~labels/core.core';
22
+ import { openerTopWindow, topWindow } from '@typo3/core/utility/top-window';
22
23
 
23
24
  enum MarkupIdentifiers {
24
25
  loginrefresh = 't3js-modal-loginrefresh',
@@ -222,7 +223,7 @@ class LoginRefresh {
222
223
  active: false,
223
224
  btnClass: 'btn-default',
224
225
  name: 'logout',
225
- trigger: () => top.location.href = this.logoutUrl
226
+ trigger: () => topWindow.location.href = this.logoutUrl
226
227
  },
227
228
  {
228
229
  text: coreLabels.get('mess.refresh_login_refresh_button'),
@@ -277,7 +278,7 @@ class LoginRefresh {
277
278
  active: false,
278
279
  btnClass: 'btn-default',
279
280
  name: 'logout',
280
- trigger: () => top.location.href = this.logoutUrl
281
+ trigger: () => topWindow.location.href = this.logoutUrl
281
282
  },
282
283
  {
283
284
  text: coreLabels.get('mess.refresh_login_button'),
@@ -477,28 +478,7 @@ export class SelfFillingProgressBarElement extends LitElement {
477
478
  };
478
479
  }
479
480
 
480
- let loginRefreshObject;
481
- try {
482
- // fetch from opening window
483
- if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.LoginRefresh) {
484
- loginRefreshObject = window.opener.TYPO3.LoginRefresh;
485
- }
486
-
487
- // fetch from parent
488
- if (parent && parent.window.TYPO3 && parent.window.TYPO3.LoginRefresh) {
489
- loginRefreshObject = parent.window.TYPO3.LoginRefresh;
490
- }
491
-
492
- // fetch object from outer frame
493
- if (top && top.TYPO3 && top.TYPO3.LoginRefresh) {
494
- loginRefreshObject = top.TYPO3.LoginRefresh;
495
- }
496
- } catch {
497
- // This only happens if the opener, parent or top is some other url (eg a local file)
498
- // which loaded the current window. Then the browser's cross domain policy jumps in
499
- // and raises an exception.
500
- // For this case we are safe and we can create our global object below.
501
- }
481
+ let loginRefreshObject: LoginRefresh = topWindow.TYPO3?.LoginRefresh ?? openerTopWindow()?.TYPO3?.LoginRefresh;
502
482
 
503
483
  if (!loginRefreshObject) {
504
484
  loginRefreshObject = new LoginRefresh();
package/backend/login.ts CHANGED
@@ -18,6 +18,7 @@ import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
18
18
  import RegularEvent from '@typo3/core/event/regular-event';
19
19
  import PastedPasswordChecker from '@typo3/backend/login/pasted-password-checker';
20
20
  import DocumentService from '@typo3/core/document-service';
21
+ import { topWindow } from '@typo3/core/utility/top-window';
21
22
 
22
23
  interface PreflightResponse {
23
24
  capabilities: PreflightResponseCapabilities;
@@ -61,9 +62,9 @@ class BackendLogin {
61
62
  this.initializeEvents();
62
63
 
63
64
  // prevent opening the login form in the backend frameset
64
- if (top.location.href !== location.href) {
65
+ if (topWindow.location.href !== location.href) {
65
66
  this.ready = false;
66
- top.location.href = location.href;
67
+ topWindow.location.href = location.href;
67
68
  }
68
69
  if (this.ready) {
69
70
  document.body.setAttribute('data-typo3-login-ready', 'true');
package/backend/modal.ts CHANGED
@@ -19,6 +19,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
19
19
  import { styleMap, type StyleInfo } from 'lit/directives/style-map.js';
20
20
  import { classesArrayToClassInfo } from '@typo3/core/lit-helper';
21
21
  import RegularEvent from '@typo3/core/event/regular-event';
22
+ import { topWindow } from '@typo3/core/utility/top-window';
22
23
  import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
23
24
  import type { AbstractAction } from './action-button/abstract-action';
24
25
  import type { ModalResponseEvent } from '@typo3/backend/modal-interface';
@@ -1010,23 +1011,16 @@ const remountAlertContainer = (modal: ModalElement | undefined) => {
1010
1011
  };
1011
1012
 
1012
1013
  let modalObject: Modal = null;
1013
- try {
1014
- if (parent && parent.window.TYPO3 && parent.window.TYPO3.Modal) {
1015
- // fetch from parent
1014
+ const topModal = topWindow.TYPO3?.Modal;
1015
+ if (topModal) {
1016
+ try {
1016
1017
  // we need to trigger the event capturing again, in order to make sure this works inside iframes
1017
- parent.window.TYPO3.Modal.initializeMarkupTrigger(document);
1018
- modalObject = parent.window.TYPO3.Modal;
1019
- } else if (top && top.TYPO3.Modal) {
1020
- // fetch object from outer frame
1021
- // we need to trigger the event capturing again, in order to make sure this works inside iframes
1022
- top.TYPO3.Modal.initializeMarkupTrigger(document);
1023
- modalObject = top.TYPO3.Modal;
1018
+ topModal.initializeMarkupTrigger(document);
1019
+ modalObject = topModal;
1020
+ } catch {
1021
+ // initializeMarkupTrigger runs in another window. A failure there must not
1022
+ // take this module down, so this window falls back to its own Modal.
1024
1023
  }
1025
- } catch {
1026
- // This only happens if the opener, parent or top is some other url (eg a local file)
1027
- // which loaded the current window. Then the browser's cross domain policy jumps in
1028
- // and raises an exception.
1029
- // For this case we are safe and we can create our global object below.
1030
1024
  }
1031
1025
 
1032
1026
  if (!modalObject) {
@@ -25,6 +25,7 @@ import { selector } from '@typo3/core/literals';
25
25
  import DocumentService from '@typo3/core/document-service';
26
26
  import { Collapse } from 'bootstrap';
27
27
  import { KeyTypesEnum } from '@typo3/backend/enum/key-types';
28
+ import { topWindow } from '@typo3/core/utility/top-window';
28
29
 
29
30
  enum ModuleMenuSelector {
30
31
  menu = '[data-modulemenu]',
@@ -465,14 +466,14 @@ interface ModuleMenuNamespace {
465
466
  App: ModuleMenu;
466
467
  }
467
468
 
468
- let moduleMenuApp: ModuleMenuNamespace = top?.TYPO3?.ModuleMenu;
469
+ let moduleMenuApp: ModuleMenuNamespace = topWindow.TYPO3?.ModuleMenu;
469
470
 
470
471
  if (!moduleMenuApp) {
471
472
  moduleMenuApp = {
472
473
  App: new ModuleMenu(),
473
474
  };
474
- if (top.TYPO3 !== undefined) {
475
- top.TYPO3.ModuleMenu = moduleMenuApp;
475
+ if (topWindow.TYPO3 !== undefined) {
476
+ topWindow.TYPO3.ModuleMenu = moduleMenuApp;
476
477
  }
477
478
  }
478
479
 
@@ -17,6 +17,7 @@ import {
17
17
  type ActionEventDetails,
18
18
  MultiRecordSelectionAction
19
19
  } from '@typo3/backend/multi-record-selection-action';
20
+ import { topWindow } from '@typo3/core/utility/top-window';
20
21
 
21
22
  interface EditActionConfiguration extends ActionConfiguration {
22
23
  tableName: string;
@@ -47,9 +48,9 @@ class MultiRecordSelectionEditAction {
47
48
  return;
48
49
  }
49
50
 
50
- window.location.href = top.TYPO3.settings.FormEngine.moduleUrl
51
+ window.location.href = topWindow.TYPO3.settings.FormEngine.moduleUrl
51
52
  + '&edit[' + tableName + '][' + entityIdentifiers.join(',') + ']=edit'
52
- + '&module=' + encodeURIComponent(top.TYPO3.ModuleMenu.App.getCurrentModule())
53
+ + '&module=' + encodeURIComponent(topWindow.TYPO3.ModuleMenu.App.getCurrentModule())
53
54
  + '&returnUrl=' + encodeURIComponent(configuration.returnUrl || '');
54
55
  }
55
56
  }
@@ -23,6 +23,7 @@ import RegularEvent from '@typo3/core/event/regular-event';
23
23
  import { KeyTypesEnum } from '@typo3/backend/enum/key-types';
24
24
  import { RecordUsageStore } from '@typo3/backend/record-usage/record-usage-store';
25
25
  import ClientStorage from '@typo3/backend/storage/client';
26
+ import { topWindow } from '@typo3/core/utility/top-window';
26
27
  import PersistentStorage from '@typo3/backend/storage/persistent';
27
28
  import miscLabels from '~labels/core.misc';
28
29
 
@@ -722,7 +723,7 @@ export class NewRecordWizard extends LitElement {
722
723
  }
723
724
 
724
725
  if (item.requestType === 'location') {
725
- Viewport.ContentContainer.setUrl(item.url.replace(/_CURRENT_MODULE_/g, top.TYPO3.ModuleMenu.App.getCurrentModule()));
726
+ Viewport.ContentContainer.setUrl(item.url.replace(/_CURRENT_MODULE_/g, topWindow.TYPO3.ModuleMenu.App.getCurrentModule()));
726
727
  Modal.dismiss();
727
728
  return;
728
729
  }
@@ -18,6 +18,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
18
18
  import type { AbstractAction } from './action-button/abstract-action';
19
19
  import { SeverityEnum } from './enum/severity';
20
20
  import Severity from './severity';
21
+ import { topWindow } from '@typo3/core/utility/top-window';
21
22
  import coreLabels from '~labels/core.core';
22
23
  import '@typo3/backend/element/icon-element';
23
24
 
@@ -124,7 +125,7 @@ class Notification {
124
125
  this.notificationList.setAttribute('class', 'alert-list');
125
126
  // Enable focusing for keyboard scrolling (accessibility)
126
127
  this.notificationList.setAttribute('tabindex', '0');
127
- this.notificationList.setAttribute('aria-live', 'polite');
128
+ this.notificationList.setAttribute('role', 'alert');
128
129
  this.messageContainer.appendChild(this.notificationList);
129
130
 
130
131
  this.clearAllButton = <ClearNotificationMessages>document.createElement('typo3-notification-clear-all');
@@ -420,24 +421,7 @@ declare global {
420
421
  }
421
422
  }
422
423
 
423
- let notificationObject: typeof Notification;
424
-
425
- try {
426
- // fetch from parent
427
- if (parent && parent.window.TYPO3 && parent.window.TYPO3.Notification) {
428
- notificationObject = parent.window.TYPO3.Notification;
429
- }
430
-
431
- // fetch object from outer frame
432
- if (top && top.TYPO3.Notification) {
433
- notificationObject = top.TYPO3.Notification;
434
- }
435
- } catch {
436
- // This only happens if the opener, parent or top is some other url (eg a local file)
437
- // which loaded the current window. Then the browser's cross domain policy jumps in
438
- // and raises an exception.
439
- // For this case we are safe and we can create our global object below.
440
- }
424
+ let notificationObject: typeof Notification = topWindow.TYPO3?.Notification;
441
425
 
442
426
  if (!notificationObject) {
443
427
  notificationObject = Notification;
@@ -22,6 +22,7 @@ import Notification from '@typo3/backend/notification';
22
22
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
23
23
  import { AjaxResponse } from '@typo3/core/ajax/ajax-response';
24
24
  import { sudoModeInterceptor } from '@typo3/backend/security/sudo-mode-interceptor';
25
+ import { topWindow, topDocument } from '@typo3/core/utility/top-window';
25
26
 
26
27
  interface IconIdentifier {
27
28
  collapse: string;
@@ -95,7 +96,8 @@ class Recordlist {
95
96
 
96
97
  private static getReturnUrl(returnUrl: string): string {
97
98
  if (returnUrl === '') {
98
- returnUrl = top.list_frame.document.location.pathname + top.list_frame.document.location.search;
99
+ const location = topWindow.list_frame.document.location;
100
+ returnUrl = location.pathname + location.search;
99
101
  }
100
102
  return encodeURIComponent(returnUrl);
101
103
  }
@@ -195,9 +197,9 @@ class Recordlist {
195
197
  return;
196
198
  }
197
199
 
198
- let editUrl: string = top.TYPO3.settings.FormEngine.moduleUrl
200
+ let editUrl: string = topWindow.TYPO3.settings.FormEngine.moduleUrl
199
201
  + '&edit[' + tableName + '][' + entityIdentifiers.join(',') + ']=edit'
200
- + '&module=' + encodeURIComponent(top.TYPO3.ModuleMenu.App.getCurrentModule())
202
+ + '&module=' + encodeURIComponent(topWindow.TYPO3.ModuleMenu.App.getCurrentModule())
201
203
  + '&returnUrl=' + Recordlist.getReturnUrl(returnUrl);
202
204
 
203
205
  if (columnsOnly.length > 0) {
@@ -258,7 +260,7 @@ class Recordlist {
258
260
  rowElement.classList.add('record-pulse');
259
261
 
260
262
  if (table === 'pages') {
261
- top.document.dispatchEvent(new CustomEvent('typo3:pagetree:refresh'));
263
+ topDocument.dispatchEvent(new CustomEvent('typo3:pagetree:refresh'));
262
264
  }
263
265
  }).catch(async(response: AjaxResponse): Promise<void> => {
264
266
  target.querySelector('.t3js-icon').replaceWith(originalIconElement);
@@ -17,6 +17,7 @@ import AjaxRequest from '@typo3/core/ajax/ajax-request';
17
17
  import { AjaxResponse } from '@typo3/core/ajax/ajax-response';
18
18
  import Viewport from '@typo3/backend/viewport';
19
19
  import { topLevelModuleImport } from '@typo3/backend/utility/top-level-module-import';
20
+ import { topWindow, topDocument } from '@typo3/core/utility/top-window';
20
21
  import Modal, { Sizes } from '@typo3/backend/modal';
21
22
  import { SeverityEnum } from '@typo3/backend/enum/severity';
22
23
  import type { ReactiveElement } from '@lit/reactive-element';
@@ -55,15 +56,14 @@ abstract class SudoModeProperties extends LitElement {
55
56
  }
56
57
 
57
58
  export const initiateSudoModeModal = async (properties: Omit<SudoModeProperties, keyof LitElement>): Promise<void> => {
58
- const isInIframe = window.location !== window.parent.location;
59
- if (isInIframe) {
59
+ if (topWindow !== window) {
60
60
  // Create a top-level instance
61
61
  topLevelModuleImport('@typo3/backend/security/element/sudo-mode.js');
62
62
  }
63
- const el = top.document.createElement('typo3-backend-security-sudo-mode');
63
+ const el = topDocument.createElement('typo3-backend-security-sudo-mode');
64
64
  Object.assign(el, properties);
65
65
  el.windowRef = window;
66
- top.document.body.append(el);
66
+ topDocument.body.append(el);
67
67
  return new Promise<void>((resolve, reject) => {
68
68
  el.addEventListener('typo3:sudo-mode:verified', () => resolve());
69
69
  el.addEventListener('typo3:sudo-mode:finished', () => reject());
@@ -84,9 +84,8 @@ export class SudoMode extends SudoModeProperties {
84
84
  }
85
85
 
86
86
  protected override async firstUpdated() {
87
- const isInIframe = window.location !== window.parent.location;
88
87
  // Launched from /sudo-mode/module route
89
- if (isInIframe) {
88
+ if (topWindow !== window) {
90
89
  try {
91
90
  await initiateSudoModeModal(this.getPropertyValues());
92
91
  } catch {
@@ -106,7 +105,7 @@ export class SudoMode extends SudoModeProperties {
106
105
  text: this.labels.cancel,
107
106
  btnClass: 'btn-default',
108
107
  trigger: () => {
109
- top.location.href = this.cancelUri;
108
+ topWindow.location.href = this.cancelUri;
110
109
  },
111
110
  } : {
112
111
  text: this.labels.verify,
@@ -18,6 +18,7 @@ import { BaseElement } from './base';
18
18
  import { default as Modal } from '@typo3/backend/modal';
19
19
  import labels from '~labels/backend.settingseditor';
20
20
  import '@typo3/backend/element/icon-element';
21
+ import { topWindow } from '@typo3/core/utility/top-window';
21
22
 
22
23
  export const componentName = 'typo3-backend-settings-type-page';
23
24
 
@@ -56,7 +57,7 @@ export class PageTypeElement extends BaseElement<number> {
56
57
  }
57
58
 
58
59
  private canUseElementBrowser(): boolean {
59
- return top.TYPO3.settings?.Wizards?.elementBrowserUrl !== undefined;
60
+ return topWindow.TYPO3.settings?.Wizards?.elementBrowserUrl !== undefined;
60
61
  }
61
62
 
62
63
  private openElementBrowser() {
@@ -69,7 +70,7 @@ export class PageTypeElement extends BaseElement<number> {
69
70
 
70
71
  const modal = Modal.advanced({
71
72
  type: Modal.types.iframe,
72
- content: top.TYPO3.settings.Wizards.elementBrowserUrl + '&' + queryParams.toString(),
73
+ content: topWindow.TYPO3.settings.Wizards.elementBrowserUrl + '&' + queryParams.toString(),
73
74
  size: Modal.sizes.large,
74
75
  });
75
76
  window.addEventListener('message', this.elementBrowserListener);
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  import { SeverityEnum } from './enum/severity';
15
+ import { openerTopWindow, topWindow } from '@typo3/core/utility/top-window';
15
16
 
16
17
  /**
17
18
  * Module: @typo3/backend/severity
@@ -55,28 +56,7 @@ export default class Severity {
55
56
  }
56
57
  }
57
58
 
58
- let severityObject: Severity;
59
- try {
60
- // fetch from opening window
61
- if (window.opener && window.opener.TYPO3 && window.opener.TYPO3.Severity) {
62
- severityObject = window.opener.TYPO3.Severity;
63
- }
64
-
65
- // fetch from parent
66
- if (parent && parent.window.TYPO3 && parent.window.TYPO3.Severity) {
67
- severityObject = parent.window.TYPO3.Severity;
68
- }
69
-
70
- // fetch object from outer frame
71
- if (top && top.TYPO3 && top.TYPO3.Severity) {
72
- severityObject = top.TYPO3.Severity;
73
- }
74
- } catch {
75
- // This only happens if the opener, parent or top is some other url (eg a local file)
76
- // which loaded the current window. Then the browser's cross domain policy jumps in
77
- // and raises an exception.
78
- // For this case we are safe and we can create our global object below.
79
- }
59
+ let severityObject: Severity = topWindow.TYPO3?.Severity ?? openerTopWindow()?.TYPO3?.Severity;
80
60
 
81
61
  if (!severityObject) {
82
62
  severityObject = Severity;
@@ -11,6 +11,8 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
+ import { topDocument } from '@typo3/core/utility/top-window';
15
+
14
16
  interface CurrentState {
15
17
  identifier: string;
16
18
  treeIdentifier: string|null;
@@ -105,7 +107,7 @@ export class ModuleStateStorage {
105
107
  const oldState = ModuleStateStorage.current(module);
106
108
  sessionStorage.setItem(ModuleStateStorage.prefix + module, JSON.stringify(state));
107
109
 
108
- top.document.dispatchEvent(new CustomEvent<ModuleStateUpdateEvent>('typo3:module-state-storage:' + mode + ':' + module, {
110
+ topDocument.dispatchEvent(new CustomEvent<ModuleStateUpdateEvent>('typo3:module-state-storage:' + mode + ':' + module, {
109
111
  detail: {
110
112
  state,
111
113
  oldState,
@@ -13,6 +13,7 @@
13
13
 
14
14
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
15
15
  import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
16
+ import { topWindow } from '@typo3/core/utility/top-window';
16
17
 
17
18
  export type UC = { [key: string]: string | number | boolean | null | UC };
18
19
 
@@ -22,7 +23,7 @@ export type UC = { [key: string]: string | number | boolean | null | UC };
22
23
  * @exports @typo3/backend/storage/persistent
23
24
  */
24
25
  class Persistent {
25
- private data: UC|null = null;
26
+ private data: UC|null = topWindow.TYPO3?.settings?.Persistent?.uc ?? null;
26
27
 
27
28
  /**
28
29
  * Persistent storage, stores everything on the server via AJAX, does a greedy load on read
@@ -111,7 +112,7 @@ class Persistent {
111
112
  }
112
113
 
113
114
  /**
114
- * Loads the data from outside, only used for the initial call from BackendController
115
+ * Replaces the data with what a caller received from elsewhere
115
116
  *
116
117
  * @param {UC} data
117
118
  */
@@ -201,4 +202,15 @@ class Persistent {
201
202
  }
202
203
  }
203
204
 
204
- export default new Persistent();
205
+ let persistentObject: Persistent = topWindow.TYPO3?.Persistent;
206
+
207
+ if (!persistentObject) {
208
+ persistentObject = new Persistent();
209
+
210
+ // attach to global frame
211
+ if (typeof TYPO3 !== 'undefined') {
212
+ TYPO3.Persistent = persistentObject;
213
+ }
214
+ }
215
+
216
+ export default persistentObject;
@@ -16,6 +16,7 @@ import { customElement, property } from 'lit/decorators.js';
16
16
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
17
17
  import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
18
18
  import Notification from '@typo3/backend/notification';
19
+ import { topWindow } from '@typo3/core/utility/top-window';
19
20
 
20
21
  enum Modes {
21
22
  switch = 'switch',
@@ -56,7 +57,7 @@ export class SwitchUser extends PseudoButtonLitElement {
56
57
  }).then(async (response: AjaxResponse): Promise<void> => {
57
58
  const data = await response.resolve();
58
59
  if (data.success === true && data.url) {
59
- top.window.location.href = data.url;
60
+ topWindow.location.href = data.url;
60
61
  } else {
61
62
  Notification.error('Switching to user went wrong.');
62
63
  }
@@ -67,7 +68,7 @@ export class SwitchUser extends PseudoButtonLitElement {
67
68
  (new AjaxRequest(TYPO3.settings.ajaxUrls.switch_user_exit)).post({}).then(async (response: AjaxResponse): Promise<void> => {
68
69
  const data = await response.resolve();
69
70
  if (data.success === true && data.url) {
70
- top.window.location.href = data.url;
71
+ topWindow.location.href = data.url;
71
72
  } else {
72
73
  Notification.error('Exiting current user went wrong.');
73
74
  }