Merge branch 'master' into plugin-hooks

This commit is contained in:
djmaze 2021-03-25 14:16:03 +01:00
commit bb05e3ada9
264 changed files with 875 additions and 9117 deletions

View file

@ -11,96 +11,96 @@ const
sizes = ['B', 'KiB', 'MiB', 'GiB', 'TiB'],
exts = {
'eml': 'message/rfc822',
'mime': 'message/rfc822',
'rtx': 'text/richtext',
'vcard': 'text/vcard',
'vcf': 'text/vcard',
'htm': 'text/html',
'html': 'text/html',
'csv': 'text/csv',
'ics': 'text/calendar',
'ifb': 'text/calendar',
'xml': 'text/xml',
'json': app+'json',
'p10': app+'pkcs10',
'p7c': app+'pkcs7-mime',
'p7m': app+'pkcs7-mime',
'p7s': app+'pkcs7-signature',
'torrent': app+'x-bittorrent',
eml: 'message/rfc822',
mime: 'message/rfc822',
rtx: 'text/richtext',
vcard: 'text/vcard',
vcf: 'text/vcard',
htm: 'text/html',
html: 'text/html',
csv: 'text/csv',
ics: 'text/calendar',
ifb: 'text/calendar',
xml: 'text/xml',
json: app+'json',
p10: app+'pkcs10',
p7c: app+'pkcs7-mime',
p7m: app+'pkcs7-mime',
p7s: app+'pkcs7-signature',
torrent: app+'x-bittorrent',
// scripts
'js': app+'javascript',
'pl': 'text/perl',
'css': 'text/css',
'asp': 'text/asp',
'php': app+'x-httpd-php',
'phtml': app+'x-httpd-php',
js: app+'javascript',
pl: 'text/perl',
css: 'text/css',
asp: 'text/asp',
php: app+'x-httpd-php',
phtml: app+'x-httpd-php',
// images
'jpg': 'image/jpeg',
'ico': 'image/x-icon',
'tif': 'image/tiff',
'svg': 'image/svg+xml',
'svgz': 'image/svg+xml',
jpg: 'image/jpeg',
ico: 'image/x-icon',
tif: 'image/tiff',
svg: 'image/svg+xml',
svgz: 'image/svg+xml',
// archives
'zip': app+'zip',
zip: app+'zip',
'7z': app+'x-7z-compressed',
'rar': app+'x-rar-compressed',
'cab': app+'vnd.ms-cab-compressed',
'gz': app+'x-gzip',
'tgz': app+'x-gzip',
'bz': app+'x-bzip',
'bz2': app+'x-bzip2',
'deb': app+'x-debian-package',
rar: app+'x-rar-compressed',
cab: app+'vnd.ms-cab-compressed',
gz: app+'x-gzip',
tgz: app+'x-gzip',
bz: app+'x-bzip',
bz2: app+'x-bzip2',
deb: app+'x-debian-package',
// audio
'mp3': 'audio/mpeg',
'wav': 'audio/x-wav',
'mp4a': 'audio/mp4',
'weba': 'audio/webm',
'm3u': 'audio/x-mpegurl',
mp3: 'audio/mpeg',
wav: 'audio/x-wav',
mp4a: 'audio/mp4',
weba: 'audio/webm',
m3u: 'audio/x-mpegurl',
// video
'qt': 'video/quicktime',
'mov': 'video/quicktime',
'wmv': 'video/windows-media',
'avi': 'video/x-msvideo',
qt: 'video/quicktime',
mov: 'video/quicktime',
wmv: 'video/windows-media',
avi: 'video/x-msvideo',
'3gp': 'video/3gpp',
'3g2': 'video/3gpp2',
'mp4v': 'video/mp4',
'mpg4': 'video/mp4',
'ogv': 'video/ogg',
'm4v': 'video/x-m4v',
'asf': 'video/x-ms-asf',
'asx': 'video/x-ms-asf',
'wm': 'video/x-ms-wm',
'wmx': 'video/x-ms-wmx',
'wvx': 'video/x-ms-wvx',
'movie': 'video/x-sgi-movie',
mp4v: 'video/mp4',
mpg4: 'video/mp4',
ogv: 'video/ogg',
m4v: 'video/x-m4v',
asf: 'video/x-ms-asf',
asx: 'video/x-ms-asf',
wm: 'video/x-ms-wm',
wmx: 'video/x-ms-wmx',
wvx: 'video/x-ms-wvx',
movie: 'video/x-sgi-movie',
// adobe
'pdf': app+'pdf',
'psd': 'image/vnd.adobe.photoshop',
'ai': app+'postscript',
'eps': app+'postscript',
'ps': app+'postscript',
pdf: app+'pdf',
psd: 'image/vnd.adobe.photoshop',
ai: app+'postscript',
eps: app+'postscript',
ps: app+'postscript',
// ms office
'doc': app+'msword',
'rtf': app+'rtf',
'xls': app+'vnd.ms-excel',
'ppt': app+'vnd.ms-powerpoint',
'docx': msOffice+'wordprocessingml.document',
'xlsx': msOffice+'spreadsheetml.sheet',
'dotx': msOffice+'wordprocessingml.template',
'pptx': msOffice+'presentationml.presentation',
doc: app+'msword',
rtf: app+'rtf',
xls: app+'vnd.ms-excel',
ppt: app+'vnd.ms-powerpoint',
docx: msOffice+'wordprocessingml.document',
xlsx: msOffice+'spreadsheetml.sheet',
dotx: msOffice+'wordprocessingml.template',
pptx: msOffice+'presentationml.presentation',
// open office
'odt': openDoc+'text',
'ods': openDoc+'spreadsheet',
'odp': openDoc+'presentation'
odt: openDoc+'text',
ods: openDoc+'spreadsheet',
odp: openDoc+'presentation'
};
export const FileType = {

View file

@ -1,5 +1,3 @@
import { createCKEditor } from 'External/CKEditor.js';
const
htmlre = /[&<>"']/g,
htmlmap = {
@ -180,11 +178,11 @@ class HtmlEditor {
this.onReady && this.onReady();
};
if (window.CKEDITOR) {
this.editor = createCKEditor(this.element);
this.editor.on('instanceReady', onReady);
} else {
this.editor = new SquireUI(this.element, this.editor);
if (rl.createWYSIWYG) {
this.editor = rl.createWYSIWYG(this.element, onReady);
}
if (!this.editor) {
this.editor = new SquireUI(this.element);
setTimeout(onReady,1);
}

View file

@ -36,7 +36,7 @@ export function runHook(name, args = []) {
* @param {?number=} timeout
*/
rl.pluginRemoteRequest = (callback, action, parameters, timeout) => {
rl.app && rl.app.remote().defaultRequest(callback, 'Plugin' + action, parameters, timeout);
rl.app && rl.app.Remote.defaultRequest(callback, 'Plugin' + action, parameters, timeout);
};
/**

View file

@ -1,7 +1,7 @@
import ko from 'ko';
import { Notification, UploadErrorCode } from 'Common/Enums';
import { langLink } from 'Common/Links';
import { doc } from 'Common/Globals';
import { doc, createElement } from 'Common/Globals';
let I18N_DATA = window.rainloopI18N || {};
@ -14,19 +14,12 @@ export const trigger = ko.observable(false);
* @returns {string}
*/
export function i18n(key, valueList, defaulValue) {
let valueName = '',
result = I18N_DATA[key];
let result = I18N_DATA[key] || defaulValue || key;
if (undefined === result) {
result = undefined === defaulValue ? key : defaulValue;
}
if (null != valueList) {
for (valueName in valueList) {
if (Object.prototype.hasOwnProperty.call(valueList, valueName)) {
result = result.replace('%' + valueName + '%', valueList[valueName]);
}
}
if (valueList) {
Object.entries(valueList).forEach(([key, value]) => {
result = result.replace('%' + key + '%', value);
});
}
return result;
@ -129,7 +122,7 @@ export function getUploadErrorDescByCode(code) {
*/
export function reload(admin, language) {
return new Promise((resolve, reject) => {
const script = doc.createElement('script');
const script = createElement('script');
script.onload = () => {
// reload the data
if (window.rainloopI18N) {

View file

@ -1,5 +1,5 @@
import { SaveSettingsStep } from 'Common/Enums';
import { doc, elementById } from 'Common/Globals';
import { doc, createElement, elementById } from 'Common/Globals';
export const
isArray = Array.isArray,
@ -119,7 +119,7 @@ export function changeTheme(value, themeTrigger = ()=>{}) {
.then(data => {
if (data && isArray(data) && 2 === data.length) {
if (themeLink && !themeStyle) {
themeStyle = doc.createElement('style');
themeStyle = createElement('style');
themeStyle.id = 'app-theme-style';
themeLink.after(themeStyle);
themeLink.remove();

View file

@ -2,7 +2,7 @@ import { ComposeType, FolderType } from 'Common/EnumsUser';
import { EmailModel } from 'Model/Email';
import { encodeHtml } from 'Common/Html';
import { isArray } from 'Common/Utils';
import { doc } from 'Common/Globals';
import { createElement } from 'Common/Globals';
/**
* @param {(string|number)} value
@ -79,7 +79,7 @@ export function htmlToPlain(html) {
};
const
tpl = doc.createElement('template'),
tpl = createElement('template'),
convertPre = (...args) =>
args && 1 < args.length
? args[1]