mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
This version uses Rollup instead of WebPack.
Due to that the code is smaller and has changes to prevent Circular Dependencies
This commit is contained in:
parent
5e63ade9dd
commit
ad8fd8879b
49 changed files with 595 additions and 577 deletions
|
|
@ -1,16 +1,11 @@
|
|||
import { ComposeType, FolderType } from 'Common/EnumsUser';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
import { encodeHtml } from 'Common/Html';
|
||||
|
||||
const
|
||||
tpl = document.createElement('template'),
|
||||
isArray = Array.isArray,
|
||||
htmlmap = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
},
|
||||
htmlspecialchars = str => (''+str).replace(/[&<>"']/g, m => htmlmap[m]);
|
||||
isArray = Array.isArray;
|
||||
|
||||
/**
|
||||
* @param {(string|number)} value
|
||||
|
|
@ -21,14 +16,6 @@ export function isPosNumeric(value, includeZero = true) {
|
|||
return null != value && (includeZero ? /^[0-9]*$/ : /^[1-9]+[0-9]*$/).test(value.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
export function encodeHtml(text) {
|
||||
return null != text ? htmlspecialchars(text.toString()) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @param {number=} len = 100
|
||||
|
|
@ -101,7 +88,7 @@ export function htmlToPlain(html) {
|
|||
.replace(/[\n]/gm, '<br />')
|
||||
.replace(/[\r]/gm, '')
|
||||
: '',
|
||||
fixAttibuteValue = (...args) => (args && 1 < args.length ? '' + args[1] + htmlspecialchars(args[2]) : ''),
|
||||
fixAttibuteValue = (...args) => (args && 1 < args.length ? '' + args[1] + encodeHtml(args[2]) : ''),
|
||||
convertLinks = (...args) => (args && 1 < args.length ? args[1].trim() : '');
|
||||
|
||||
tpl.innerHTML = html
|
||||
|
|
@ -470,8 +457,7 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
|||
params = {};
|
||||
|
||||
const email = mailToUrl.replace(/\?.+$/, ''),
|
||||
query = mailToUrl.replace(/^[^?]*\?/, ''),
|
||||
EmailModel = require('Model/Email').default;
|
||||
query = mailToUrl.replace(/^[^?]*\?/, '');
|
||||
|
||||
query.split('&').forEach(temp => {
|
||||
temp = temp.split('=');
|
||||
|
|
@ -506,7 +492,7 @@ export function mailToHelper(mailToUrl, PopupComposeViewModel) {
|
|||
bcc = EmailModel.parseEmailLine(decodeURIComponent(params.bcc));
|
||||
}
|
||||
|
||||
require('Knoin/Knoin').showScreenPopup(PopupComposeViewModel, [
|
||||
showScreenPopup(PopupComposeViewModel, [
|
||||
ComposeType.Empty,
|
||||
null,
|
||||
to,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue