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,9 +15,9 @@ const App = () => (
</GlobalContext.Provider>
);
const appElement = document.querySelector('#mailpoet_form_edit');
if (appElement) {
window.addEventListener('DOMContentLoaded', () => {
const appElement = document.querySelector('#mailpoet_form_edit');
if (appElement) {
initStore();
initBlocks();
ReactDOM.render(
@@ -26,4 +26,5 @@ if (appElement) {
</React.StrictMode>,
appElement
);
}
}
});