@smartsoft001/auth-shell-app-services 2.106.0 → 2.108.0
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/index.js +28 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -95,6 +95,31 @@ var PasswordService = class _PasswordService {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
+
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
99
|
+
var RemoveHtmlService = class {
|
|
100
|
+
/**
|
|
101
|
+
* Remove HTML tags and decode HTML entities from text
|
|
102
|
+
* - Removes HTML tags
|
|
103
|
+
* - Decodes common named entities ( , ", etc.)
|
|
104
|
+
* - Decodes numeric entities ({ or «)
|
|
105
|
+
* - Removes any remaining unrecognized entities
|
|
106
|
+
*/
|
|
107
|
+
static create(val) {
|
|
108
|
+
if (!val) {
|
|
109
|
+
return "";
|
|
110
|
+
}
|
|
111
|
+
let result = val;
|
|
112
|
+
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
113
|
+
result = result.replace(/ /g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/„/g, "\u201E").replace(/”/g, '"').replace(/“/g, '"').replace(/«/g, "\xAB").replace(/»/g, "\xBB").replace(/‌/g, "");
|
|
114
|
+
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
115
|
+
/&#x([0-9a-f]+);/gi,
|
|
116
|
+
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
117
|
+
);
|
|
118
|
+
result = result.replace(/&[a-z]+;/gi, "");
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
98
123
|
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
99
124
|
var SlugService = class _SlugService {
|
|
100
125
|
static {
|
|
@@ -121,6 +146,7 @@ var SlugService = class _SlugService {
|
|
|
121
146
|
}
|
|
122
147
|
/**
|
|
123
148
|
* Convert text to URL-friendly slug
|
|
149
|
+
* - Removes HTML tags and entities
|
|
124
150
|
* - Replaces Polish characters with English equivalents
|
|
125
151
|
* - Converts to lowercase
|
|
126
152
|
* - Replaces spaces and special characters with hyphens
|
|
@@ -131,7 +157,8 @@ var SlugService = class _SlugService {
|
|
|
131
157
|
if (!text) {
|
|
132
158
|
return "";
|
|
133
159
|
}
|
|
134
|
-
let slug =
|
|
160
|
+
let slug = RemoveHtmlService.create(text);
|
|
161
|
+
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
135
162
|
slug = slug.toLowerCase();
|
|
136
163
|
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
137
164
|
slug = slug.replace(/-+/g, "-");
|