@amimpact/willy-utils 4.8.2 → 4.9.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.
- package/package.json +1 -1
- package/src/form.ts +14 -1
- package/src/index.ts +9 -1
- package/src/url.ts +10 -0
package/package.json
CHANGED
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
|
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,14 @@ import {
|
|
|
24
24
|
wrap,
|
|
25
25
|
} from './misc';
|
|
26
26
|
import { $, $$, getParents } from './selectors';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
isCraftActionUrl,
|
|
29
|
+
isInternalLink,
|
|
30
|
+
isExternalUrl,
|
|
31
|
+
isAsset,
|
|
32
|
+
slugify,
|
|
33
|
+
isValidEmail,
|
|
34
|
+
} from './url';
|
|
28
35
|
|
|
29
36
|
export {
|
|
30
37
|
$,
|
|
@@ -53,6 +60,7 @@ export {
|
|
|
53
60
|
isPlainObject,
|
|
54
61
|
isTouchDevice,
|
|
55
62
|
isValidUrl,
|
|
63
|
+
isValidEmail,
|
|
56
64
|
observeResize,
|
|
57
65
|
parseISODuration,
|
|
58
66
|
readCookie,
|
package/src/url.ts
CHANGED
|
@@ -139,3 +139,13 @@ export const slugify = (str: string) => {
|
|
|
139
139
|
.replace(/[\s_-]+/g, '-')
|
|
140
140
|
.replace(/^-+|-+$/g, '');
|
|
141
141
|
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Check op geldig email adres
|
|
145
|
+
* @param {string} email
|
|
146
|
+
*/
|
|
147
|
+
export const isValidEmail = (email: string) => {
|
|
148
|
+
// Reguliere expressie voor een eenvoudig e-mailformaat
|
|
149
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
150
|
+
return emailRegex.test(email);
|
|
151
|
+
};
|