mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
This version uses Rollup instead of WebPack.
Due to that the code is smaller and has changes to prevent Circular Dependencies
This commit is contained in:
parent
5e63ade9dd
commit
ad8fd8879b
49 changed files with 595 additions and 577 deletions
9
dev/External/Admin/ko.js
vendored
9
dev/External/Admin/ko.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
|
||||
const ko = window.ko;
|
||||
import { pInt } from 'Common/Utils';
|
||||
import ko from 'External/ko';
|
||||
|
||||
ko.bindingHandlers.saveTrigger = {
|
||||
init: (element) => {
|
||||
|
|
@ -38,11 +38,10 @@ ko.extenders.idleTrigger = (target) => {
|
|||
};
|
||||
|
||||
ko.extenders.posInterer = (target, defaultVal) => {
|
||||
const Utils = require('Common/Utils'),
|
||||
result = ko.computed({
|
||||
const result = ko.computed({
|
||||
read: target,
|
||||
write: newValue => {
|
||||
let val = Utils.pInt(newValue.toString(), defaultVal);
|
||||
let val = pInt(newValue.toString(), defaultVal);
|
||||
if (0 >= val) {
|
||||
val = defaultVal;
|
||||
}
|
||||
|
|
|
|||
13
dev/External/User/ko.js
vendored
13
dev/External/User/ko.js
vendored
|
|
@ -1,6 +1,9 @@
|
|||
const ko = window.ko,
|
||||
import ko from 'External/ko';
|
||||
import { HtmlEditor } from 'Common/Html';
|
||||
import { timeToNode } from 'Common/Momentor';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
|
||||
rlContentType = 'snappymail/action',
|
||||
const rlContentType = 'snappymail/action',
|
||||
|
||||
// In Chrome we have no access to dataTransfer.getData unless it's the 'drop' event
|
||||
// In Chrome Mobile dataTransfer.types.includes(rlContentType) fails, only text/plain is set
|
||||
|
|
@ -30,7 +33,6 @@ ko.bindingHandlers.editor = {
|
|||
let editor = null;
|
||||
|
||||
const fValue = fValueAccessor(),
|
||||
HtmlEditor = require('Common/HtmlEditor').default,
|
||||
fUpdateEditorValue = () => fValue && fValue.__editor && fValue.__editor.setHtmlOrPlain(fValue()),
|
||||
fUpdateKoValue = () => fValue && fValue.__editor && fValue(fValue.__editor.getDataWithHtmlMark()),
|
||||
fOnReady = () => {
|
||||
|
|
@ -51,7 +53,7 @@ ko.bindingHandlers.editor = {
|
|||
}
|
||||
};
|
||||
|
||||
let ttn = (element, fValueAccessor) => require('Common/Momentor').timeToNode(element, ko.unwrap(fValueAccessor()));
|
||||
let ttn = (element, fValueAccessor) => timeToNode(element, ko.unwrap(fValueAccessor()));
|
||||
ko.bindingHandlers.moment = {
|
||||
init: ttn,
|
||||
update: ttn
|
||||
|
|
@ -59,8 +61,7 @@ ko.bindingHandlers.moment = {
|
|||
|
||||
ko.bindingHandlers.emailsTags = {
|
||||
init: (element, fValueAccessor, fAllBindingsAccessor) => {
|
||||
const EmailModel = require('Model/Email').default,
|
||||
fValue = fValueAccessor(),
|
||||
const fValue = fValueAccessor(),
|
||||
fAllBindings = fAllBindingsAccessor(),
|
||||
inputDelimiters = [',', ';', '\n'];
|
||||
|
||||
|
|
|
|||
23
dev/External/ko.js
vendored
23
dev/External/ko.js
vendored
|
|
@ -1,32 +1,31 @@
|
|||
import { i18n, i18nToNodes, trigger } from 'Common/Translator';
|
||||
import { dropdownVisibility } from 'Common/Globals';
|
||||
|
||||
const
|
||||
doc = document,
|
||||
ko = window.ko,
|
||||
Translator = () => require('Common/Translator'),
|
||||
Globals = () => require('Common/Globals'),
|
||||
isFunction = v => typeof v === 'function',
|
||||
koValue = value => !ko.isObservable(value) && isFunction(value) ? value() : ko.unwrap(value);
|
||||
|
||||
ko.bindingHandlers.tooltip = {
|
||||
init: (element, fValueAccessor) => {
|
||||
const Global = Globals();
|
||||
const sValue = koValue(fValueAccessor());
|
||||
|
||||
if ('off' === element.dataset.tooltipI18n) {
|
||||
element.title = sValue;
|
||||
} else {
|
||||
element.title = Translator().i18n(sValue);
|
||||
Translator().trigger.subscribe(() =>
|
||||
element.title = Translator().i18n(sValue)
|
||||
element.title = i18n(sValue);
|
||||
trigger.subscribe(() =>
|
||||
element.title = i18n(sValue)
|
||||
);
|
||||
Global.dropdownVisibility.subscribe(() =>
|
||||
element.title = Translator().i18n(sValue)
|
||||
dropdownVisibility.subscribe(() =>
|
||||
element.title = i18n(sValue)
|
||||
);
|
||||
}
|
||||
},
|
||||
update: (element, fValueAccessor) => {
|
||||
const sValue = koValue(fValueAccessor());
|
||||
if (sValue) {
|
||||
element.title = 'off' === element.dataset.tooltipI18n ? sValue : Translator().i18n(sValue);
|
||||
element.title = 'off' === element.dataset.tooltipI18n ? sValue : i18n(sValue);
|
||||
} else {
|
||||
element.title = '';
|
||||
}
|
||||
|
|
@ -111,13 +110,13 @@ ko.bindingHandlers.modal = {
|
|||
};
|
||||
|
||||
ko.bindingHandlers.i18nInit = {
|
||||
init: element => Translator().i18nToNodes(element)
|
||||
init: element => i18nToNodes(element)
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nUpdate = {
|
||||
update: (element, fValueAccessor) => {
|
||||
ko.unwrap(fValueAccessor());
|
||||
Translator().i18nToNodes(element);
|
||||
i18nToNodes(element);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue