{isDrawerOpen && showUnsavedNotice && (
{data.i18n.unsavedNotice}
)}
{drawer}
>
);
}
function mount() {
const data = window.llmagnetElementorData;
if (!data || !data.postId) {
return;
}
// The drawers read window.wpApiSettings.nonce; Elementor localizes its
// own copy — reuse it if present, never overwrite (spec Feature 4).
const w = window as any;
if (!w.wpApiSettings || !w.wpApiSettings.nonce) {
w.wpApiSettings = { root: data.restRoot, nonce: data.restNonce };
}
let rootEl = document.getElementById('llmagnet-elementor-root');
if (!rootEl) {
rootEl = document.createElement('div');
rootEl.id = 'llmagnet-elementor-root';
rootEl.className = 'llmagnet-surface';
document.body.appendChild(rootEl);
}
try {
createRoot(rootEl).render(