Initialize form editor after dom is loaded

We need window.wpApiSettings which is initialized by WordPress in page footer.
[MAILPOET-2750]
This commit is contained in:
Rostislav Wolny
2020-03-31 17:13:09 +02:00
committed by Veljko V
parent f01643b50f
commit c34eddd3be

View File

@@ -15,15 +15,16 @@ const App = () => (
</GlobalContext.Provider> </GlobalContext.Provider>
); );
const appElement = document.querySelector('#mailpoet_form_edit'); window.addEventListener('DOMContentLoaded', () => {
const appElement = document.querySelector('#mailpoet_form_edit');
if (appElement) { if (appElement) {
initStore(); initStore();
initBlocks(); initBlocks();
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<App /> <App />
</React.StrictMode>, </React.StrictMode>,
appElement appElement
); );
} }
});