Composer fixes

This commit is contained in:
RainLoop Team 2015-04-16 21:55:13 +04:00
parent 01e1c770ea
commit b062e9b190
9 changed files with 86 additions and 61 deletions

View file

@ -22,6 +22,7 @@
'Sheet': 'sheet',
'Presentation': 'presentation',
'Certificate': 'certificate',
'CertificateBin': 'certificate-bin',
'Archive': 'archive'
};

View file

@ -32,7 +32,6 @@
this.resize = _.throttle(_.bind(this.resize, this), 100);
this.__inited = false;
this.__initedData = null;
this.init();
}
@ -206,10 +205,6 @@
this.focus();
}
}
else
{
this.__initedData = [true, sHtml, bFocus];
}
};
HtmlEditor.prototype.setPlain = function (sPlain, bFocus)
@ -233,10 +228,6 @@
this.focus();
}
}
else
{
this.__initedData = [false, sPlain, bFocus];
}
};
HtmlEditor.prototype.init = function ()
@ -318,37 +309,29 @@
self.focusTrigger();
});
if (self.fOnReady)
{
self.editor.on('instanceReady', function () {
self.editor.on('instanceReady', function () {
if (self.editor.removeMenuItem)
{
self.editor.removeMenuItem('cut');
self.editor.removeMenuItem('copy');
self.editor.removeMenuItem('paste');
}
if (self.editor.removeMenuItem)
{
self.editor.removeMenuItem('cut');
self.editor.removeMenuItem('copy');
self.editor.removeMenuItem('paste');
}
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
self.editor.setKeystroke(window.CKEDITOR.CTRL + 65 /* A */, 'selectAll');
self.__resizable = true;
self.__inited = true;
self.resize();
if (self.fOnReady)
{
self.fOnReady();
self.__resizable = true;
self.__inited = true;
self.resize();
if (self.__initedData)
{
if (self.__initedData[0])
{
self.setHtml(self.__initedData[1], self.__initedData[2]);
}
else
{
self.setPlain(self.__initedData[1], self.__initedData[2]);
}
}
});
}
}
});
}
;

29
dev/External/ko.js vendored
View file

@ -24,32 +24,41 @@
'init': function (oElement, fValueAccessor) {
var
fValue = fValueAccessor(),
oEditor = null,
fValue = fValueAccessor(),
fUpdateEditorValue = function () {
if (oEditor)
if (fValue && fValue.__editor)
{
oEditor.setHtmlOrPlain(fValue());
fValue.__editor.setHtmlOrPlain(fValue());
}
},
fUpdateKoValue = function () {
if (oEditor && oEditor.__inited)
if (fValue && fValue.__editor)
{
fValue(oEditor.getDataWithHtmlMark());
fValue(fValue.__editor.getDataWithHtmlMark());
}
},
fOnReady = function () {
fValue.__editor = oEditor;
fUpdateEditorValue();
},
HtmlEditor = require('Common/HtmlEditor')
;
if (fValue)
if (ko.isObservable(fValue) && HtmlEditor)
{
oEditor = new HtmlEditor(oElement, fUpdateKoValue, fUpdateEditorValue, fUpdateKoValue);
fValue.__editor = oEditor;
oEditor = new HtmlEditor(oElement, fUpdateKoValue, fOnReady, fUpdateKoValue);
fValue.__fetchEditorValue = fUpdateKoValue;
fValue.__updateEditorValue = fUpdateEditorValue;
fValue.subscribe(fUpdateEditorValue);
fUpdateEditorValue();
// ko.utils.domNodeDisposal.addDisposeCallback(oElement, function () {
// });
}
}
};

View file

@ -189,7 +189,8 @@
*/
AttachmentModel.prototype.hasPreview = function ()
{
return this.isImage() || (this.isPdf() && Globals.bAllowPdfPreview) || this.isText() || this.isFramed();
return this.isImage() || (this.isPdf() && Globals.bAllowPdfPreview) ||
this.isText() || this.isFramed();
};
/**
@ -370,12 +371,17 @@
sResult = Enums.FileType.Pdf;
break;
case -1 < Utils.inArray(sMimeType, [
'application/pgp-signature', 'application/pkcs7-signature', 'application/pgp-keys'
'application/pgp-signature', 'application/pgp-keys'
]) || -1 < Utils.inArray(sExt, [
'asc', 'pem', 'ppk'
]):
sResult = Enums.FileType.Certificate;
break;
case -1 < Utils.inArray(sMimeType, ['application/pkcs7-signature']) ||
-1 < Utils.inArray(sExt, ['p7s']):
sResult = Enums.FileType.CertificateBin;
break;
case -1 < Utils.inArray(aMimeTypeParts[1], [
'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
'vnd.openxmlformats-officedocument.wordprocessingml.template',
@ -447,6 +453,7 @@
sClass = 'icon-file-zip';
break;
case Enums.FileType.Certificate:
case Enums.FileType.CertificateBin:
sClass = 'icon-file-certificate';
break;
case Enums.FileType.Sheet:
@ -509,6 +516,7 @@
sClass = 'icon-file-zip';
break;
case Enums.FileType.Certificate:
case Enums.FileType.CertificateBin:
sClass = 'icon-file-certificate';
break;
case Enums.FileType.Sheet:

View file

@ -87,7 +87,6 @@
{
if (oData.Result)
{
this.formHidden(true);
require('App/Admin').loginAndLogoutReload(true);
}
else if (oData.ErrorCode)

View file

@ -1,4 +1,6 @@
/* global require, module */
(function () {
'use strict';

View file

@ -213,12 +213,10 @@
}
else if (oData.Admin)
{
this.formHidden(true);
require('App/User').redirectToAdminPanel();
}
else
{
this.formHidden(true);
require('App/User').loginAndLogoutReload(false);
}
}
@ -382,8 +380,6 @@
if (0 === iErrorCode)
{
self.submitRequest(true);
self.formHidden(true);
require('App/User').loginAndLogoutReload(false);
}
else