mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-10-30 07:57:05 +08:00
iMessageBodyCacheCount only used in Message.js
htmlEditorDefaultConfig & htmlEditorLangsMap only used in HtmlEditor.js
This commit is contained in:
parent
496c8f59ae
commit
24cb874c87
5 changed files with 90 additions and 96 deletions
|
|
@ -14,94 +14,12 @@ export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
|
||||||
*/
|
*/
|
||||||
export const useKeyboardShortcuts = ko.observable(true);
|
export const useKeyboardShortcuts = ko.observable(true);
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
const sUserAgent =
|
|
||||||
('navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase()) || '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
export const bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(sUserAgent);
|
export const bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(
|
||||||
|
(window.navigator && navigator.userAgent && navigator.userAgent.toLowerCase()) || ''
|
||||||
/**
|
);
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
export const htmlEditorDefaultConfig = {
|
|
||||||
'title': false,
|
|
||||||
'stylesSet': false,
|
|
||||||
'customConfig': '',
|
|
||||||
'contentsCss': '',
|
|
||||||
'toolbarGroups': [
|
|
||||||
{ name: 'spec' },
|
|
||||||
{ name: 'styles' },
|
|
||||||
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi'] },
|
|
||||||
{ name: 'colors' },
|
|
||||||
bMobileDevice ? {} : { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align'] },
|
|
||||||
{ name: 'links' },
|
|
||||||
{ name: 'insert' },
|
|
||||||
{ name: 'document', groups: ['mode', 'document', 'doctools'] },
|
|
||||||
{ name: 'others' }
|
|
||||||
],
|
|
||||||
|
|
||||||
'removePlugins': 'liststyle',
|
|
||||||
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
|
|
||||||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
|
||||||
|
|
||||||
'extraPlugins': 'plain,signature',
|
|
||||||
|
|
||||||
'allowedContent': true,
|
|
||||||
'extraAllowedContent': true,
|
|
||||||
|
|
||||||
'fillEmptyBlocks': false,
|
|
||||||
'ignoreEmptyParagraph': true,
|
|
||||||
'disableNativeSpellChecker': false,
|
|
||||||
|
|
||||||
'colorButton_enableAutomatic': false,
|
|
||||||
'colorButton_enableMore': true,
|
|
||||||
|
|
||||||
'font_defaultLabel': 'Arial',
|
|
||||||
'fontSize_defaultLabel': '13',
|
|
||||||
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
export const htmlEditorLangsMap = {
|
|
||||||
'ar_sa': 'ar-sa',
|
|
||||||
'bg_bg': 'bg',
|
|
||||||
'cs_CZ': 'cs',
|
|
||||||
'de_de': 'de',
|
|
||||||
'el_gr': 'el',
|
|
||||||
'es_es': 'es',
|
|
||||||
'et_ee': 'et',
|
|
||||||
'fr_fr': 'fr',
|
|
||||||
'hu_hu': 'hu',
|
|
||||||
'is_is': 'is',
|
|
||||||
'it_it': 'it',
|
|
||||||
'ja_jp': 'ja',
|
|
||||||
'ko_kr': 'ko',
|
|
||||||
'lt_lt': 'lt',
|
|
||||||
'lv_lv': 'lv',
|
|
||||||
'fa_ir': 'fa',
|
|
||||||
'nb_no': 'nb',
|
|
||||||
'nl_nl': 'nl',
|
|
||||||
'pl_pl': 'pl',
|
|
||||||
'pt_br': 'pt-br',
|
|
||||||
'pt_pt': 'pt',
|
|
||||||
'ro_ro': 'ro',
|
|
||||||
'ru_ru': 'ru',
|
|
||||||
'sk_sk': 'sk',
|
|
||||||
'sl_si': 'sl',
|
|
||||||
'sv_se': 'sv',
|
|
||||||
'tr_tr': 'tr',
|
|
||||||
'uk_ua': 'uk',
|
|
||||||
'zh_cn': 'zh-cn',
|
|
||||||
'zh_tw': 'zh'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export const VIEW_MODELS = {
|
export const VIEW_MODELS = {
|
||||||
settings: [],
|
settings: [],
|
||||||
|
|
@ -186,7 +104,5 @@ export const data = {
|
||||||
__APP__: null,
|
__APP__: null,
|
||||||
iAjaxErrorCount: 0,
|
iAjaxErrorCount: 0,
|
||||||
iTokenErrorCount: 0,
|
iTokenErrorCount: 0,
|
||||||
aBootstrapDropdowns: [],
|
|
||||||
iMessageBodyCacheCount: 0,
|
|
||||||
bUnload: false
|
bUnload: false
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,83 @@
|
||||||
import { htmlEditorDefaultConfig, htmlEditorLangsMap } from 'Common/Globals';
|
|
||||||
import { EventKeyCode } from 'Common/Enums';
|
import { EventKeyCode } from 'Common/Enums';
|
||||||
import * as Settings from 'Storage/Settings';
|
import * as Settings from 'Storage/Settings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
const htmlEditorDefaultConfig = {
|
||||||
|
'title': false,
|
||||||
|
'stylesSet': false,
|
||||||
|
'customConfig': '',
|
||||||
|
'contentsCss': '',
|
||||||
|
'toolbarGroups': [
|
||||||
|
{ name: 'spec' },
|
||||||
|
{ name: 'styles' },
|
||||||
|
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi'] },
|
||||||
|
{ name: 'colors' },
|
||||||
|
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align'] },
|
||||||
|
{ name: 'links' },
|
||||||
|
{ name: 'insert' },
|
||||||
|
{ name: 'document', groups: ['mode', 'document', 'doctools'] },
|
||||||
|
{ name: 'others' }
|
||||||
|
],
|
||||||
|
|
||||||
|
'removePlugins': 'liststyle',
|
||||||
|
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
|
||||||
|
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
||||||
|
|
||||||
|
'extraPlugins': 'plain,signature',
|
||||||
|
|
||||||
|
'allowedContent': true,
|
||||||
|
'extraAllowedContent': true,
|
||||||
|
|
||||||
|
'fillEmptyBlocks': false,
|
||||||
|
'ignoreEmptyParagraph': true,
|
||||||
|
'disableNativeSpellChecker': false,
|
||||||
|
|
||||||
|
'colorButton_enableAutomatic': false,
|
||||||
|
'colorButton_enableMore': true,
|
||||||
|
|
||||||
|
'font_defaultLabel': 'Arial',
|
||||||
|
'fontSize_defaultLabel': '13',
|
||||||
|
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
htmlEditorLangsMap = {
|
||||||
|
'ar_sa': 'ar-sa',
|
||||||
|
'bg_bg': 'bg',
|
||||||
|
'cs_CZ': 'cs',
|
||||||
|
'de_de': 'de',
|
||||||
|
'el_gr': 'el',
|
||||||
|
'es_es': 'es',
|
||||||
|
'et_ee': 'et',
|
||||||
|
'fr_fr': 'fr',
|
||||||
|
'hu_hu': 'hu',
|
||||||
|
'is_is': 'is',
|
||||||
|
'it_it': 'it',
|
||||||
|
'ja_jp': 'ja',
|
||||||
|
'ko_kr': 'ko',
|
||||||
|
'lt_lt': 'lt',
|
||||||
|
'lv_lv': 'lv',
|
||||||
|
'fa_ir': 'fa',
|
||||||
|
'nb_no': 'nb',
|
||||||
|
'nl_nl': 'nl',
|
||||||
|
'pl_pl': 'pl',
|
||||||
|
'pt_br': 'pt-br',
|
||||||
|
'pt_pt': 'pt',
|
||||||
|
'ro_ro': 'ro',
|
||||||
|
'ru_ru': 'ru',
|
||||||
|
'sk_sk': 'sk',
|
||||||
|
'sl_si': 'sl',
|
||||||
|
'sv_se': 'sv',
|
||||||
|
'tr_tr': 'tr',
|
||||||
|
'uk_ua': 'uk',
|
||||||
|
'zh_cn': 'zh-cn',
|
||||||
|
'zh_tw': 'zh'
|
||||||
|
};
|
||||||
|
|
||||||
class HtmlEditor {
|
class HtmlEditor {
|
||||||
editor;
|
editor;
|
||||||
blurTimer = 0;
|
blurTimer = 0;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import {
|
||||||
} from 'Common/Cache';
|
} from 'Common/Cache';
|
||||||
|
|
||||||
import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
|
import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
|
||||||
import { data as GlobalsData } from 'Common/Globals';
|
|
||||||
import { mailBox, notificationMailIcon } from 'Common/Links';
|
import { mailBox, notificationMailIcon } from 'Common/Links';
|
||||||
import { i18n, getNotification } from 'Common/Translator';
|
import { i18n, getNotification } from 'Common/Translator';
|
||||||
|
|
||||||
|
|
@ -57,6 +56,9 @@ const
|
||||||
$hcont.empty();
|
$hcont.empty();
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let iMessageBodyCacheCount = 0;
|
||||||
|
|
||||||
$hcont
|
$hcont
|
||||||
.attr('area', 'hidden')
|
.attr('area', 'hidden')
|
||||||
.css({ position: 'absolute', left: -5000 })
|
.css({ position: 'absolute', left: -5000 })
|
||||||
|
|
@ -232,7 +234,7 @@ class MessageUserStore {
|
||||||
|
|
||||||
purgeMessageBodyCache() {
|
purgeMessageBodyCache() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
const end = GlobalsData.iMessageBodyCacheCount - MESSAGE_BODY_CACHE_LIMIT;
|
const end = iMessageBodyCacheCount - MESSAGE_BODY_CACHE_LIMIT;
|
||||||
|
|
||||||
if (0 < end) {
|
if (0 < end) {
|
||||||
const messagesDom = this.messagesBodiesDom();
|
const messagesDom = this.messagesBodiesDom();
|
||||||
|
|
@ -563,12 +565,12 @@ class MessageUserStore {
|
||||||
resultHtml = '<pre>' + resultHtml + '</pre>';
|
resultHtml = '<pre>' + resultHtml + '</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalsData.iMessageBodyCacheCount += 1;
|
iMessageBodyCacheCount += 1;
|
||||||
|
|
||||||
body = $('<div id="' + id + '" ></div>')
|
body = $('<div id="' + id + '" ></div>')
|
||||||
.hide()
|
.hide()
|
||||||
.addClass('rl-cache-class');
|
.addClass('rl-cache-class');
|
||||||
body.data('rl-cache-count', GlobalsData.iMessageBodyCacheCount);
|
body.data('rl-cache-count', iMessageBodyCacheCount);
|
||||||
|
|
||||||
body.html(findEmailAndLinks(resultHtml)).addClass('b-text-part ' + (isHtml ? 'html' : 'plain'));
|
body.html(findEmailAndLinks(resultHtml)).addClass('b-text-part ' + (isHtml ? 'html' : 'plain'));
|
||||||
|
|
||||||
|
|
@ -594,8 +596,8 @@ class MessageUserStore {
|
||||||
} else {
|
} else {
|
||||||
message.body = textBody;
|
message.body = textBody;
|
||||||
if (message.body) {
|
if (message.body) {
|
||||||
GlobalsData.iMessageBodyCacheCount += 1;
|
iMessageBodyCacheCount += 1;
|
||||||
message.body.data('rl-cache-count', GlobalsData.iMessageBodyCacheCount);
|
message.body.data('rl-cache-count', iMessageBodyCacheCount);
|
||||||
message.fetchDataFromDom();
|
message.fetchDataFromDom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
.rl-view-model {
|
.rl-view-model {
|
||||||
&.RL-Login, &.RL-LoginNew, &.RL-AdminLogin, &.RL-About {
|
&.RL-Login, &.RL-LoginNew, &.RL-AdminLogin {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
|
|
|
||||||
2
dev/bootstrap.js
vendored
2
dev/bootstrap.js
vendored
|
|
@ -32,7 +32,7 @@ export default (App) => {
|
||||||
addEventListener('unload', () => GlobalsData.bUnload = true);
|
addEventListener('unload', () => GlobalsData.bUnload = true);
|
||||||
|
|
||||||
$htmlCL.add(bMobileDevice ? 'mobile' : 'no-mobile');
|
$htmlCL.add(bMobileDevice ? 'mobile' : 'no-mobile');
|
||||||
$html.on('click.dropdown.data-api', ()=>rl.Dropdowns.detectVisibility());
|
jQuery($html).on('click.dropdown.data-api', ()=>rl.Dropdowns.detectVisibility());
|
||||||
|
|
||||||
const rl = window.rl || {};
|
const rl = window.rl || {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue