Commit 80188b47 authored by Alexander.Trofimov's avatar Alexander.Trofimov

before build concate files with closure sdk-all.

parent 5803f73e
......@@ -68,56 +68,95 @@ module.exports = function(grunt) {
grunt.registerTask('build_all', ['build_webword_init', 'build_sdk', 'build_webexcel_init', 'build_sdk', 'build_webpowerpoint_init', 'build_sdk']);
grunt.registerTask('compile_sdk_init', function(compilation_level) {
var splitLine = '';
var tmp_sdk_path = 'sdk-js-tmp.js';
var sdkDstFolder = packageFile['compile']['sdk']['dst'];
var sdkAllMinDst = sdkDstFolder + '/sdk-all-min.js';
var sdkAllDst = sdkDstFolder + '/sdk-all.js';
var concat_src = [sdkAllDst];
var srcFiles = packageFile['compile']['sdk']['common'];
grunt.registerTask('concat_sdk_init', function() {
var sdkTmp = 'sdk-tmp.js', sdkAllTmp = 'sdk-all-tmp.js', sdkAllMinTmp = 'sdk-all-min-tmp.js';
var srcFilesAll = packageFile['compile']['sdk']['common'];
var sdkOpt = {
compilation_level: compilation_level,
compilation_level: 'WHITESPACE_ONLY',
warning_level: 'QUIET',
externs: packageFile['compile']['sdk']['externs']
};
if (formatting) {
sdkOpt['formatting'] = formatting;
}
if ('ADVANCED' === compilation_level) {
splitLine = ('PRETTY_PRINT' === formatting) ? 'window.split = "split";' : 'window.split="split";';
} else {
splitLine = ('PRETTY_PRINT' === formatting) ? 'window["split"] = "split";' : 'window["split"]="split";';
}
if (grunt.option('mobile')) {
var excludeFiles = packageFile['compile']['sdk']['exclude_mobile']
srcFiles = srcFiles.filter(function(item) {
srcFilesAll = srcFilesAll.filter(function(item) {
return -1 === excludeFiles.indexOf(item);
});
var mobileFiles = packageFile['compile']['sdk']['mobile'];
if(mobileFiles){
srcFiles = srcFiles.concat(mobileFiles);
srcFilesAll = srcFilesAll.concat(mobileFiles);
}
}
if (!grunt.option('noprivate')) {
srcFiles = srcFiles.concat(packageFile['compile']['sdk']['private']);
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['private']);
}
if (grunt.option('desktop')) {
srcFiles = srcFiles.concat(packageFile['compile']['sdk']['desktop']);
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['desktop']);
}
if (grunt.option('builder')) {
srcFiles = srcFiles.concat(packageFile['compile']['sdk']['builder']);
srcFilesAll = srcFilesAll.concat(packageFile['compile']['sdk']['builder']);
}
grunt.initConfig({
concat: {
sdkmin: {
options: {
// banner: '(function(window, undefined) {',
// footer: '})(window);window["split"]="split";'
banner: '',
footer: 'window["split"]="split";'
},
src: packageFile['compile']['sdk']['min'],
dest: sdkAllMinTmp
},
sdk: {
options: {
banner: '(function(window, undefined) {',
footer: '})(window);'
},
src: srcFilesAll,
dest: sdkAllTmp
},
all: {
src: [sdkAllMinTmp, sdkAllTmp],
dest: sdkTmp
}
},
clean: [
sdkAllMinTmp,
sdkAllTmp
]
});
});
grunt.registerTask('compile_sdk_init', function(compilation_level) {
var sdkTmp = 'sdk-tmp.js'
var splitLine = '';
var tmp_sdk_path = 'sdk-js-tmp.js';
var sdkDstFolder = packageFile['compile']['sdk']['dst'];
var sdkAllMinDst = sdkDstFolder + '/sdk-all-min.js';
var sdkAllDst = sdkDstFolder + '/sdk-all.js';
var sdkOpt = {
compilation_level: compilation_level,
warning_level: 'QUIET',
externs: packageFile['compile']['sdk']['externs']
};
if (formatting) {
sdkOpt['formatting'] = formatting;
}
if ('ADVANCED' === compilation_level) {
splitLine = ('PRETTY_PRINT' === formatting) ? 'window.split = "split";' : 'window.split="split";';
} else {
splitLine = ('PRETTY_PRINT' === formatting) ? 'window["split"] = "split";' : 'window["split"]="split";';
}
grunt.initConfig({
pkg: packageFile,
'closure-compiler': {
sdk: {
options: sdkOpt,
dest: tmp_sdk_path,
src: srcFiles
src: [sdkTmp]
}
},
splitfile: {
......@@ -136,15 +175,12 @@ module.exports = function(grunt) {
dest: sdkAllMinDst
},
sdk: {
options: {
banner: '<%= grunt.file.read("license.js") %>' + '\n(function(window, undefined) {',
footer: '})(window);'
},
src: concat_src,
src: ['license.js', sdkAllDst],
dest: sdkAllDst
}
},
clean: [
sdkTmp,
tmp_sdk_path
],
replace: {
......@@ -163,6 +199,7 @@ module.exports = function(grunt) {
});
});
grunt.registerTask('compile_sdk', ['compile_sdk_init:' + level, 'closure-compiler', 'splitfile', 'concat', 'replace', 'clean']);
grunt.registerTask('concat_sdk', ['concat_sdk_init', 'concat', 'clean']);
grunt.registerTask('compile_sdk', ['concat_sdk', 'compile_sdk_init:' + level, 'closure-compiler', 'splitfile', 'concat', 'replace', 'clean']);
grunt.registerTask('default', ['build_webpowerpoint']);
};
\ No newline at end of file
{
"compile": {
"sdk": {
"common": [
"min": [
"../common/browser.js",
"../common/commonDefines.js",
"../common/docscoapicommon.js",
......@@ -15,8 +15,9 @@
"../cell/model/CollaborativeEditing.js",
"../common/apiBase.js",
"../common/Private/license.js",
"../cell/api.js",
"../cell/api.js"
],
"common": [
"../common/downloaderfiles.js",
"../common/NumFormat.js",
"../common/SerializeChart.js",
......
{
"compile": {
"sdk": {
"min": [
],
"common": [
"../common/browser.js",
"../common/commonDefines.js",
......
{
"compile": {
"sdk": {
"common": [
"min": [
"../common/browser.js",
"../common/commonDefines.js",
"../common/docscoapicommon.js",
......@@ -17,8 +17,9 @@
"../word/Editor/CollaborativeEditing.js",
"../common/apiBase.js",
"../common/Private/license.js",
"../word/api.js",
"../word/api.js"
],
"common": [
"../common/downloaderfiles.js",
"../common/NumFormat.js",
"../common/SerializeChart.js",
......
......@@ -3549,5 +3549,3 @@ var editor;
prot['asc_isOffline'] = prot.asc_isOffline;
prot['asc_getUrlType'] = prot.asc_getUrlType;
})(window);
// don't delete this line!!! This line used for split minimize files
window['split']='split';
......@@ -5735,6 +5735,3 @@ CTextProp.prototype['get_VertAlign'] = CTextProp.prototype.get_VertAlign;
CTextProp.prototype['get_HighLight'] = CTextProp.prototype.get_HighLight;
CParagraphAndTextProp.prototype['get_ParaPr'] = CParagraphAndTextProp.prototype.get_ParaPr;
CParagraphAndTextProp.prototype['get_TextPr'] = CParagraphAndTextProp.prototype.get_TextPr;
// don't delete this line!!! This line used for split minimize files
window['split']='split';
"use strict";
// Import
var History = AscCommon.History;
/**
*
* @constructor
......@@ -28,18 +25,18 @@ CWordCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Addition
this.Refresh_DCChanges();
// Генерируем свои изменения
var StartPoint = ( null === History.SavedIndex ? 0 : History.SavedIndex + 1 );
var StartPoint = ( null === AscCommon.History.SavedIndex ? 0 : AscCommon.History.SavedIndex + 1 );
var LastPoint = -1;
if (this.m_nUseType <= 0)
{
// (ненужные точки предварительно удаляем)
History.Clear_Redo();
LastPoint = History.Points.length - 1;
AscCommon.History.Clear_Redo();
LastPoint = AscCommon.History.Points.length - 1;
}
else
{
LastPoint = History.Index;
LastPoint = AscCommon.History.Index;
}
// Просчитаем сколько изменений на сервер пересылать не надо
......@@ -47,16 +44,16 @@ CWordCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Addition
var StartPoint2 = Math.min(StartPoint, LastPoint + 1);
for (var PointIndex = 0; PointIndex < StartPoint2; PointIndex++)
{
var Point = History.Points[PointIndex];
var Point = AscCommon.History.Points[PointIndex];
SumIndex += Point.Items.length;
}
var deleteIndex = ( null === History.SavedIndex ? null : SumIndex );
var deleteIndex = ( null === AscCommon.History.SavedIndex ? null : SumIndex );
var aChanges = [];
for (var PointIndex = StartPoint; PointIndex <= LastPoint; PointIndex++)
{
var Point = History.Points[PointIndex];
History.Update_PointInfoItem(PointIndex, StartPoint, LastPoint, SumIndex, deleteIndex);
var Point = AscCommon.History.Points[PointIndex];
AscCommon.History.Update_PointInfoItem(PointIndex, StartPoint, LastPoint, SumIndex, deleteIndex);
for (var Index = 0; Index < Point.Items.length; Index++)
{
......@@ -80,31 +77,31 @@ CWordCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Addition
this.m_aNeedUnlock.length = 0;
this.m_aNeedUnlock2.length = 0;
var deleteIndex = ( null === History.SavedIndex ? null : SumIndex );
var deleteIndex = ( null === AscCommon.History.SavedIndex ? null : SumIndex );
if (0 < aChanges.length || null !== deleteIndex) {
editor.CoAuthoringApi.saveChanges(aChanges, deleteIndex, AdditionalInfo);
History.CanNotAddChanges = true;
AscCommon.History.CanNotAddChanges = true;
} else
editor.CoAuthoringApi.unLockDocument(true);
if (-1 === this.m_nUseType)
{
// Чистим Undo/Redo только во время совместного редактирования
History.Clear();
History.SavedIndex = null;
AscCommon.History.Clear();
AscCommon.History.SavedIndex = null;
}
else if (0 === this.m_nUseType)
{
// Чистим Undo/Redo только во время совместного редактирования
History.Clear();
History.SavedIndex = null;
AscCommon.History.Clear();
AscCommon.History.SavedIndex = null;
this.m_nUseType = 1;
}
else
{
// Обновляем точку последнего сохранения в истории
History.Reset_SavedIndex(IsUserSave);
AscCommon.History.Reset_SavedIndex(IsUserSave);
}
if (false !== IsUpdateInterface)
......@@ -283,7 +280,7 @@ CWordCollaborativeEditing.prototype.OnCallback_AskLock = function(result)
// Делаем откат на 1 шаг назад и удаляем из Undo/Redo эту последнюю точку
oEditor.WordControl.m_oLogicDocument.Document_Undo();
History.Clear_Redo();
AscCommon.History.Clear_Redo();
}
oEditor.isChartEditor = false;
......@@ -544,4 +541,5 @@ CWordCollaborativeEditing.prototype.Update_ForeignCursorLabelPosition = function
//--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CWordCollaborativeEditing = CWordCollaborativeEditing;
window['AscCommon'].CollaborativeEditing = new CWordCollaborativeEditing();
......@@ -1252,7 +1252,7 @@ function CDocument(DrawingDocument, isMainLogicDocument)
this.History = History;
this.IdCounter = AscCommon.g_oIdCounter;
this.TableId = g_oTableId;
this.CollaborativeEditing = (("undefined" !== typeof(CWordCollaborativeEditing) && AscCommon.CollaborativeEditing instanceof CWordCollaborativeEditing) ? AscCommon.CollaborativeEditing : null);
this.CollaborativeEditing = (("undefined" !== typeof(AscCommon.CWordCollaborativeEditing) && AscCommon.CollaborativeEditing instanceof AscCommon.CWordCollaborativeEditing) ? AscCommon.CollaborativeEditing : null);
this.Api = editor;
//------------------------------------------------------------------------------------------------------------------
// Выставляем ссылки на главный класс
......
......@@ -7864,8 +7864,4 @@ asc_CCommentDataWord.prototype['asc_putSolved'] = asc_CCommentDataWord.prototype
asc_CCommentDataWord.prototype['asc_getReply'] = asc_CCommentDataWord.prototype.asc_getReply;
asc_CCommentDataWord.prototype['asc_addReply'] = asc_CCommentDataWord.prototype.asc_addReply;
asc_CCommentDataWord.prototype['asc_getRepliesCount'] = asc_CCommentDataWord.prototype.asc_getRepliesCount;
})(window, window.document);
// don't delete this line!!! This line used for split minimize files
window['split']='split';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment