✨ feat(newsletter): Ajoute l'éditeur de template d'email avec Preact
Crée un nouvel éditeur de template d'email en utilisant Preact et
react-email-editor, et l'intègre au contrôleur et aux vues.
```
53 lines
1.9 KiB
JavaScript
53 lines
1.9 KiB
JavaScript
import './admin.scss'
|
|
import * as Turbo from "@hotwired/turbo"
|
|
import {AutoSubmit} from './class/AutoSubmit'
|
|
import {ServerCard} from './class/ServerCard'
|
|
import {AutoCustomer} from './class/AutoCustomer'
|
|
import {RepeatLine} from './class/RepeatLine'
|
|
import {OrderCtrl} from './class/OrderCtrl'
|
|
import {MainframeEmailEditor} from './class/MainframeEmailEditor'
|
|
import preactCustomElement from './functions/preact'
|
|
|
|
|
|
function script() {
|
|
customElements.define('auto-submit',AutoSubmit,{extends:'form'})
|
|
customElements.define('server-card',ServerCard,{extends:'div'})
|
|
customElements.define('auto-customer',AutoCustomer,{extends:'button'})
|
|
customElements.define('repeat-line',RepeatLine,{extends:'div'})
|
|
customElements.define('order-ctrl',OrderCtrl,{extends:'div'})
|
|
preactCustomElement("email-builder",MainframeEmailEditor)
|
|
|
|
}
|
|
|
|
function full() {
|
|
const sidebar = document.getElementById('sidebar');
|
|
const sidebarToggle = document.getElementById('sidebar-toggle');
|
|
|
|
sidebarToggle.addEventListener('click', function () {
|
|
sidebar.classList.toggle('-translate-x-full');
|
|
});
|
|
const submenuToggles = document.querySelectorAll('[data-submenu-toggle]');
|
|
|
|
submenuToggles.forEach(button => {
|
|
button.addEventListener('click', function () {
|
|
const targetId = this.dataset.submenuToggle;
|
|
const submenu = document.getElementById(`submenu-${targetId}`);
|
|
const arrowIcon = this.querySelector('.arrow-icon');
|
|
|
|
if (submenu && arrowIcon) {
|
|
// Toggle the 'active' class on the submenu
|
|
submenu.classList.toggle('active');
|
|
// Toggle the 'rotate' class on the arrow icon
|
|
arrowIcon.classList.toggle('rotate');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', ()=>{
|
|
script();
|
|
});
|
|
document.addEventListener("turbo:load", ()=> {
|
|
full()
|
|
});
|