html editor optimizations

This commit is contained in:
RainLoop Team 2014-02-11 20:00:01 +04:00
parent 8d994cf8cc
commit 96b37227b2
13 changed files with 361 additions and 287 deletions

View file

@ -98,12 +98,14 @@ Globals.oHtmlEditorDefaultConfig = {
],
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,Indent,Outdent',
'removeDialogTabs': 'link:advanced;link:target;image:advanced',
'allowedContent': false,
'autoParagraph': false,
'enterMode': window.CKEDITOR.ENTER_BR,
'shiftEnterMode': window.CKEDITOR.ENTER_P,
// 'enterMode': window.CKEDITOR.ENTER_BR,
// 'shiftEnterMode': window.CKEDITOR.ENTER_P,
'enterMode': window.CKEDITOR.ENTER_DIV,
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
// 'floatSpaceDockedOffsetY': 1,
'font_defaultLabel': 'Arial',

View file

@ -10,6 +10,7 @@ function HtmlEditorWrapper(oElement, fOnBlur, fOnReady)
var self = this;
self.editor = null;
self.bHtml = true;
self.bPlainDirty = false;
self.iBlurTimer = 0;
@ -193,26 +194,11 @@ HtmlEditorWrapper.prototype.plainToHtml = function (sPlain)
.replace(/\r/g, '').replace(/\n/g, '<br />');
};
HtmlEditorWrapper.prototype.fullScreenToggle = function ()
{
$('html').toggleClass('html-editor-wrapper-fullscreen');
$('body').toggleClass('html-editor-wrapper-fullscreen');
this.focus();
};
HtmlEditorWrapper.prototype.initToolbar = function ()
{
var self = this;
// self.$fullscreen = $('<a tabindex="-1" href="jav' + 'ascript:void(0);">fullscreen</a>')
// .addClass('html-editor-wrapper-fullscreen-button')
// .on('click', function () {
// self.fullScreenToggle();
// })
// ;
self.$mode = $('<a tabindex="-1" href="jav' + 'ascript:void(0);">html</a>')
self.$mode = $('<a tabindex="-1" href="jav' + 'ascript:v' + 'oid(0);"></a>')
.addClass('html-editor-wrapper-mode-button')
.on('click', function () {
self.modeToggle(true);
@ -221,7 +207,6 @@ HtmlEditorWrapper.prototype.initToolbar = function ()
self.$toolbar
.append(self.$mode)
// .append(self.$fullscreen)
;
};
@ -318,15 +303,20 @@ HtmlEditorWrapper.prototype.init = function ()
.hide()
;
// self.$html = $('<div></div>')
// .addClass('html-editor-wrapper-html')
// .attr('contenteditable', 'true')
// .on('blur', function() {
// self.blurTrigger();
// })
// .on('focus', function() {
// self.focusTrigger();
// })
// .hide()
// ;
self.$html = $('<div></div>')
.addClass('html-editor-wrapper-html')
.attr('contenteditable', 'true')
.on('blur', function() {
self.blurTrigger();
})
.on('focus', function() {
self.focusTrigger();
})
.hide()
;
@ -350,7 +340,15 @@ HtmlEditorWrapper.prototype.init = function ()
}
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
// self.editor = window.CKEDITOR.appendTo(self.$html[0], oConfig);
self.editor = window.CKEDITOR.inline(self.$html[0], oConfig);
self.editor.on('blur', function() {
self.blurTrigger();
});
self.editor.on('focus', function() {
self.focusTrigger();
});
if (self.fOnReady)
{
@ -364,10 +362,25 @@ HtmlEditorWrapper.prototype.init = function ()
}
};
HtmlEditorWrapper.prototype.toolbarReposition = function ()
{
if (this.bHtml && this.editor && this.editor.focusManager.hasFocus)
{
var oEd = this.editor;
oEd.focusManager.blur(true);
_.delay(function () {
oEd.focusManager.focus();
}, 1);
}
};
HtmlEditorWrapper.prototype.focus = function ()
{
if (this.bHtml) {
this.$html.focus();
if (this.editor) {
this.editor.focusManager.focus();
}
} else {
this.$plain.focus();
}
@ -376,7 +389,9 @@ HtmlEditorWrapper.prototype.focus = function ()
HtmlEditorWrapper.prototype.blur = function ()
{
if (this.bHtml) {
this.$html.blur();
if (this.editor) {
this.editor.focusManager.blur(true);
}
} else {
this.$plain.blur();
}
@ -400,26 +415,28 @@ HtmlEditorWrapper.prototype.modeToggle = function (bFocus)
this.blur();
}
if (this.bHtml) {
this.$html.hide();
if (this.editor)
{
if (this.bHtml)
{
this.$html.hide();
this.$plain.show();
this.$plain
.val(this.htmlToPlain(this.$html.html()))
.show()
;
this.$plain.val(this.htmlToPlain(this.editor.getData()));
this.bHtml = false;
this.bPlainDirty = true;
} else {
this.$plain.hide();
this.bHtml = false;
this.bPlainDirty = true;
}
else
{
this.$plain.hide();
this.$html.show();
this.$html
.html(this.plainToHtml(this.$plain.val()))
.show()
;
this.editor.setData(this.plainToHtml(this.$plain.val()));
this.bHtml = true;
this.bPlainDirty = true;
this.bHtml = true;
this.bPlainDirty = true;
}
}
this.setModeButtonText();

View file

@ -7,6 +7,8 @@ function SettingsIdentities()
{
var oData = RL.data();
this.editor = null;
this.displayName = oData.displayName;
this.signature = oData.signature;
this.signatureToAll = oData.signatureToAll;

View file

@ -6,6 +6,8 @@
function SettingsIdentity()
{
var oData = RL.data();
this.editor = null;
this.displayName = oData.displayName;
this.signature = oData.signature;

View file

@ -77,7 +77,9 @@ html.html-editor-wrapper-fullscreen .html-editor-wrapper-html.styled, html.html-
border-radius: 0;
}
.html-editor-wrapper-html.styled:focus, .html-editor-wrapper-plain.styled:focus {
.html-editor-wrapper-html.styled:focus, .html-editor-wrapper-plain.styled:focus,
.html-editor-wrapper-html.styled.focused, .html-editor-wrapper-plain.styled.focused
{
border: 1px solid #999999;
-webkit-box-shadow: none;
@ -108,13 +110,17 @@ html.html-editor-wrapper-fullscreen .html-editor-wrapper-html.styled, html.html-
.html-editor-wrapper-mode-button, .html-editor-wrapper-fullscreen-button {
position: absolute;
top: 5px;
bottom: 5px;
right: 25px;
z-index: 100;
color: #555;
text-decoration: underline;
font-family: Arial,Helvetica,Tahoma,Verdana,Sans-Serif;
font-size: 12px;
background-color: #fff;
/*background-color: rgba(255, 255, 255, 0.8);*/
padding: 1px 3px;
}
.html-editor-wrapper-mode-button:hover, .html-editor-wrapper-fullscreen-button:hover {

View file

@ -156,6 +156,13 @@ function PopupsComposeViewModel()
}
}, this);
this.emptyToError.subscribe(function (bValue) {
if (this.oEditor && bValue)
{
this.oEditor.toolbarReposition();
}
}, this);
this.canBeSended = ko.computed(function () {
return !this.sending() &&
!this.saving() &&

View file

@ -637,7 +637,7 @@
border-radius: 8px;
}
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
@ -1142,7 +1142,7 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
@charset "UTF-8";
@font-face {
@ -1474,7 +1474,7 @@ table {
.icon-mail:before {
content: "\e062";
}
/** initial setup **/
.nano {
/*
@ -1591,7 +1591,7 @@ table {
.nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4);
}
/* Magnific Popup CSS */
.mfp-bg {
top: 0;
@ -1956,7 +1956,7 @@ img.mfp-img {
right: 0;
padding-top: 0; }
/* overlay at start */
.mfp-fade.mfp-bg {
@ -2002,7 +2002,7 @@ img.mfp-img {
-moz-transform: translateX(50px);
transform: translateX(50px);
}
.simple-pace {
-webkit-pointer-events: none;
pointer-events: none;
@ -2073,7 +2073,7 @@ img.mfp-img {
@keyframes simple-pace-stripe-animation {
0% { transform: none; transform: none; }
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
}
}
.inputosaurus-container {
background-color:#fff;
border:1px solid #bcbec0;
@ -2141,7 +2141,7 @@ img.mfp-img {
box-shadow:none;
}
.inputosaurus-input-hidden { display:none; }
.flag-wrapper {
width: 24px;
height: 16px;
@ -2183,7 +2183,7 @@ img.mfp-img {
.flag.flag-pt-br {background-position: -192px -11px}
.flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix {
*zoom: 1;
@ -8628,7 +8628,9 @@ html.html-editor-wrapper-fullscreen .html-editor-wrapper-plain.styled {
border-radius: 0;
}
.html-editor-wrapper-html.styled:focus,
.html-editor-wrapper-plain.styled:focus {
.html-editor-wrapper-plain.styled:focus,
.html-editor-wrapper-html.styled.focused,
.html-editor-wrapper-plain.styled.focused {
border: 1px solid #999999;
-webkit-box-shadow: none;
-moz-box-shadow: none;
@ -8655,13 +8657,17 @@ html.html-editor-wrapper-fullscreen .html-editor-wrapper-plain.styled {
.html-editor-wrapper-mode-button,
.html-editor-wrapper-fullscreen-button {
position: absolute;
top: 5px;
bottom: 5px;
right: 25px;
z-index: 100;
color: #555;
text-decoration: underline;
font-family: Arial, Helvetica, Tahoma, Verdana, Sans-Serif;
font-size: 12px;
background-color: #fff;
/*background-color: rgba(255, 255, 255, 0.8);*/
padding: 1px 3px;
}
.html-editor-wrapper-mode-button:hover,
.html-editor-wrapper-fullscreen-button:hover {

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?AdminApp}
*/
var RL = null;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -176,12 +176,14 @@ Globals.oHtmlEditorDefaultConfig = {
],
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,Indent,Outdent',
'removeDialogTabs': 'link:advanced;link:target;image:advanced',
'allowedContent': false,
'autoParagraph': false,
'enterMode': window.CKEDITOR.ENTER_BR,
'shiftEnterMode': window.CKEDITOR.ENTER_P,
// 'enterMode': window.CKEDITOR.ENTER_BR,
// 'shiftEnterMode': window.CKEDITOR.ENTER_P,
'enterMode': window.CKEDITOR.ENTER_DIV,
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
// 'floatSpaceDockedOffsetY': 1,
'font_defaultLabel': 'Arial',
@ -219,7 +221,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -337,7 +339,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -681,7 +683,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -2262,7 +2264,7 @@ Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
return aResult;
};
};
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2425,7 +2427,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -3047,7 +3049,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3345,7 +3347,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3439,7 +3441,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
/**
* @constructor
*/
@ -3513,7 +3515,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -3585,7 +3587,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -3628,7 +3630,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -3641,7 +3643,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -3701,7 +3703,7 @@ KnoinAbstractViewModel.prototype.viewModelPosition = function ()
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
{
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -3777,7 +3779,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -4166,7 +4168,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -4530,7 +4532,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -4762,7 +4764,7 @@ PopupsDomainViewModel.prototype.clearForm = function ()
this.smtpAuth(true);
this.whiteList('');
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -4899,7 +4901,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5015,7 +5017,7 @@ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
{
var sValue = this.key();
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5089,7 +5091,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5207,7 +5209,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5294,7 +5296,7 @@ AdminLoginViewModel.prototype.onHide = function ()
{
this.loginFocus(false);
};
/**
* @param {?} oScreen
*
@ -5316,7 +5318,7 @@ AdminMenuViewModel.prototype.link = function (sRoute)
{
return '#/' + sRoute;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5338,7 +5340,7 @@ AdminPaneViewModel.prototype.logoutClick = function ()
RL.remote().adminLogout(function () {
RL.loginAndLogoutReload();
});
};
};
/**
* @constructor
*/
@ -5438,7 +5440,7 @@ AdminGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -5490,7 +5492,7 @@ AdminLogin.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5559,7 +5561,7 @@ AdminBranding.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5779,7 +5781,7 @@ AdminContacts.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5868,7 +5870,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
{
RL.reloadDomainList();
};
/**
* @constructor
*/
@ -5956,7 +5958,7 @@ AdminSecurity.prototype.phpInfoLink = function ()
{
return RL.link().phpInfo();
};
/**
* @constructor
*/
@ -6072,7 +6074,7 @@ AdminSocial.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6169,7 +6171,7 @@ AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
RL.reloadPluginList();
};
/**
* @constructor
*/
@ -6273,7 +6275,7 @@ AdminPackages.prototype.installPackage = function (oPackage)
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
}
};
/**
* @constructor
*/
@ -6324,7 +6326,7 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
{
var oDate = moment.unix(this.licenseExpired());
return oDate.format('LL') + ' (' + oDate.from(moment()) + ')';
};
};
/**
* @constructor
*/
@ -6399,7 +6401,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -6433,7 +6435,7 @@ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
AdminDataStorage.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart.call(this);
};
};
/**
* @constructor
*/
@ -6707,7 +6709,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -6951,7 +6953,7 @@ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPing');
};
/**
* @constructor
*/
@ -7017,7 +7019,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -7028,7 +7030,7 @@ function AdminCacheStorage()
}
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
/**
* @param {Array} aViewModels
* @constructor
@ -7206,7 +7208,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -7221,7 +7223,7 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends AbstractSettings
@ -7241,7 +7243,7 @@ AdminSettingsScreen.prototype.onShow = function ()
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -7557,7 +7559,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -7796,7 +7798,7 @@ AdminApp.prototype.bootstart = function ()
* @type {AdminApp}
*/
RL = new AdminApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -7843,9 +7845,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, _));

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) {
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) {
'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?RainLoopApp}
*/
var RL = null;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -176,12 +176,14 @@ Globals.oHtmlEditorDefaultConfig = {
],
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,Indent,Outdent',
'removeDialogTabs': 'link:advanced;link:target;image:advanced',
'allowedContent': false,
'autoParagraph': false,
'enterMode': window.CKEDITOR.ENTER_BR,
'shiftEnterMode': window.CKEDITOR.ENTER_P,
// 'enterMode': window.CKEDITOR.ENTER_BR,
// 'shiftEnterMode': window.CKEDITOR.ENTER_P,
'enterMode': window.CKEDITOR.ENTER_DIV,
'shiftEnterMode': window.CKEDITOR.ENTER_BR,
// 'floatSpaceDockedOffsetY': 1,
'font_defaultLabel': 'Arial',
@ -219,7 +221,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -337,7 +339,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -681,7 +683,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -2262,7 +2264,7 @@ Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
return aResult;
};
};
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2425,7 +2427,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -3047,7 +3049,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3345,7 +3347,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3439,12 +3441,13 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
function HtmlEditorWrapper(oElement, fOnBlur, fOnReady)
{
var self = this;
self.editor = null;
self.bHtml = true;
self.bPlainDirty = false;
self.iBlurTimer = 0;
@ -3628,26 +3631,11 @@ HtmlEditorWrapper.prototype.plainToHtml = function (sPlain)
.replace(/\r/g, '').replace(/\n/g, '<br />');
};
HtmlEditorWrapper.prototype.fullScreenToggle = function ()
{
$('html').toggleClass('html-editor-wrapper-fullscreen');
$('body').toggleClass('html-editor-wrapper-fullscreen');
this.focus();
};
HtmlEditorWrapper.prototype.initToolbar = function ()
{
var self = this;
// self.$fullscreen = $('<a tabindex="-1" href="jav' + 'ascript:void(0);">fullscreen</a>')
// .addClass('html-editor-wrapper-fullscreen-button')
// .on('click', function () {
// self.fullScreenToggle();
// })
// ;
self.$mode = $('<a tabindex="-1" href="jav' + 'ascript:void(0);">html</a>')
self.$mode = $('<a tabindex="-1" href="jav' + 'ascript:v' + 'oid(0);"></a>')
.addClass('html-editor-wrapper-mode-button')
.on('click', function () {
self.modeToggle(true);
@ -3656,7 +3644,6 @@ HtmlEditorWrapper.prototype.initToolbar = function ()
self.$toolbar
.append(self.$mode)
// .append(self.$fullscreen)
;
};
@ -3753,15 +3740,20 @@ HtmlEditorWrapper.prototype.init = function ()
.hide()
;
// self.$html = $('<div></div>')
// .addClass('html-editor-wrapper-html')
// .attr('contenteditable', 'true')
// .on('blur', function() {
// self.blurTrigger();
// })
// .on('focus', function() {
// self.focusTrigger();
// })
// .hide()
// ;
self.$html = $('<div></div>')
.addClass('html-editor-wrapper-html')
.attr('contenteditable', 'true')
.on('blur', function() {
self.blurTrigger();
})
.on('focus', function() {
self.focusTrigger();
})
.hide()
;
@ -3785,7 +3777,15 @@ HtmlEditorWrapper.prototype.init = function ()
}
oConfig.language = Globals.oHtmlEditorLangsMap[sLanguage] || 'en';
// self.editor = window.CKEDITOR.appendTo(self.$html[0], oConfig);
self.editor = window.CKEDITOR.inline(self.$html[0], oConfig);
self.editor.on('blur', function() {
self.blurTrigger();
});
self.editor.on('focus', function() {
self.focusTrigger();
});
if (self.fOnReady)
{
@ -3799,10 +3799,25 @@ HtmlEditorWrapper.prototype.init = function ()
}
};
HtmlEditorWrapper.prototype.toolbarReposition = function ()
{
if (this.bHtml && this.editor && this.editor.focusManager.hasFocus)
{
var oEd = this.editor;
oEd.focusManager.blur(true);
_.delay(function () {
oEd.focusManager.focus();
}, 1);
}
};
HtmlEditorWrapper.prototype.focus = function ()
{
if (this.bHtml) {
this.$html.focus();
if (this.editor) {
this.editor.focusManager.focus();
}
} else {
this.$plain.focus();
}
@ -3811,7 +3826,9 @@ HtmlEditorWrapper.prototype.focus = function ()
HtmlEditorWrapper.prototype.blur = function ()
{
if (this.bHtml) {
this.$html.blur();
if (this.editor) {
this.editor.focusManager.blur(true);
}
} else {
this.$plain.blur();
}
@ -3835,26 +3852,28 @@ HtmlEditorWrapper.prototype.modeToggle = function (bFocus)
this.blur();
}
if (this.bHtml) {
this.$html.hide();
if (this.editor)
{
if (this.bHtml)
{
this.$html.hide();
this.$plain.show();
this.$plain
.val(this.htmlToPlain(this.$html.html()))
.show()
;
this.$plain.val(this.htmlToPlain(this.editor.getData()));
this.bHtml = false;
this.bPlainDirty = true;
} else {
this.$plain.hide();
this.bHtml = false;
this.bPlainDirty = true;
}
else
{
this.$plain.hide();
this.$html.show();
this.$html
.html(this.plainToHtml(this.$plain.val()))
.show()
;
this.editor.setData(this.plainToHtml(this.$plain.val()));
this.bHtml = true;
this.bPlainDirty = true;
this.bHtml = true;
this.bPlainDirty = true;
}
}
this.setModeButtonText();
@ -3866,7 +3885,7 @@ HtmlEditorWrapper.prototype.modeToggle = function (bFocus)
this.blurTrigger();
};
/**
* @constructor
* @param {koProperty} oKoList
@ -4407,7 +4426,7 @@ Selector.prototype.on = function (sEventName, fCallback)
{
this.oCallbacks[sEventName] = fCallback;
};
/**
* @constructor
*/
@ -4481,7 +4500,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4553,7 +4572,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4596,7 +4615,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -4609,7 +4628,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -4669,7 +4688,7 @@ KnoinAbstractViewModel.prototype.viewModelPosition = function ()
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
{
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -4745,7 +4764,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -5134,7 +5153,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -5498,7 +5517,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
*/
@ -5620,7 +5639,7 @@ ContactModel.prototype.lineAsCcc = function ()
return aResult.join(' ');
};
/**
* @param {number=} iType = Enums.ContactPropertyType.Unknown
* @param {string=} sValue = ''
@ -5642,7 +5661,7 @@ function ContactPropertyModel(iType, sValue, bFocused, sPlaceholder)
return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
}, this);
}
/**
* @constructor
*/
@ -5878,7 +5897,7 @@ AttachmentModel.prototype.iconClass = function ()
return sClass;
};
/**
* @constructor
* @param {string} sId
@ -5939,7 +5958,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
}
return bResult;
};
};
/**
* @constructor
*/
@ -6917,7 +6936,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
Utils.windowResize(500);
}
};
/**
* @constructor
*/
@ -7251,7 +7270,7 @@ FolderModel.prototype.printableFullName = function ()
{
return this.fullName.split(this.delimiter).join(' / ');
};
/**
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
@ -7272,7 +7291,7 @@ AccountModel.prototype.email = '';
AccountModel.prototype.changeAccountLink = function ()
{
return RL.link().change(this.email);
};
};
/**
* @param {string} sId
* @param {string} sEmail
@ -7308,7 +7327,7 @@ IdentityModel.prototype.formattedNameForEmail = function ()
var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7418,7 +7437,7 @@ PopupsFolderClearViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7542,7 +7561,7 @@ PopupsFolderCreateViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7661,7 +7680,7 @@ PopupsFolderSystemViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7818,6 +7837,13 @@ function PopupsComposeViewModel()
}
}, this);
this.emptyToError.subscribe(function (bValue) {
if (this.oEditor && bValue)
{
this.oEditor.toolbarReposition();
}
}, this);
this.canBeSended = ko.computed(function () {
return !this.sending() &&
!this.saving() &&
@ -9142,7 +9168,7 @@ PopupsComposeViewModel.prototype.triggerForResize = function ()
this.resizer(!this.resizer());
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -9782,7 +9808,7 @@ PopupsContactsViewModel.prototype.onHide = function ()
oItem.checked(false);
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -9926,7 +9952,7 @@ PopupsAdvancedSearchViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10054,7 +10080,7 @@ PopupsAddAccountViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10216,7 +10242,7 @@ PopupsIdentityViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10290,7 +10316,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10408,7 +10434,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10471,7 +10497,7 @@ PopupsPgpKey.prototype.onShow = function (bPrivate, fCallback)
this.bPrivate = bPrivate;
this.fCallback = fCallback;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10743,7 +10769,7 @@ LoginViewModel.prototype.selectLanguage = function ()
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10810,7 +10836,7 @@ AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
});
};
};
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -10822,7 +10848,7 @@ function MailBoxSystemDropDownViewModel()
}
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -10834,7 +10860,7 @@ function SettingsSystemDropDownViewModel()
}
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10964,7 +10990,7 @@ MailBoxFolderListViewModel.prototype.contactsClick = function ()
kn.showScreenPopup(PopupsContactsViewModel);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11883,7 +11909,7 @@ MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
;
return !!oJua;
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12276,7 +12302,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
};
/**
* @param {?} oScreen
*
@ -12303,7 +12329,7 @@ SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12326,7 +12352,7 @@ SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
*/
@ -12486,7 +12512,7 @@ SettingsGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -12524,7 +12550,7 @@ SettingsContacts.prototype.onShow = function ()
{
this.showPassword(false);
};
/**
* @constructor
*/
@ -12605,13 +12631,15 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
}
}
};
/**
* @constructor
*/
function SettingsIdentity()
{
var oData = RL.data();
this.editor = null;
this.displayName = oData.displayName;
this.signature = oData.signature;
@ -12708,7 +12736,7 @@ SettingsIdentity.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -12716,6 +12744,8 @@ function SettingsIdentities()
{
var oData = RL.data();
this.editor = null;
this.displayName = oData.displayName;
this.signature = oData.signature;
this.signatureToAll = oData.signatureToAll;
@ -12881,7 +12911,7 @@ SettingsIdentities.prototype.onBuild = function (oDom)
});
}, 50);
};
};
/**
* @constructor
*/
@ -12948,7 +12978,7 @@ function SettingsSocialScreen()
}
Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
/**
* @constructor
*/
@ -13012,7 +13042,7 @@ SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sRes
this.passwordUpdateError(true);
}
};
/**
* @constructor
*/
@ -13207,7 +13237,7 @@ SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
oFolder.subScribed(false);
};
/**
* @constructor
*/
@ -13424,7 +13454,7 @@ SettingsThemes.prototype.initCustomThemeUploader = function ()
return false;
};
/**
* @constructor
*/
@ -13499,7 +13529,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -14532,7 +14562,7 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
));
}
};
/**
* @constructor
*/
@ -14806,7 +14836,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -15506,7 +15536,7 @@ WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
this.defaultRequest(fCallback, 'SocialUsers');
};
/**
* @constructor
*/
@ -15572,7 +15602,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -15890,7 +15920,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function
this.setMessageFlagsToCache(sFolder, sUid, aFlags);
}
};
/**
* @param {Array} aViewModels
* @constructor
@ -16068,7 +16098,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -16083,7 +16113,7 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -16264,7 +16294,7 @@ MailBoxScreen.prototype.routes = function ()
[/^([^\/]*)$/, {'normalize_': fNormS}]
];
};
/**
* @constructor
* @extends AbstractSettings
@ -16292,7 +16322,7 @@ SettingsScreen.prototype.onShow = function ()
RL.setTitle(this.sSettingsTitle);
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -16608,7 +16638,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -17549,7 +17579,7 @@ RainLoopApp.prototype.bootstart = function ()
* @type {RainLoopApp}
*/
RL = new RainLoopApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -17596,9 +17626,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long