diff --git a/form-stamp.js b/form-stamp.js index 34d1992..57db446 100644 --- a/form-stamp.js +++ b/form-stamp.js @@ -15,6 +15,9 @@ export function formStamp(element, options = {}) const itemSelector = '.' + template.content.firstElementChild.className.replace(/ /g, '.'); const initialItemCount = container.querySelectorAll(itemSelector).length; let created = 0; + const afterDomManipulation = () => { + element.dispatchEvent(new CustomEvent('afterStampDomManipulation')); + } const removeRow = (removeItem) => () => { const rowToDelete = removeItem.closest(itemSelector); // Flow renders identity fields directly at the form tag, so we need to look @@ -33,6 +36,7 @@ export function formStamp(element, options = {}) } ))) { rowToDelete.remove(); + afterDomManipulation(); } } @@ -55,6 +59,7 @@ export function formStamp(element, options = {}) } ))) { element.before(clone); + afterDomManipulation(); created++; } }); diff --git a/package.json b/package.json index 8c44091..8173eb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@digicomp/form-stamp", - "version": "0.0.3", + "version": "0.0.4", "description": "duplicates an entry form field group", "main": "form-stamp.js", "scripts": {