From 3fc9287e0ba672bd5f1463de042de041488b37c5 Mon Sep 17 00:00:00 2001 From: Sergio Eduardo Castro Ceballos <72516762+SergioCasCeb@users.noreply.github.com> Date: Sat, 14 Oct 2023 00:46:32 +0200 Subject: [PATCH] Minor fixes with the new close tab prompts --- packages/web-new/src/scripts/editor.js | 2 +- packages/web-new/src/scripts/examples-menu.js | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/web-new/src/scripts/editor.js b/packages/web-new/src/scripts/editor.js index bee7053bf..a19be3e40 100644 --- a/packages/web-new/src/scripts/editor.js +++ b/packages/web-new/src/scripts/editor.js @@ -41,7 +41,7 @@ import { clearConsole } from './console' const addTab = document.querySelector(".ide__tabs__add") const tabsLeftContainer = document.querySelector(".ide__tabs__left") const ideContainer = document.querySelector(".ide__container") -let tabsLeft = document.querySelectorAll(".ide__tabs__left li:not(:last-child)") +export let tabsLeft = document.querySelectorAll(".ide__tabs__left li:not(:last-child)") //Editor list array where all the generated editor will be added and referenced from export let editorList = [] diff --git a/packages/web-new/src/scripts/examples-menu.js b/packages/web-new/src/scripts/examples-menu.js index acfd80e7c..c05cbcf81 100644 --- a/packages/web-new/src/scripts/examples-menu.js +++ b/packages/web-new/src/scripts/examples-menu.js @@ -21,7 +21,7 @@ * In the future the option to see short snipets of the most important part of the example, might also be implemented. */ -import { createIde, ideCount } from "./editor" +import { createIde, ideCount, tabsLeft } from "./editor" /***********************************************************/ /* Examples menu */ @@ -311,6 +311,9 @@ async function getAllExamples(categoryId, thingType) { quickButton.addEventListener('click', () => { getTemplateData(example[1]["path"]) closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //create example content @@ -352,6 +355,9 @@ async function getAllExamples(categoryId, thingType) { exampleBtnUse.addEventListener('click', () => { getTemplateData(example[1]["path"]) closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //Listener to generate an editor with the examples information @@ -411,11 +417,17 @@ filterForm.addEventListener("submit", (e) => { clonedElement.children[0].children[1].addEventListener('click', () => { example.querySelector(".example__btn--use").click() closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //Opening the example when clicking on the apply button clonedElement.querySelector(".example__btn--use").addEventListener('click', () => { example.querySelector(".example__btn--use").click() closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //Closing the card when clicking on the cancel btn clonedElement.querySelector(".example__btn--cancel").addEventListener('click', () => { @@ -450,15 +462,21 @@ filterForm.addEventListener("submit", (e) => { clonedElement.children[0].children[0].addEventListener('click', () => { clonedElement.classList.toggle("open") }) - //Opning the example when clicking on the quick access button + //Opening the example when clicking on the quick access button clonedElement.children[0].children[1].addEventListener('click', () => { example.querySelector(".example__btn--use").click() closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //Opening the example when clicking on the apply button clonedElement.querySelector(".example__btn--use").addEventListener('click', () => { example.querySelector(".example__btn--use").click() closeCards() + tabsLeft.forEach(tab => { + tab.children[3].classList.add("hidden") + }) }) //Closing the card when clicking on the cancel btn clonedElement.querySelector(".example__btn--cancel").addEventListener('click', () => {