Loading core/modules/navigation/js/escapeAdmin.jsdeleted 100644 → 0 +0 −67 Original line number Diff line number Diff line /** * @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); core/modules/navigation/navigation.libraries.yml +0 −13 Original line number Diff line number Diff line Loading @@ -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 Loading Loading
core/modules/navigation/js/escapeAdmin.jsdeleted 100644 → 0 +0 −67 Original line number Diff line number Diff line /** * @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);
core/modules/navigation/navigation.libraries.yml +0 −13 Original line number Diff line number Diff line Loading @@ -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 Loading