diff --git a/dev/Common/Globals.js b/dev/Common/Globals.js index b360b1293..bd5c07dc4 100644 --- a/dev/Common/Globals.js +++ b/dev/Common/Globals.js @@ -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 }; diff --git a/dev/Common/HtmlEditor.js b/dev/Common/HtmlEditor.js index 3e5af8492..fcfc4ef0b 100644 --- a/dev/Common/HtmlEditor.js +++ b/dev/Common/HtmlEditor.js @@ -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; diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index 490d4a92a..a18f04f89 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -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 = '
' + resultHtml + '
'; } - GlobalsData.iMessageBodyCacheCount += 1; + iMessageBodyCacheCount += 1; body = $('
') .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(); } } diff --git a/dev/Styles/_End.less b/dev/Styles/_End.less index f11a25532..3e6d9752c 100644 --- a/dev/Styles/_End.less +++ b/dev/Styles/_End.less @@ -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; diff --git a/dev/bootstrap.js b/dev/bootstrap.js index 7120229ce..7411fc0d0 100644 --- a/dev/bootstrap.js +++ b/dev/bootstrap.js @@ -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 || {};