Many fixes

New ownCloud package with a built-in webmail
This commit is contained in:
RainLoop Team 2015-02-12 01:39:27 +04:00
parent 323dd34c8b
commit 6116597f6f
56 changed files with 1137 additions and 232 deletions

View file

@ -80,7 +80,7 @@
this.bFromDraft = false;
this.sReferences = '';
this.triggerForResize = _.bind(this.triggerForResize, this);
this.resizerTrigger = _.bind(this.resizerTrigger, this);
this.allowContacts = !!AppStore.contactsIsAllowed();
@ -90,8 +90,6 @@
this.capaOpenPGP = PgpStore.capaOpenPGP;
this.resizer = ko.observable(false).extend({'throttle': 50});
this.identitiesDropdownTrigger = ko.observable(false);
this.to = ko.observable('');
@ -241,11 +239,13 @@
}
}, this);
this.editorResizeThrottle = _.throttle(_.bind(this.editorResize, this), 100);
this.resizer = ko.observable(false).extend({'throttle': 50});
this.resizer.subscribe(function () {
this.editorResizeThrottle();
}, this);
this.resizer.subscribe(_.bind(function () {
if (this.oEditor){
this.oEditor.resize();
}
}, this));
this.canBeSendedOrSaved = ko.computed(function () {
return !this.sending() && !this.saving();
@ -429,9 +429,9 @@
}
}, this);
this.showCc.subscribe(this.triggerForResize);
this.showBcc.subscribe(this.triggerForResize);
this.showReplyTo.subscribe(this.triggerForResize);
this.showCc.subscribe(this.resizerTrigger);
this.showBcc.subscribe(this.resizerTrigger);
this.showReplyTo.subscribe(this.resizerTrigger);
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
@ -1230,7 +1230,7 @@
this.currentIdentity(oIdentity);
}
this.triggerForResize();
this.resizerTrigger();
};
ComposePopupView.prototype.onFocus = function ()
@ -1244,15 +1244,7 @@
this.oEditor.focus();
}
this.triggerForResize();
};
ComposePopupView.prototype.editorResize = function ()
{
if (this.oEditor)
{
this.oEditor.resize();
}
this.resizerTrigger();
};
ComposePopupView.prototype.tryToClosePopup = function ()
@ -1315,7 +1307,7 @@
return false;
});
Globals.$win.on('resize', self.triggerForResize);
Events.sub('window.resize.real', this.resizerTrigger);
if (this.dropboxEnabled())
{
@ -2034,10 +2026,9 @@
});
};
ComposePopupView.prototype.triggerForResize = function ()
ComposePopupView.prototype.resizerTrigger = function ()
{
this.resizer(!this.resizer());
this.editorResizeThrottle();
};
module.exports = ComposePopupView;

View file

@ -36,6 +36,7 @@
this.name.focus = ko.observable(false);
this.body = ko.observable('');
this.body.loading = ko.observable(false);
this.body.error = ko.observable(false);
this.name.subscribe(function () {
@ -51,6 +52,8 @@
this.addTemplateCommand = Utils.createCommand(this, function () {
this.populateBodyFromEditor();
this.name.error('' === Utils.trim(this.name()));
this.body.error('' === Utils.trim(this.body()) ||
':HTML:' === Utils.trim(this.body()));
@ -109,40 +112,52 @@
this.submitRequest(false);
this.submitError('');
if (this.editor)
{
this.setBody('');
}
};
TemplatePopupView.prototype.setBody = function (sBody)
{
if (this.editor)
{
if (':HTML:' === sBody.substr(0, 6))
{
this.editor.setHtml(sBody.substr(6), false);
}
else
{
this.editor.setPlain(sBody, false);
}
}
};
TemplatePopupView.prototype.populateBodyFromEditor = function ()
{
if (this.editor)
{
this.body(
(this.editor.isHtml() ? ':HTML:' : '') + this.editor.getData()
);
}
};
TemplatePopupView.prototype.editorSetBody = function (sBody)
{
var
self = this,
fEditorSetData = function (sBody) {
if (self.editor)
{
if (':HTML:' === sBody.substr(0, 6))
{
self.editor.setHtml(sBody.substr(6), false);
}
else
{
self.editor.setPlain(sBody, false);
}
}
}
;
if (!this.editor && this.signatureDom())
{
var self = this;
this.editor = new HtmlEditor(self.signatureDom(), function () {
self.body(
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
);
self.populateBodyFromEditor();
}, function () {
fEditorSetData(sBody);
self.setBody(sBody);
});
}
else if (this.editor)
else
{
fEditorSetData(sBody);
this.setBody(sBody);
}
};
@ -156,16 +171,44 @@
{
this.id(oTemplate.id);
this.name(oTemplate.name);
this.body(oTemplate.body);
this.body.loading(true);
if (oTemplate.populated)
{
self.editorSetBody(this.body());
}
else
{
this.body.loading(true);
self.body.error(false);
Remote.templateGetById(function () {
Remote.templateGetById(function (sResult, oData) {
self.body.loading(false);
self.body.loading(false);
self.editorSetBody('');
if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
'Object/Template' === oData.Result['@Object'] && Utils.isNormal(oData.Result['Body']))
{
oTemplate.body = oData.Result['Body'];
oTemplate.populated = true;
}, this.id());
self.body(oTemplate.body);
self.body.error(false);
}
else
{
self.body('');
self.body.error(true);
}
self.editorSetBody(self.body());
}, this.id());
}
}
else
{
self.editorSetBody('');
}
};

View file

@ -423,11 +423,11 @@
this.showFullInfo.subscribe(fCheckHeaderHeight);
this.message.subscribe(fCheckHeaderHeight);
Globals.$win.on('resize', function () {
Events.sub('window.resize', _.throttle(function () {
_.delay(fCheckHeaderHeight, 1);
_.delay(fCheckHeaderHeight, 200);
_.delay(fCheckHeaderHeight, 500);
});
}, 50));
this.showFullInfo.subscribe(function () {
Utils.windowResize();