MDL-70197 navigation: Remove old navigation elements and migrate behat

This commit is contained in:
Mathew May
2021-11-29 15:47:42 +08:00
parent 18b2af60f5
commit b983003e2e
150 changed files with 944 additions and 445 deletions
+7 -3
View File
@@ -38,7 +38,7 @@ let addBlockModal = null;
* @method registerListenerEvents
* @param {String} pageType The type of the page
* @param {String} pageLayout The layout of the page
* @param {String} addBlockUrl The add block URL
* @param {String|null} addBlockUrl The add block URL
*/
const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
document.addEventListener('click', e => {
@@ -46,6 +46,10 @@ const registerListenerEvents = (pageType, pageLayout, addBlockUrl) => {
if (e.target.closest(SELECTORS.ADD_BLOCK)) {
e.preventDefault();
if (addBlockUrl === null) {
addBlockUrl = e.target.closest(SELECTORS.ADD_BLOCK).dataset.url;
}
if (addBlockModal) { // The 'add block' modal has been already created.
// Display the 'add block' modal.
addBlockModal.show();
@@ -128,8 +132,8 @@ const getAddableBlocks = async(pageType, pageLayout) => {
* @method init
* @param {String} pageType The type of the page
* @param {String} pageLayout The layout of the page
* @param {String} addBlockUrl The add block URL
* @param {String|null} addBlockUrl The add block URL
*/
export const init = (pageType, pageLayout, addBlockUrl) => {
export const init = (pageType, pageLayout, addBlockUrl = null) => {
registerListenerEvents(pageType, pageLayout, addBlockUrl);
};