diff --git a/core/modules/navigation/js/escapeAdmin.js b/core/modules/navigation/js/escapeAdmin.js deleted file mode 100644 index 5fa2b89e6c62c949113a596631f386e871439bc4..0000000000000000000000000000000000000000 --- a/core/modules/navigation/js/escapeAdmin.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @file - * Replaces the home link in toolbar with a back to site link. - */ - -((Drupal, drupalSettings, once) => { - /** - * Information about the current page path. - * - * @type {object} - */ - const pathInfo = drupalSettings.path; - - /** - * The last non-administrative page visited in the current browser tab. - * - * @type {string} - */ - const escapeAdminPath = sessionStorage.getItem('escapeAdminPath'); - - /** - * The window object representing the current browser tab. - * - * @type {Window} - */ - const windowLocation = window.location; - - // Saves the last non-administrative page in the browser to be able to link - // back to it when browsing administrative pages. If there is a destination - // parameter there is not need to save the current path because the page is - // loaded within an existing "workflow". - if ( - !pathInfo.currentPathIsAdmin && - !/destination=/.test(windowLocation.search) - ) { - sessionStorage.setItem('escapeAdminPath', windowLocation); - } - - /** - * Replaces "Back to site" link url when appropriate. - * - * Back to site link points to the last non-administrative page the user - * visited within the same browser tab. - * - * @type {Drupal~behavior} - * - * @prop {Drupal~behaviorAttach} attach - * Attaches the replacement functionality to the toolbar-escape-admin element. - */ - Drupal.behaviors.escapeAdmin = { - attach() { - /** - * Element with the data-toolbar-escape-admin attribute. - * - * @type {HTMLElement} - */ - const toolbarEscape = once('escapeAdmin', '[data-toolbar-escape-admin]'); - if ( - toolbarEscape.length && - pathInfo.currentPathIsAdmin && - escapeAdminPath !== null - ) { - toolbarEscape[0].setAttribute('href', escapeAdminPath); - } - }, - }; -})(Drupal, drupalSettings, once); diff --git a/core/modules/navigation/navigation.libraries.yml b/core/modules/navigation/navigation.libraries.yml index c20ab9e71bfd3e89c2f920852245998defc377fe..7c0b513199f59f7c673a12ba63395cefdbb38001 100644 --- a/core/modules/navigation/navigation.libraries.yml +++ b/core/modules/navigation/navigation.libraries.yml @@ -33,22 +33,9 @@ admin-reset-styles: base: css/base/admin-reset-styles.css: {} -internal.navigation.escapeAdmin: - # Internal library. Do not depend on it outside core nor add core usage - # beyond the Navigation module. - version: VERSION - js: - js/escapeAdmin.js: {} - dependencies: - - core/drupal - - core/drupalSettings - - core/once - - core/drupal.displace - navigation.layout: dependencies: - navigation/internal.navigation - - navigation/internal.navigation.escapeAdmin body-scroll-lock: version: VERSION