Closed DieterHolvoet closed 3 years ago
Do you suggest adding it to the event listener in app.html or to the initUiCollectionForm function in app.js?
It can be another method to avoid mess :
initAutoCompleteForm(form) {
document.dispatchEvent(new CustomEvent('monsieurBizRichEditorInitAutoCompleteForm', {
'detail': {'form': form}
}));
}
Call it when it's needed in app.js.
Then
document.addEventListener('monsieurBizRichEditorInitAutoCompleteForm', (e) => {
let form = e.detail.form;
$(form).find('.sylius-autocomplete').autoComplete(); // I don't know if it works
});
What do you think about a more generic monsieurBizRichEditorInitForm
event and two subscribers, one for initialising CollectionForm and one for initialising autocomplete.
Or a generic event like you said monsieurBizRichEditorInitForm
and one event subscriber ^^
@maximehuran did the changes, let me know what you think.
I made a rebase from master but I cannot force push with lease in your branch. Can you resolve the conflict ?
Done!
Thank you @DieterHolvoet ! 🥇
Fixes #105.