@contrail/document-generation 2.1.36 → 2.1.37
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.
|
@@ -10,4 +10,5 @@ export declare class DocumentTextElementUtil {
|
|
|
10
10
|
static extractTextStyleItalicFromHTML(text: any): string;
|
|
11
11
|
static extractTextStyleStrikethroughFromHTML(text: any): string;
|
|
12
12
|
static extractTextAlignFromHTML(text: any): string;
|
|
13
|
+
static extractPlainText(html: string): string;
|
|
13
14
|
}
|
|
@@ -163,5 +163,18 @@ class DocumentTextElementUtil {
|
|
|
163
163
|
return textAlign;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
static extractPlainText(html) {
|
|
167
|
+
if (!html)
|
|
168
|
+
return '';
|
|
169
|
+
return html
|
|
170
|
+
.replace(/<[^>]*>/g, '')
|
|
171
|
+
.replace(/&/g, '&')
|
|
172
|
+
.replace(/</g, '<')
|
|
173
|
+
.replace(/>/g, '>')
|
|
174
|
+
.replace(/"/g, '"')
|
|
175
|
+
.replace(/'/g, "'")
|
|
176
|
+
.replace(/ /g, ' ')
|
|
177
|
+
.trim();
|
|
178
|
+
}
|
|
166
179
|
}
|
|
167
180
|
exports.DocumentTextElementUtil = DocumentTextElementUtil;
|