mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Small code cleanups and fix translations
This commit is contained in:
parent
b31bf3d7f5
commit
7ccc44616d
54 changed files with 288 additions and 426 deletions
99
dev/External/CKEditor.js
vendored
99
dev/External/CKEditor.js
vendored
|
|
@ -1,9 +1,9 @@
|
|||
const config = {
|
||||
'title': false,
|
||||
'stylesSet': false,
|
||||
'customConfig': '',
|
||||
'contentsCss': '',
|
||||
'toolbarGroups': [
|
||||
title: false,
|
||||
stylesSet: false,
|
||||
customConfig: '',
|
||||
contentsCss: '',
|
||||
toolbarGroups: [
|
||||
{ name: 'spec' },
|
||||
{ name: 'styles' },
|
||||
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi'] },
|
||||
|
|
@ -15,85 +15,56 @@ const config = {
|
|||
{ 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',
|
||||
removePlugins: 'liststyle',
|
||||
removeButtons: 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll',
|
||||
removeDialogTabs: 'link:advanced;link:target;image:advanced;images:advanced',
|
||||
|
||||
'extraPlugins': 'plain,signature',
|
||||
extraPlugins: 'plain,signature',
|
||||
|
||||
'allowedContent': true,
|
||||
'extraAllowedContent': true,
|
||||
allowedContent: true,
|
||||
extraAllowedContent: true,
|
||||
|
||||
'fillEmptyBlocks': false,
|
||||
'ignoreEmptyParagraph': true,
|
||||
'disableNativeSpellChecker': false,
|
||||
fillEmptyBlocks: false,
|
||||
ignoreEmptyParagraph: true,
|
||||
disableNativeSpellChecker: false,
|
||||
|
||||
'colorButton_enableAutomatic': false,
|
||||
'colorButton_enableMore': true,
|
||||
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'
|
||||
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'
|
||||
};
|
||||
|
||||
export function createCKEditor(element)
|
||||
{
|
||||
const language = rl.settings.get('Language'),
|
||||
allowSource = !!rl.settings.app('allowHtmlEditorSourceButton'),
|
||||
biti = !!rl.settings.app('allowHtmlEditorBitiButtons');
|
||||
const language = (rl.settings.get('Language') || 'en').toLowerCase(),
|
||||
noSource = !rl.settings.app('allowHtmlEditorSourceButton'),
|
||||
noBidi = !rl.settings.app('allowHtmlEditorBitiButtons');
|
||||
|
||||
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited) {
|
||||
config.toolbarGroups.__cfgInited = true;
|
||||
if (!config.__cfgInited) {
|
||||
config.__cfgInited = true;
|
||||
|
||||
if (allowSource) {
|
||||
config.removeButtons = config.removeButtons.replace(',Source', '');
|
||||
if (noSource) {
|
||||
config.removeButtons += ',Source';
|
||||
}
|
||||
|
||||
if (!biti) {
|
||||
config.removePlugins += (config.removePlugins ? ',' : '') + 'bidi';
|
||||
if (noBidi) {
|
||||
config.removePlugins += ',bidi';
|
||||
}
|
||||
}
|
||||
|
||||
config.enterMode = CKEDITOR.ENTER_BR;
|
||||
config.shiftEnterMode = CKEDITOR.ENTER_P;
|
||||
|
||||
config.language = htmlEditorLangsMap[(language || 'en').toLowerCase()] || 'en';
|
||||
config.language = htmlEditorLangsMap[language] || language.substr(0,2);
|
||||
|
||||
if (CKEDITOR.env) {
|
||||
CKEDITOR.env.isCompatible = true;
|
||||
}
|
||||
|
|
@ -112,12 +83,10 @@ export function createCKEditor(element)
|
|||
reader = new FileReader();
|
||||
|
||||
reader.onloadend = () => {
|
||||
if (reader.result) {
|
||||
if ('wysiwyg' === editor.mode) {
|
||||
try {
|
||||
editor.setData(editor.getData().replace(imageId, `<img src="${reader.result}" />`));
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
if (reader.result && 'wysiwyg' === editor.mode) {
|
||||
try {
|
||||
editor.setData(editor.getData().replace(imageId, `<img src="${reader.result}" />`));
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
3
dev/External/User/ko.js
vendored
3
dev/External/User/ko.js
vendored
|
|
@ -3,6 +3,7 @@ import ko from 'ko';
|
|||
import { HtmlEditor } from 'Common/Html';
|
||||
import { timeToNode } from 'Common/Momentor';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
import { doc } from 'Common/Globals';
|
||||
|
||||
const rlContentType = 'snappymail/action',
|
||||
|
||||
|
|
@ -111,7 +112,7 @@ ko.bindingHandlers.dragmessages = {
|
|||
if (!rl.settings.app('mobile')) {
|
||||
element.addEventListener("dragstart", e => {
|
||||
let data = fValueAccessor()(e);
|
||||
dragImage || (dragImage = document.getElementById('messagesDragImage'));
|
||||
dragImage || (dragImage = doc.getElementById('messagesDragImage'));
|
||||
if (data && dragImage) {
|
||||
dragImage.querySelector('.text').textContent = data.uids.length;
|
||||
let img = dragImage.querySelector('.icon-white');
|
||||
|
|
|
|||
3
dev/External/ko.js
vendored
3
dev/External/ko.js
vendored
|
|
@ -1,8 +1,7 @@
|
|||
import { i18n, i18nToNodes, trigger } from 'Common/Translator';
|
||||
import { dropdownVisibility } from 'Common/Globals';
|
||||
import { doc, dropdownVisibility } from 'Common/Globals';
|
||||
|
||||
const
|
||||
doc = document,
|
||||
isFunction = v => typeof v === 'function',
|
||||
koValue = value => !ko.isObservable(value) && isFunction(value) ? value() : ko.unwrap(value);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue