@amimpact/willy-utils 4.6.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/form.ts +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amimpact/willy-utils",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "Javascript utils",
5
5
  "scripts": {
6
6
  "publish:prerelease": "npm version prerelease --preid beta && npm publish --tag beta",
package/src/form.ts CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Verwijdert de Froala footer uit de HTML string
3
+ * @param {string} htmlString
4
+ * @return {string} HTML string zonder de Froala footer
5
+ */
6
+ const removeFroalaFooter = (htmlString) => {
7
+ if (typeof htmlString !== 'string') {
8
+ return htmlString;
9
+ }
10
+
11
+ return htmlString.replace(/<p[^>]*data-f-id="pbf"[^>]*>[\s\S]*?<\/p>/, '');
12
+ };
13
+
1
14
  /**
2
15
  * Creeert een FormData object vanuit een object
3
16
  * https://gist.github.com/ghinda/8442a57f22099bdb2e34#gistcomment-2719686
@@ -63,7 +76,7 @@ export const convertObjectToFormData = (
63
76
  const val = model[propertyName];
64
77
  const formDataValue = typeof val === 'boolean' ? (val ? '1' : '0') : val;
65
78
 
66
- formData.append(formKey, formDataValue.toString());
79
+ formData.append(formKey, removeFroalaFooter(formDataValue.toString()));
67
80
  }
68
81
  }
69
82