Skip to content
Snippets Groups Projects
Commit be03efce authored by Igor Markin's avatar Igor Markin
Browse files

Add build

parent fea233fa
No related branches found
No related tags found
1 merge request!27Gmail to Outlook - complex text + embeded image + attachments
Pipeline #45045 passed with stages
in 57 seconds
export interface SealRemovalOptions {
sealUrl: string;
export interface Options {
sealUrl?: string;
normalizeImagePlain?: boolean;
}
export declare const normalizePlainPart: (text: string, sealRemovalOptions?: SealRemovalOptions) => string;
export declare const normalizePlainPart: (text: string, options?: Options) => string;
export declare const cleanupImageText: (plain: string) => string;
export declare const cleanupHiddenCharacters: (s: string) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanupHiddenCharacters = exports.normalizePlainPart = void 0;
exports.cleanupHiddenCharacters = exports.cleanupImageText = exports.normalizePlainPart = void 0;
// this is a Node module. require is a must to work across different envs
const URL = require("url-parse");
const utils_1 = require("../utils");
const normalizePlainPart = (text, sealRemovalOptions) => {
const defaultOptions = {
normalizeImagePlain: true,
};
const normalizePlainPart = (text, options) => {
options = options
? Object.assign(defaultOptions, Object.assign({}, options))
: defaultOptions;
text = exports.cleanupHiddenCharacters(text);
text = patchOutlookSafelinksWrappers(text);
if (sealRemovalOptions) {
text = removeSeal(text, sealRemovalOptions.sealUrl);
if (options === null || options === void 0 ? void 0 : options.sealUrl) {
text = removeSeal(text, options.sealUrl);
}
if (options === null || options === void 0 ? void 0 : options.normalizeImagePlain) {
text = exports.cleanupImageText(text);
}
text = cleanupImageText(text);
text = utils_1.normalizeTextSpacings(text);
return text.trim();
};
......@@ -45,6 +53,7 @@ const cleanupImageText = (plain) => {
const sealRegex = `\\[(image:\\s)(.*)\\]`;
return plain.replace(new RegExp(sealRegex), "[$2]");
};
exports.cleanupImageText = cleanupImageText;
const cleanupHiddenCharacters = (s) => {
const removeSymbols = new RegExp(/[\u200B]+/g);
return s.replace(removeSymbols, "");
......
declare const _default: {
normalizePlain: (text: string, sealRemovalOptions?: import("./PlainNormalizer").SealRemovalOptions) => string;
normalizePlain: (text: string, options?: import("./PlainNormalizer").Options) => string;
cleanupImageText: (plain: string) => string;
};
export default _default;
......@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
const PlainNormalizer_1 = require("./PlainNormalizer");
exports.default = {
normalizePlain: PlainNormalizer_1.normalizePlainPart,
cleanupImageText: PlainNormalizer_1.cleanupImageText,
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment