Skip to content
Snippets Groups Projects

Gmail to Outlook - complex text + embeded image + attachments

Merged Alexey Lunin requested to merge 122-gmail-to-outlook into master
1 file
+ 9
0
Compare changes
  • Side-by-side
  • Inline
@@ -18,6 +18,8 @@ export const normalizePlainPart = (
@@ -18,6 +18,8 @@ export const normalizePlainPart = (
if (sealRemovalOptions) {
if (sealRemovalOptions) {
text = removeSeal(text, sealRemovalOptions.sealUrl);
text = removeSeal(text, sealRemovalOptions.sealUrl);
}
}
 
 
text = cleanupImageText(text);
text = normalizeTextSpacings(text);
text = normalizeTextSpacings(text);
return text.trim();
return text.trim();
@@ -56,6 +58,13 @@ const removeSeal = (plain: string, sealUrl: string): string => {
@@ -56,6 +58,13 @@ const removeSeal = (plain: string, sealUrl: string): string => {
.replace(new RegExp(sealRegexReversed), "");
.replace(new RegExp(sealRegexReversed), "");
};
};
 
const cleanupImageText = (plain: string): string => {
 
// For cases [image: IMAGE_NAME.EXTENSION]
 
const sealRegex = `\\[(image:\\s)(.*)\\]`;
 
 
return plain.replace(new RegExp(sealRegex), "[$2]");
 
};
 
export const cleanupHiddenCharacters = (s: string): string => {
export const cleanupHiddenCharacters = (s: string): string => {
const removeSymbols = new RegExp(/[\u200B]+/g);
const removeSymbols = new RegExp(/[\u200B]+/g);
return s.replace(removeSymbols, "");
return s.replace(removeSymbols, "");
Loading