iMessageBodyCacheCount only used in Message.js

htmlEditorDefaultConfig & htmlEditorLangsMap only used in HtmlEditor.js
This commit is contained in:
djmaze 2020-08-25 09:34:29 +02:00
parent 496c8f59ae
commit 24cb874c87
5 changed files with 90 additions and 96 deletions

View file

@ -14,94 +14,12 @@ export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });
*/
export const useKeyboardShortcuts = ko.observable(true);
/**
* @type {string}
*/
const sUserAgent =
('navigator' in window && 'userAgent' in navigator && navigator.userAgent.toLowerCase()) || '';
/**
* @type {boolean}
*/
export const bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(sUserAgent);
/**
* @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 bMobileDevice = (/android|iphone|ipod|ipad|blackberry|mobile/i).test(
(window.navigator && navigator.userAgent && navigator.userAgent.toLowerCase()) || ''
);
export const VIEW_MODELS = {
settings: [],
@ -186,7 +104,5 @@ export const data = {
__APP__: null,
iAjaxErrorCount: 0,
iTokenErrorCount: 0,
aBootstrapDropdowns: [],
iMessageBodyCacheCount: 0,
bUnload: false
};

View file

@ -1,7 +1,83 @@
import { htmlEditorDefaultConfig, htmlEditorLangsMap } from 'Common/Globals';
import { EventKeyCode } from 'Common/Enums';
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 {
editor;
blurTimer = 0;

View file

@ -24,7 +24,6 @@ import {
} from 'Common/Cache';
import { MESSAGE_BODY_CACHE_LIMIT } from 'Common/Consts';
import { data as GlobalsData } from 'Common/Globals';
import { mailBox, notificationMailIcon } from 'Common/Links';
import { i18n, getNotification } from 'Common/Translator';
@ -57,6 +56,9 @@ const
$hcont.empty();
return result;
};
let iMessageBodyCacheCount = 0;
$hcont
.attr('area', 'hidden')
.css({ position: 'absolute', left: -5000 })
@ -232,7 +234,7 @@ class MessageUserStore {
purgeMessageBodyCache() {
let count = 0;
const end = GlobalsData.iMessageBodyCacheCount - MESSAGE_BODY_CACHE_LIMIT;
const end = iMessageBodyCacheCount - MESSAGE_BODY_CACHE_LIMIT;
if (0 < end) {
const messagesDom = this.messagesBodiesDom();
@ -563,12 +565,12 @@ class MessageUserStore {
resultHtml = '<pre>' + resultHtml + '</pre>';
}
GlobalsData.iMessageBodyCacheCount += 1;
iMessageBodyCacheCount += 1;
body = $('<div id="' + id + '" ></div>')
.hide()
.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'));
@ -594,8 +596,8 @@ class MessageUserStore {
} else {
message.body = textBody;
if (message.body) {
GlobalsData.iMessageBodyCacheCount += 1;
message.body.data('rl-cache-count', GlobalsData.iMessageBodyCacheCount);
iMessageBodyCacheCount += 1;
message.body.data('rl-cache-count', iMessageBodyCacheCount);
message.fetchDataFromDom();
}
}

View file

@ -1,6 +1,6 @@
.rl-view-model {
&.RL-Login, &.RL-LoginNew, &.RL-AdminLogin, &.RL-About {
&.RL-Login, &.RL-LoginNew, &.RL-AdminLogin {
position: relative;
height: 100%;
z-index: 5;

2
dev/bootstrap.js vendored
View file

@ -32,7 +32,7 @@ export default (App) => {
addEventListener('unload', () => GlobalsData.bUnload = true);
$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 || {};