MDL-80391 tiny_html: Fixed multi modal layer display

This commit is contained in:
Stevani Andolo 2024-02-29 12:53:21 +08:00
parent 48049499d2
commit ec7bd6035c
3 changed files with 16 additions and 10 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -508,20 +508,26 @@ export const setupForTarget = async(target, options = {}) => {
// If the editor is in a modal, we need to hide the modal when window editor's window is opened.
editor.on('OpenWindow', () => {
if (isModalMode(target)) {
const modal = document.querySelector('[data-region="modal"]');
if (!modal.classList.contains('hide')) {
modal.classList.add('hide');
}
const modals = document.querySelectorAll('[data-region="modal"]');
if (modals) {
modals.forEach((modal) => {
if (!modal.classList.contains('hide')) {
modal.classList.add('hide');
}
});
}
});
// If the editor's window is closed, we need to show the hidden modal back.
editor.on('CloseWindow', () => {
if (isModalMode(target)) {
const modal = document.querySelector('[data-region="modal"]');
if (modal.classList.contains('hide')) {
modal.classList.remove('hide');
const modals = document.querySelectorAll('[data-region="modal"]');
if (modals) {
modals.forEach((modal) => {
if (modal.classList.contains('hide')) {
modal.classList.remove('hide');
}
});
}
}
});