Commit b6fcf95b authored by GoshaZotov's avatar GoshaZotov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

parents a7c5b29c 2ff49bbc
...@@ -74,7 +74,7 @@ var c_oAscError = Asc.c_oAscError; ...@@ -74,7 +74,7 @@ var c_oAscError = Asc.c_oAscError;
DesktopOfflineUpdateLocalName(this); DesktopOfflineUpdateLocalName(this);
this.onUpdateDocumentModified(AscCommon.History.Is_Modified()); this.onUpdateDocumentModified(AscCommon.History.Have_Changes());
}; };
asc['spreadsheet_api'].prototype._onNeedParams = function(data, opt_isPassword) asc['spreadsheet_api'].prototype._onNeedParams = function(data, opt_isPassword)
...@@ -162,7 +162,7 @@ AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave) ...@@ -162,7 +162,7 @@ AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
} }
}; };
AscCommon.CHistory.prototype.Is_Modified = function(IsNotUserSave, IsNoSavedNoModifyed) AscCommon.CHistory.prototype.Have_Changes = function(IsNotUserSave, IsNoSavedNoModifyed)
{ {
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex; var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
if (-1 === this.Index && null === checkIndex && false === this.ForceSave) if (-1 === this.Index && null === checkIndex && false === this.ForceSave)
...@@ -198,7 +198,7 @@ window["Asc"]['spreadsheet_api'].prototype.onUpdateDocumentModified = function(b ...@@ -198,7 +198,7 @@ window["Asc"]['spreadsheet_api'].prototype.onUpdateDocumentModified = function(b
this._onUpdateDocumentCanSave(); this._onUpdateDocumentCanSave();
if (undefined !== window["AscDesktopEditor"]) { if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["onDocumentModifiedChanged"](AscCommon.History ? AscCommon.History.Is_Modified(undefined, true) : bValue); window["AscDesktopEditor"]["onDocumentModifiedChanged"](AscCommon.History ? AscCommon.History.Have_Changes(undefined, true) : bValue);
} }
} }
}; };
...@@ -260,7 +260,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error) ...@@ -260,7 +260,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
else else
AscCommon.History.UserSavedIndex = window["Asc"]["editor"].LastUserSavedIndex; AscCommon.History.UserSavedIndex = window["Asc"]["editor"].LastUserSavedIndex;
window["Asc"]["editor"].onUpdateDocumentModified(AscCommon.History.Is_Modified()); window["Asc"]["editor"].onUpdateDocumentModified(AscCommon.History.Have_Changes());
window["Asc"]["editor"].LastUserSavedIndex = undefined; window["Asc"]["editor"].LastUserSavedIndex = undefined;
if (2 == error) if (2 == error)
......
...@@ -874,8 +874,8 @@ var editor; ...@@ -874,8 +874,8 @@ var editor;
if (!this.canSave || this.asc_getCellEditMode()) { if (!this.canSave || this.asc_getCellEditMode()) {
// Пока идет сохранение или редактирование ячейки, мы не закрываем документ // Пока идет сохранение или редактирование ячейки, мы не закрываем документ
return true; return true;
} else if (History && History.Is_Modified) { } else if (History && History.Have_Changes) {
return History.Is_Modified(); return History.Have_Changes();
} }
return false; return false;
}; };
...@@ -1532,7 +1532,7 @@ var editor; ...@@ -1532,7 +1532,7 @@ var editor;
t.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save); t.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// Обновляем состояние возможности сохранения документа // Обновляем состояние возможности сохранения документа
t.onUpdateDocumentModified(History.Is_Modified()); t.onUpdateDocumentModified(History.Have_Changes());
if (undefined !== window["AscDesktopEditor"]) { if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"](); window["AscDesktopEditor"]["OnSave"]();
...@@ -2612,10 +2612,19 @@ var editor; ...@@ -2612,10 +2612,19 @@ var editor;
}; };
// Frozen pane // Frozen pane
spreadsheet_api.prototype.asc_freezePane = function() { spreadsheet_api.prototype.asc_freezePane = function () {
this.wb.getWorksheet().freezePane(); this.wb.getWorksheet().freezePane();
}; };
spreadsheet_api.prototype.asc_setSparklineGroup = function (id, oSparklineGroup) {
var changedSparkline = AscCommon.g_oTableId.Get_ById(id);
if (changedSparkline) {
changedSparkline.set(oSparklineGroup);
this.wb._onWSSelectionChanged();
this.wb.getWorksheet().draw();
}
};
// Cell interface // Cell interface
spreadsheet_api.prototype.asc_getCellInfo = function() { spreadsheet_api.prototype.asc_getCellInfo = function() {
return this.wb.getSelectionInfo(); return this.wb.getSelectionInfo();
...@@ -3044,7 +3053,7 @@ var editor; ...@@ -3044,7 +3053,7 @@ var editor;
!History.IsEndTransaction() || !this.canSave) { !History.IsEndTransaction() || !this.canSave) {
return; return;
} }
if (!History.Is_Modified(true) && !(this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength())) { if (!History.Have_Changes(true) && !(this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength())) {
if (this.collaborativeEditing.getFast() && this.collaborativeEditing.haveOtherChanges()) { if (this.collaborativeEditing.getFast() && this.collaborativeEditing.haveOtherChanges()) {
AscCommon.CollaborativeEditing.Clear_CollaborativeMarks(); AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();
...@@ -3071,7 +3080,7 @@ var editor; ...@@ -3071,7 +3080,7 @@ var editor;
spreadsheet_api.prototype._onUpdateDocumentCanSave = function() { spreadsheet_api.prototype._onUpdateDocumentCanSave = function() {
// Можно модифицировать это условие на более быстрое (менять самим состояние в аргументах, а не запрашивать каждый раз) // Можно модифицировать это условие на более быстрое (менять самим состояние в аргументах, а не запрашивать каждый раз)
var tmp = History.Is_Modified() || (this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength()); var tmp = History.Have_Changes() || (this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength());
if (tmp !== this.isDocumentCanSave) { if (tmp !== this.isDocumentCanSave) {
this.isDocumentCanSave = tmp; this.isDocumentCanSave = tmp;
this.handlers.trigger('asc_onDocumentCanSaveChanged', this.isDocumentCanSave); this.handlers.trigger('asc_onDocumentCanSaveChanged', this.isDocumentCanSave);
...@@ -3532,6 +3541,9 @@ var editor; ...@@ -3532,6 +3541,9 @@ var editor;
// Frozen pane // Frozen pane
prot["asc_freezePane"] = prot.asc_freezePane; prot["asc_freezePane"] = prot.asc_freezePane;
// Sparklines
prot["asc_setSparklineGroup"] = prot.asc_setSparklineGroup;
// Cell interface // Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo; prot["asc_getCellInfo"] = prot.asc_getCellInfo;
prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord; prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord;
......
...@@ -378,34 +378,6 @@ var c_oAscPopUpSelectorType = { ...@@ -378,34 +378,6 @@ var c_oAscPopUpSelectorType = {
Custom: 2 Custom: 2
}; };
var c_oAscSparklineAttributes = {
type: 1,
lineWeight: 2,
displayEmptyCellsAs: 4,
markers: 8,
high: 16,
low: 32,
first: 64,
last: 128,
negative: 256,
displayXAxis: 512,
displayHidden: 1024,
minAxisType: 2048,
maxAxisType: 4096,
rightToLeft: 8192
};
var c_oAscSparklineColors = {
Series: 1,
Negative: 2,
Axis: 4,
Markers: 8,
First: 16,
Last: 32,
High: 64,
Low: 128
};
//----------------------------------------------------------export---------------------------------------------------- //----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {}; window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].c_oAscAlignType = c_oAscAlignType; window['AscCommonExcel'].c_oAscAlignType = c_oAscAlignType;
...@@ -593,30 +565,4 @@ var c_oAscPopUpSelectorType = { ...@@ -593,30 +565,4 @@ var c_oAscPopUpSelectorType = {
prot['Individual'] = prot.Individual; prot['Individual'] = prot.Individual;
prot['Group'] = prot.Group; prot['Group'] = prot.Group;
prot['Custom'] = prot.Custom; prot['Custom'] = prot.Custom;
window['Asc']['c_oAscSparklineAttributes'] = window['Asc'].c_oAscSparklineAttributes = c_oAscSparklineAttributes;
prot = c_oAscSparklineAttributes;
prot['type'] = prot.type;
prot['lineWeight'] = prot.lineWeight;
prot['displayEmptyCellsAs'] = prot.displayEmptyCellsAs;
prot['markers'] = prot.markers;
prot['high'] = prot.high;
prot['low'] = prot.low;
prot['first'] = prot.first;
prot['last'] = prot.last;
prot['negative'] = prot.negative;
prot['displayXAxis'] = prot.displayXAxis;
prot['displayHidden'] = prot.displayHidden;
prot['minAxisType'] = prot.minAxisType;
prot['maxAxisType'] = prot.maxAxisType;
prot['rightToLeft'] = prot.rightToLeft;
window['Asc']['c_oAscSparklineColors'] = window['Asc'].c_oAscSparklineColors = c_oAscSparklineColors;
prot = c_oAscSparklineColors;
prot['Series'] = prot.Series;
prot['Negative'] = prot.Negative;
prot['Axis'] = prot.Axis;
prot['Markers'] = prot.Markers;
prot['First'] = prot.First;
prot['Last'] = prot.Last;
prot['High'] = prot.High;
prot['Low'] = prot.Low;
})(window); })(window);
...@@ -173,6 +173,12 @@ CHistory.prototype.init = function(workbook) { ...@@ -173,6 +173,12 @@ CHistory.prototype.init = function(workbook) {
CHistory.prototype.Is_UserSaveMode = function() { CHistory.prototype.Is_UserSaveMode = function() {
return this.UserSaveMode; return this.UserSaveMode;
}; };
CHistory.prototype.Is_Clear = function() {
if ( this.Points.length <= 0 )
return true;
return false;
};
CHistory.prototype.Clear = function() CHistory.prototype.Clear = function()
{ {
this.Index = -1; this.Index = -1;
...@@ -709,7 +715,7 @@ CHistory.prototype._sendCanUndoRedo = function() ...@@ -709,7 +715,7 @@ CHistory.prototype._sendCanUndoRedo = function()
{ {
this.workbook.handlers.trigger("setCanUndo", this.Can_Undo()); this.workbook.handlers.trigger("setCanUndo", this.Can_Undo());
this.workbook.handlers.trigger("setCanRedo", this.Can_Redo()); this.workbook.handlers.trigger("setCanRedo", this.Can_Redo());
this.workbook.handlers.trigger("setDocumentModified", this.Is_Modified()); this.workbook.handlers.trigger("setDocumentModified", this.Have_Changes());
}; };
CHistory.prototype.SetSelection = function(range) CHistory.prototype.SetSelection = function(range)
{ {
...@@ -835,7 +841,7 @@ CHistory.prototype.Get_DeleteIndex = function () { ...@@ -835,7 +841,7 @@ CHistory.prototype.Get_DeleteIndex = function () {
return DeleteIndex; return DeleteIndex;
}; };
/** @returns {boolean} */ /** @returns {boolean} */
CHistory.prototype.Is_Modified = function(IsNotUserSave) { CHistory.prototype.Have_Changes = function(IsNotUserSave) {
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex; var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
if (-1 === this.Index && null === checkIndex && false === this.ForceSave) { if (-1 === this.Index && null === checkIndex && false === this.ForceSave) {
return false; return false;
......
...@@ -6663,7 +6663,7 @@ ...@@ -6663,7 +6663,7 @@
var oThis = this; var oThis = this;
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
if (c_oSer_Sparkline.SparklineGroup === type) { if (c_oSer_Sparkline.SparklineGroup === type) {
var newSparklineGroup = new AscCommonExcel.sparklineGroup(); var newSparklineGroup = new AscCommonExcel.sparklineGroup(true);
res = this.bcr.Read1(length, function (t, l) { res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSparklineGroup(t, l, newSparklineGroup); return oThis.ReadSparklineGroup(t, l, newSparklineGroup);
}); });
......
...@@ -4580,90 +4580,25 @@ CellArea.prototype = { ...@@ -4580,90 +4580,25 @@ CellArea.prototype = {
}; };
/** @constructor */ /** @constructor */
function propertyChanges() { function sparklineGroup(addId) {
this.propertyObj = {};
}
propertyChanges.prototype.getType = function () {
return AscCommonExcel.UndoRedoDataTypes.PropertyChanges;
};
propertyChanges.prototype.getProperties = function () {
var res = {};
for (var i in this.propertyObj) {
res[i] = i;
}
return res;
};
propertyChanges.prototype.getProperty = function (nType) {
return this.propertyObj[nType];
};
propertyChanges.prototype.setProperty = function (nType, value) {
this.propertyObj[nType] = value;
};
/** @constructor */
function sparklineChanges() {
this.Properties = {
attributes: 0,
colors: 1
};
this.attributes = new propertyChanges();
this.colors = new propertyChanges();
}
sparklineChanges.prototype.getType = function () {
return AscCommonExcel.UndoRedoDataTypes.SparklineProps;
};
sparklineChanges.prototype.getProperties = function () {
return this.Properties;
};
sparklineChanges.prototype.getProperty = function (nType) {
switch (nType) {
case this.Properties.attributes:
return this.attributes;
break;
case this.Properties.colors:
return this.colors;
break;
}
return null;
};
sparklineChanges.prototype.setProperty = function (nType, value) {
switch (nType) {
case this.Properties.attributes:
this.attributes = value;
break;
case this.Properties.colors:
this.colors = value;
break;
}
};
sparklineChanges.prototype.setAttribute = function (type, value) {
this.attributes.setProperty(type, value);
};
sparklineChanges.prototype.setColor = function (type, value) {
this.colors.setProperty(type, value);
};
/** @constructor */
function sparklineGroup() {
// attributes // attributes
this.type = Asc.c_oAscSparklineType.Line; this.type = null;
this.lineWeight = 0.75; this.lineWeight = null;
this.displayEmptyCellsAs = Asc.c_oAscEDispBlanksAs.Zero; this.displayEmptyCellsAs = null;
this.markers = false; this.markers = null;
this.high = false; this.high = null;
this.low = false; this.low = null;
this.first = false; this.first = null;
this.last = false; this.last = null;
this.negative = false; this.negative = null;
this.displayXAxis = false; this.displayXAxis = null;
this.displayHidden = false; this.displayHidden = null;
this.minAxisType = Asc.c_oAscSparklineAxisMinMax.Individual; this.minAxisType = null;
this.maxAxisType = Asc.c_oAscSparklineAxisMinMax.Individual; this.maxAxisType = null;
this.rightToLeft = false; this.rightToLeft = null;
this.manualMax = null;
this.manualMin = null;
this.manualMax = undefined;
this.manualMin = undefined;
this.dateAxis = false; this.dateAxis = false;
// elements // elements
...@@ -4684,14 +4619,82 @@ CellArea.prototype = { ...@@ -4684,14 +4619,82 @@ CellArea.prototype = {
this.canvas = null; this.canvas = null;
this.sparklineView = null; this.sparklineView = null;
// for changes this.Id = null;
this.sparklineChanges = null; if (addId) {
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
} }
sparklineGroup.prototype.Get_Id = function () {
return this.Id;
};
sparklineGroup.prototype.default = function () {
this.type = Asc.c_oAscSparklineType.Line;
this.lineWeight = 0.75;
this.displayEmptyCellsAs = Asc.c_oAscEDispBlanksAs.Zero;
this.markers = false;
this.high = false;
this.low = false;
this.first = false;
this.last = false;
this.negative = false;
this.displayXAxis = false;
this.displayHidden = false;
this.minAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.maxAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.rightToLeft = false;
this.manualMax = null;
this.manualMin = null;
// elements
var defaultSeriesColor = 3629202;
var defaultOtherColor = 13631488;
this.colorSeries = new AscCommonExcel.RgbColor(defaultSeriesColor);
this.colorNegative = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorAxis = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorMarkers = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorFirst = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorLast = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorHigh = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorLow = new AscCommonExcel.RgbColor(defaultOtherColor);
};
sparklineGroup.prototype.set = function (val) {
this.lineWeight = null !== val.lineWeight ? val.lineWeight : this.lineWeight;
this.type = null !== val.type ? val.type : this.type;
this.dateAxis = null !== val.dateAxis ? val.dateAxis : this.dateAxis;
this.displayEmptyCellsAs = null !== val.displayEmptyCellsAs ? val.displayEmptyCellsAs : this.displayEmptyCellsAs;
this.markers = null !== val.markers ? val.markers : this.markers;
this.high = null !== val.high ? val.high : this.high;
this.low = null !== val.low ? val.low : this.low;
this.first = null !== val.first ? val.first : this.first;
this.last = null !== val.last ? val.last : this.last;
this.negative = null !== val.negative ? val.negative : this.negative;
this.displayXAxis = null !== val.displayXAxis ? val.displayXAxis : this.displayXAxis;
this.displayHidden = null !== val.displayHidden ? val.displayHidden : this.displayHidden;
this.minAxisType = null !== val.minAxisType ? val.minAxisType : this.minAxisType;
this.maxAxisType = null !== val.maxAxisType ? val.maxAxisType : this.maxAxisType;
this.rightToLeft = null !== val.rightToLeft ? val.rightToLeft : this.rightToLeft;
this.manualMax = null !== val.manualMax ? val.manualMax : this.manualMax;
this.manualMin = null !== val.manualMin ? val.manualMin : this.manualMin;
var getColor = function (color) {
return color instanceof Asc.asc_CColor ? AscCommonExcel.CorrectAscColor(color) : color;
};
this.colorSeries = null !== val.colorSeries ? getColor(val.colorSeries) : this.colorSeries;
this.colorNegative = null !== val.colorNegative ? getColor(val.colorNegative) : this.colorNegative;
this.colorAxis = null !== val.colorAxis ? getColor(val.colorAxis) : this.colorAxis;
this.colorMarkers = null !== val.colorMarkers ? getColor(val.colorMarkers) : this.colorMarkers;
this.colorFirst = null !== val.colorFirst ? getColor(val.colorFirst) : this.colorFirst;
this.colorLast = null !== val.colorLast ? getColor(val.colorLast) : this.colorLast;
this.colorHigh = null !== val.colorHigh ? getColor(val.colorHigh) : this.colorHigh;
this.colorLow = null !== val.colorLow ? getColor(val.colorLow) : this.colorLow;
this.cleanCache();
};
sparklineGroup.prototype.clone = function (onlyProps) { sparklineGroup.prototype.clone = function (onlyProps) {
var res = new sparklineGroup(); var res = new sparklineGroup(!onlyProps);
res.manualMax = this.manualMax; res.Id = this.Id;
res.manualMin = this.manualMin;
res.lineWeight = this.lineWeight; res.lineWeight = this.lineWeight;
res.type = this.type; res.type = this.type;
res.dateAxis = this.dateAxis; res.dateAxis = this.dateAxis;
...@@ -4707,15 +4710,17 @@ CellArea.prototype = { ...@@ -4707,15 +4710,17 @@ CellArea.prototype = {
res.minAxisType = this.minAxisType; res.minAxisType = this.minAxisType;
res.maxAxisType = this.maxAxisType; res.maxAxisType = this.maxAxisType;
res.rightToLeft = this.rightToLeft; res.rightToLeft = this.rightToLeft;
res.manualMax = this.manualMax;
res.manualMin = this.manualMin;
res.colorSeries = this.colorSeries ? this.colorSeries.clone() : null; res.colorSeries = this.colorSeries ? this.colorSeries.clone() : null;
res.colorNegative = this.colorNegative ? this.colorNegative.clone() : null; res.colorNegative = this.colorNegative ? this.colorNegative.clone() : null;
res.colorAxis = this.colorAxis ? this.colorAxis : null; res.colorAxis = this.colorAxis ? this.colorAxis.clone() : null;
res.colorMarkers = this.colorMarkers ? this.colorMarkers : null; res.colorMarkers = this.colorMarkers ? this.colorMarkers.clone() : null;
res.colorFirst = this.colorFirst ? this.colorFirst : null; res.colorFirst = this.colorFirst ? this.colorFirst.clone() : null;
res.colorLast = this.colorLast ? this.colorLast : null; res.colorLast = this.colorLast ? this.colorLast.clone() : null;
res.colorHigh = this.colorHigh ? this.colorHigh : null; res.colorHigh = this.colorHigh ? this.colorHigh.clone() : null;
res.colorLow = this.colorLow ? this.colorLow : null; res.colorLow = this.colorLow ? this.colorLow.clone() : null;
res.f = this.f; res.f = this.f;
if (!onlyProps) { if (!onlyProps) {
...@@ -4762,19 +4767,8 @@ CellArea.prototype = { ...@@ -4762,19 +4767,8 @@ CellArea.prototype = {
} }
return -1; return -1;
}; };
sparklineGroup.prototype.asc_setAttribute = function (type, value) { sparklineGroup.prototype.asc_getId = function () {
if (!this.sparklineChanges) { return this.Id;
this.sparklineChanges = new sparklineChanges();
}
this.sparklineChanges.setAttribute(type, value);
};
sparklineGroup.prototype.asc_setColor = function (type, value) {
if (!this.sparklineChanges) {
this.sparklineChanges = new sparklineChanges();
}
this.sparklineChanges.setColor(type, value);
}; };
sparklineGroup.prototype.asc_getType = function () { sparklineGroup.prototype.asc_getType = function () {
return this.type; return this.type;
...@@ -4818,6 +4812,12 @@ CellArea.prototype = { ...@@ -4818,6 +4812,12 @@ CellArea.prototype = {
sparklineGroup.prototype.asc_getRightToLeft = function () { sparklineGroup.prototype.asc_getRightToLeft = function () {
return this.rightToLeft; return this.rightToLeft;
}; };
sparklineGroup.prototype.asc_getManualMax = function () {
return this.manualMax;
};
sparklineGroup.prototype.asc_getManualMin = function () {
return this.manualMin;
};
sparklineGroup.prototype.asc_getColorSeries = function () { sparklineGroup.prototype.asc_getColorSeries = function () {
return this.colorSeries ? Asc.colorObjToAscColor(this.colorSeries) : this.colorSeries; return this.colorSeries ? Asc.colorObjToAscColor(this.colorSeries) : this.colorSeries;
}; };
...@@ -4842,6 +4842,78 @@ CellArea.prototype = { ...@@ -4842,6 +4842,78 @@ CellArea.prototype = {
sparklineGroup.prototype.asc_getColorLow = function () { sparklineGroup.prototype.asc_getColorLow = function () {
return this.colorLow ? Asc.colorObjToAscColor(this.colorLow) : this.colorLow; return this.colorLow ? Asc.colorObjToAscColor(this.colorLow) : this.colorLow;
}; };
sparklineGroup.prototype.asc_setType = function (val) {
this.type = val;
};
sparklineGroup.prototype.asc_setLineWeight = function (val) {
this.lineWeight = val;
};
sparklineGroup.prototype.asc_setDisplayEmpty = function (val) {
this.displayEmptyCellsAs = val;
};
sparklineGroup.prototype.asc_setMarkersPoint = function (val) {
this.markers = val;
};
sparklineGroup.prototype.asc_setHighPoint = function (val) {
this.high = val;
};
sparklineGroup.prototype.asc_setLowPoint = function (val) {
this.low = val;
};
sparklineGroup.prototype.asc_setFirstPoint = function (val) {
this.first = val;
};
sparklineGroup.prototype.asc_setLastPoint = function (val) {
this.last = val;
};
sparklineGroup.prototype.asc_setNegativePoint = function (val) {
this.negative = val;
};
sparklineGroup.prototype.asc_setDisplayXAxis = function (val) {
this.displayXAxis = val;
};
sparklineGroup.prototype.asc_setDisplayHidden = function (val) {
this.displayHidden = val;
};
sparklineGroup.prototype.asc_setMinAxisType = function (val) {
this.minAxisType = val;
};
sparklineGroup.prototype.asc_setMaxAxisType = function (val) {
this.maxAxisType = val;
};
sparklineGroup.prototype.asc_setRightToLeft = function (val) {
this.rightToLeft = val;
};
sparklineGroup.prototype.asc_setManualMax = function (val) {
this.manualMax = val;
};
sparklineGroup.prototype.asc_setManualMin = function (val) {
this.manualMin = val;
};
sparklineGroup.prototype.asc_setColorSeries = function (val) {
this.colorSeries = val;
};
sparklineGroup.prototype.asc_setColorNegative = function (val) {
this.colorNegative = val;
};
sparklineGroup.prototype.asc_setColorAxis = function (val) {
this.colorAxis = val;
};
sparklineGroup.prototype.asc_setColorMarkers = function (val) {
this.colorMarkers = val;
};
sparklineGroup.prototype.asc_setColorFirst = function (val) {
this.colorFirst = val;
};
sparklineGroup.prototype.asc_setColorLast = function (val) {
this.colorLast = val;
};
sparklineGroup.prototype.asc_setColorHigh = function (val) {
this.colorHigh = val;
};
sparklineGroup.prototype.asc_setColorLow = function (val) {
this.colorLow = val;
};
sparklineGroup.prototype.createExcellColor = function(aColor) { sparklineGroup.prototype.createExcellColor = function(aColor) {
var oExcellColor = null; var oExcellColor = null;
...@@ -4856,10 +4928,10 @@ CellArea.prototype = { ...@@ -4856,10 +4928,10 @@ CellArea.prototype = {
return oExcellColor; return oExcellColor;
}; };
sparklineGroup.prototype.asc_createSparklineGroupByStyle = function(nStyleIndex){ sparklineGroup.prototype.asc_createSparklineGroupByStyle = function (nStyleIndex) {
var oSparklineGroup = this.clone(true); var oSparklineGroup = this.clone(true);
var oStyle = AscFormat.aSparklinesStyles[nStyleIndex]; var oStyle = AscFormat.aSparklinesStyles[nStyleIndex];
if(oStyle) { if (oStyle) {
oSparklineGroup.colorSeries = this.createExcellColor(oStyle[0]); oSparklineGroup.colorSeries = this.createExcellColor(oStyle[0]);
oSparklineGroup.colorNegative = this.createExcellColor(oStyle[1]); oSparklineGroup.colorNegative = this.createExcellColor(oStyle[1]);
oSparklineGroup.colorAxis = this.createExcellColor(0xff000000); oSparklineGroup.colorAxis = this.createExcellColor(0xff000000);
...@@ -4959,18 +5031,17 @@ CellArea.prototype = { ...@@ -4959,18 +5031,17 @@ CellArea.prototype = {
return true; return true;
}; };
sparklineGroup.prototype.asc_getStyles = function() sparklineGroup.prototype.asc_getStyles = function () {
{
var aRet = []; var aRet = [];
var nStyleIndex = -1; var nStyleIndex = -1;
for(var i = 0; i < 36; ++i){ for (var i = 0; i < 36; ++i) {
var oSparklineGroup = this.asc_createSparklineGroupByStyle(i); var oSparklineGroup = this.asc_createSparklineGroupByStyle(i);
if(nStyleIndex === -1 && this.isEqualColors(oSparklineGroup)){ if (nStyleIndex === -1 && this.isEqualColors(oSparklineGroup)) {
nStyleIndex = i; nStyleIndex = i;
} }
aRet.push(this.asc_getThumbBySparklineGroup(oSparklineGroup)); aRet.push(this.asc_getThumbBySparklineGroup(oSparklineGroup));
} }
aRet.push(nStyleIndex); aRet.push(nStyleIndex);
return aRet; return aRet;
}; };
...@@ -7185,11 +7256,9 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr ...@@ -7185,11 +7256,9 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
window['AscCommonExcel'].RangeDataManagerElem = RangeDataManagerElem; window['AscCommonExcel'].RangeDataManagerElem = RangeDataManagerElem;
window['AscCommonExcel'].RangeDataManager = RangeDataManager; window['AscCommonExcel'].RangeDataManager = RangeDataManager;
window['AscCommonExcel'].CellArea = CellArea; window['AscCommonExcel'].CellArea = CellArea;
window["AscCommonExcel"].sparklineChanges = sparklineChanges; window["Asc"]["sparklineGroup"] = window['AscCommonExcel'].sparklineGroup = sparklineGroup;
window['AscCommonExcel'].sparklineGroup = sparklineGroup;
prot = sparklineGroup.prototype; prot = sparklineGroup.prototype;
prot["asc_setAttribute"] = prot.asc_setAttribute; prot["asc_getId"] = prot.asc_getId;
prot["asc_setColor"] = prot.asc_setColor;
prot["asc_getType"] = prot.asc_getType; prot["asc_getType"] = prot.asc_getType;
prot["asc_getLineWeight"] = prot.asc_getLineWeight; prot["asc_getLineWeight"] = prot.asc_getLineWeight;
prot["asc_getDisplayEmpty"] = prot.asc_getDisplayEmpty; prot["asc_getDisplayEmpty"] = prot.asc_getDisplayEmpty;
...@@ -7204,6 +7273,8 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr ...@@ -7204,6 +7273,8 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
prot["asc_getMinAxisType"] = prot.asc_getMinAxisType; prot["asc_getMinAxisType"] = prot.asc_getMinAxisType;
prot["asc_getMaxAxisType"] = prot.asc_getMaxAxisType; prot["asc_getMaxAxisType"] = prot.asc_getMaxAxisType;
prot["asc_getRightToLeft"] = prot.asc_getRightToLeft; prot["asc_getRightToLeft"] = prot.asc_getRightToLeft;
prot["asc_getManualMax"] = prot.asc_getManualMax;
prot["asc_getManualMin"] = prot.asc_getManualMin;
prot["asc_getColorSeries"] = prot.asc_getColorSeries; prot["asc_getColorSeries"] = prot.asc_getColorSeries;
prot["asc_getColorNegative"] = prot.asc_getColorNegative; prot["asc_getColorNegative"] = prot.asc_getColorNegative;
prot["asc_getColorAxis"] = prot.asc_getColorAxis; prot["asc_getColorAxis"] = prot.asc_getColorAxis;
...@@ -7212,6 +7283,30 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr ...@@ -7212,6 +7283,30 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
prot["asc_getColorLast"] = prot.asc_getColorLast; prot["asc_getColorLast"] = prot.asc_getColorLast;
prot["asc_getColorHigh"] = prot.asc_getColorHigh; prot["asc_getColorHigh"] = prot.asc_getColorHigh;
prot["asc_getColorLow"] = prot.asc_getColorLow; prot["asc_getColorLow"] = prot.asc_getColorLow;
prot["asc_setType"] = prot.asc_setType;
prot["asc_setLineWeight"] = prot.asc_setLineWeight;
prot["asc_setDisplayEmpty"] = prot.asc_setDisplayEmpty;
prot["asc_setMarkersPoint"] = prot.asc_setMarkersPoint;
prot["asc_setHighPoint"] = prot.asc_setHighPoint;
prot["asc_setLowPoint"] = prot.asc_setLowPoint;
prot["asc_setFirstPoint"] = prot.asc_setFirstPoint;
prot["asc_setLastPoint"] = prot.asc_setLastPoint;
prot["asc_setNegativePoint"] = prot.asc_setNegativePoint;
prot["asc_setDisplayXAxis"] = prot.asc_setDisplayXAxis;
prot["asc_setDisplayHidden"] = prot.asc_setDisplayHidden;
prot["asc_setMinAxisType"] = prot.asc_setMinAxisType;
prot["asc_setMaxAxisType"] = prot.asc_setMaxAxisType;
prot["asc_setRightToLeft"] = prot.asc_setRightToLeft;
prot["asc_setManualMax"] = prot.asc_setManualMax;
prot["asc_setManualMin"] = prot.asc_setManualMin;
prot["asc_setColorSeries"] = prot.asc_setColorSeries;
prot["asc_setColorNegative"] = prot.asc_setColorNegative;
prot["asc_setColorAxis"] = prot.asc_setColorAxis;
prot["asc_setColorMarkers"] = prot.asc_setColorMarkers;
prot["asc_setColorFirst"] = prot.asc_setColorFirst;
prot["asc_setColorLast"] = prot.asc_setColorLast;
prot["asc_setColorHigh"] = prot.asc_setColorHigh;
prot["asc_setColorLow"] = prot.asc_setColorLow;
prot["asc_createSparklineGroupByStyle"] = prot.asc_createSparklineGroupByStyle; prot["asc_createSparklineGroupByStyle"] = prot.asc_createSparklineGroupByStyle;
prot["asc_getThumbBySparklineGroup"] = prot.asc_getThumbBySparklineGroup; prot["asc_getThumbBySparklineGroup"] = prot.asc_getThumbBySparklineGroup;
prot["asc_getStyles"] = prot.asc_getStyles; prot["asc_getStyles"] = prot.asc_getStyles;
......
...@@ -691,7 +691,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou ...@@ -691,7 +691,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
var val_ax_props = new AscCommon.asc_ValAxisSettings(); var val_ax_props = new AscCommon.asc_ValAxisSettings();
if(settings.type !== c_oAscChartTypeSettings.barStackedPer) if(settings.type !== c_oAscChartTypeSettings.barStackedPer)
{ {
if(oSparklineGroup.minAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMin != null) if(oSparklineGroup.minAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMin !== null)
{ {
val_ax_props.putMinValRule(c_oAscValAxisRule.fixed); val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMinVal(oSparklineGroup.manualMin); val_ax_props.putMinVal(oSparklineGroup.manualMin);
...@@ -700,7 +700,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou ...@@ -700,7 +700,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
{ {
val_ax_props.putMinValRule(c_oAscValAxisRule.auto); val_ax_props.putMinValRule(c_oAscValAxisRule.auto);
} }
if(oSparklineGroup.maxAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMax != null) if(oSparklineGroup.maxAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMax !== null)
{ {
val_ax_props.putMinValRule(c_oAscValAxisRule.fixed); val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMinVal(oSparklineGroup.manualMax); val_ax_props.putMinVal(oSparklineGroup.manualMax);
......
...@@ -589,14 +589,21 @@ ...@@ -589,14 +589,21 @@
this.CoAuthoringApi.onSession = function(data) { this.CoAuthoringApi.onSession = function(data) {
var code = data["code"]; var code = data["code"];
var reason = data["reason"]; var reason = data["reason"];
var interval = data["interval"];
var extendSession = true; var extendSession = true;
if (c_oCloseCode.sessionIdle == code) { if (c_oCloseCode.sessionIdle == code) {
extendSession = false; var lastTime = new Date().getTime();
var idleTime = new Date().getTime() - lastTime;
if (idleTime < interval) {
t.CoAuthoringApi.extendSession(idleTime);
} else {
extendSession = false;
}
} else if (c_oCloseCode.sessionAbsolute == code) { } else if (c_oCloseCode.sessionAbsolute == code) {
extendSession = false; extendSession = false;
} }
if (!extendSession) { if (!extendSession) {
if (true != History.Is_Clear()) { if (History.Have_Changes()) {
//enter view mode because save async //enter view mode because save async
t.sendEvent('asc_onCoAuthoringDisconnect'); t.sendEvent('asc_onCoAuthoringDisconnect');
t.asc_setViewMode(true); t.asc_setViewMode(true);
...@@ -606,8 +613,13 @@ ...@@ -606,8 +613,13 @@
t.CoAuthoringApi.disconnect(code, reason); t.CoAuthoringApi.disconnect(code, reason);
}; };
AscCommon.CollaborativeEditing.Apply_Changes(); if (t.collaborativeEditing.applyChanges) {
AscCommon.CollaborativeEditing.Send_Changes(); t.collaborativeEditing.applyChanges();
t.collaborativeEditing.sendChanges();
} else {
AscCommon.CollaborativeEditing.Apply_Changes();
AscCommon.CollaborativeEditing.Send_Changes();
}
} else { } else {
t.CoAuthoringApi.disconnect(code, reason); t.CoAuthoringApi.disconnect(code, reason);
} }
...@@ -619,19 +631,19 @@ ...@@ -619,19 +631,19 @@
* @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились * @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились
* @param {Bool} isCloseCoAuthoring * @param {Bool} isCloseCoAuthoring
*/ */
this.CoAuthoringApi.onDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) this.CoAuthoringApi.onDisconnect = function(e, errorCode)
{ {
if (AscCommon.ConnectionState.None === t.CoAuthoringApi.get_state()) if (AscCommon.ConnectionState.None === t.CoAuthoringApi.get_state())
{ {
t.asyncServerIdEndLoaded(); t.asyncServerIdEndLoaded();
} }
if (isDisconnectAtAll) if (null != errorCode)
{ {
// Посылаем наверх эвент об отключении от сервера // Посылаем наверх эвент об отключении от сервера
t.sendEvent('asc_onCoAuthoringDisconnect'); t.sendEvent('asc_onCoAuthoringDisconnect');
// И переходим в режим просмотра т.к. мы не можем сохранить файл // И переходим в режим просмотра т.к. мы не можем сохранить файл
t.asc_setViewMode(true); t.asc_setViewMode(true);
t.sendEvent('asc_onError', isCloseCoAuthoring ? c_oAscError.ID.UserDrop : c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical); t.sendEvent('asc_onError', errorCode, c_oAscError.Level.NoCritical);
} }
}; };
this.CoAuthoringApi.onDocumentOpen = function(inputWrap) this.CoAuthoringApi.onDocumentOpen = function(inputWrap)
......
...@@ -102,8 +102,8 @@ ...@@ -102,8 +102,8 @@
this._CoAuthoringApi.onLocksReleasedEnd = function() { this._CoAuthoringApi.onLocksReleasedEnd = function() {
t.callback_OnLocksReleasedEnd(); t.callback_OnLocksReleasedEnd();
}; };
this._CoAuthoringApi.onDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) { this._CoAuthoringApi.onDisconnect = function(e, errorCode) {
t.callback_OnDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring); t.callback_OnDisconnect(e, errorCode);
}; };
this._CoAuthoringApi.onWarning = function(e) { this._CoAuthoringApi.onWarning = function(e) {
t.callback_OnWarning(e); t.callback_OnWarning(e);
...@@ -328,9 +328,9 @@ ...@@ -328,9 +328,9 @@
} }
}; };
CDocsCoApi.prototype.extendSession = function() { CDocsCoApi.prototype.extendSession = function(idleTime) {
if (this._CoAuthoringApi && this._onlineWork) { if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.extendSession(); this._CoAuthoringApi.extendSession(idleTime);
} }
}; };
...@@ -394,9 +394,9 @@ ...@@ -394,9 +394,9 @@
* @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились * @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились
* @param {Bool} isCloseCoAuthoring * @param {Bool} isCloseCoAuthoring
*/ */
CDocsCoApi.prototype.callback_OnDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) { CDocsCoApi.prototype.callback_OnDisconnect = function(e, errorCode) {
if (this.onDisconnect) { if (this.onDisconnect) {
this.onDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring); this.onDisconnect(e, errorCode);
} }
}; };
...@@ -786,8 +786,8 @@ ...@@ -786,8 +786,8 @@
} }
}; };
DocsCoApi.prototype.extendSession = function() { DocsCoApi.prototype.extendSession = function(idleTime) {
this._send({'type': 'extendSession'}); this._send({'type': 'extendSession', 'idletime': idleTime});
}; };
DocsCoApi.prototype.openDocument = function(data) { DocsCoApi.prototype.openDocument = function(data) {
...@@ -1162,7 +1162,7 @@ ...@@ -1162,7 +1162,7 @@
DocsCoApi.prototype._onDrop = function(data) { DocsCoApi.prototype._onDrop = function(data) {
this.disconnect(); this.disconnect();
this.onDisconnect(data ? data['description'] : '', true, this.isCloseCoAuthoring); this.onDisconnect(data ? data['description'] : '', this._getDisconnectErrorCode());
}; };
DocsCoApi.prototype._onWarning = function(data) { DocsCoApi.prototype._onWarning = function(data) {
...@@ -1301,6 +1301,7 @@ ...@@ -1301,6 +1301,7 @@
'block': this.ownedLockBlocks, 'block': this.ownedLockBlocks,
'sessionId': this._id, 'sessionId': this._id,
'sessionTimeConnect': this._sessionTimeConnect, 'sessionTimeConnect': this._sessionTimeConnect,
'sessionTimeIdle': 0,
'documentFormatSave': this._documentFormatSave, 'documentFormatSave': this._documentFormatSave,
'view': this._isViewer, 'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring, 'isCloseCoAuthoring': this.isCloseCoAuthoring,
...@@ -1404,11 +1405,13 @@ ...@@ -1404,11 +1405,13 @@
t._state = ConnectionState.Reconnect; t._state = ConnectionState.Reconnect;
var bIsDisconnectAtAll = (c_oCloseCode.serverShutdown === evt.code || c_oCloseCode.sessionIdle === evt.code || var bIsDisconnectAtAll = (c_oCloseCode.serverShutdown === evt.code || c_oCloseCode.sessionIdle === evt.code ||
c_oCloseCode.sessionAbsolute === evt.code || t.attemptCount >= t.maxAttemptCount); c_oCloseCode.sessionAbsolute === evt.code || t.attemptCount >= t.maxAttemptCount);
var errorCode = null;
if (bIsDisconnectAtAll) { if (bIsDisconnectAtAll) {
t._state = ConnectionState.ClosedAll; t._state = ConnectionState.ClosedAll;
errorCode = t._getDisconnectErrorCode(evt.code);
} }
if (t.onDisconnect) { if (t.onDisconnect) {
t.onDisconnect(evt.reason, bIsDisconnectAtAll, t.isCloseCoAuthoring); t.onDisconnect(evt.reason, errorCode);
} }
//Try reconect //Try reconect
if (!bIsDisconnectAtAll) { if (!bIsDisconnectAtAll) {
...@@ -1437,6 +1440,17 @@ ...@@ -1437,6 +1440,17 @@
return window['SockJS'] ? window['SockJS'] : require('sockjs'); return window['SockJS'] ? window['SockJS'] : require('sockjs');
}; };
DocsCoApi.prototype._getDisconnectErrorCode = function(opt_closeCode) {
if(c_oCloseCode.serverShutdown === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionIdle === opt_closeCode){
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionAbsolute === opt_closeCode){
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
}
return this.isCloseCoAuthoring ? Asc.c_oAscError.ID.UserDrop : Asc.c_oAscError.ID.CoAuthoringDisconnect;
};
//----------------------------------------------------------export---------------------------------------------------- //----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {}; window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CDocsCoApi = CDocsCoApi; window['AscCommon'].CDocsCoApi = CDocsCoApi;
......
...@@ -318,25 +318,24 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) { ...@@ -318,25 +318,24 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
} else { } else {
bEndLoadChanges = true; bEndLoadChanges = true;
} }
if (window['IS_NATIVE_EDITOR']) { if (window['IS_NATIVE_EDITOR']) {
result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature); var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
var url; var url;
var nIndex = sFileUrl.lastIndexOf("/"); var nIndex = sFileUrl.lastIndexOf("/");
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl; url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
if (0 < result.length) { if (0 < result.length) {
oResult.bSerFormat = Signature === result.substring(0, Signature.length); oResult.bSerFormat = Signature === result.substring(0, Signature.length);
oResult.data = result; oResult.data = result;
oResult.url = url; oResult.url = url;
} else { } else {
bError = true; bError = true;
} }
bEndLoadFile = true; bEndLoadFile = true;
onEndOpen(); onEndOpen();
} }
} }
function sendCommand(editor, fCallback, rdata, dataContainer) { function sendCommand(editor, fCallback, rdata, dataContainer) {
//json не должен превышать размера 2097152, иначе при его чтении будет exception //json не должен превышать размера 2097152, иначе при его чтении будет exception
...@@ -2708,7 +2707,12 @@ CUserCacheColor.prototype.init = function(nColor) { ...@@ -2708,7 +2707,12 @@ CUserCacheColor.prototype.init = function(nColor) {
script.type = 'text/javascript'; script.type = 'text/javascript';
script.src = url; script.src = url;
script.onreadystatechange = callback; script.onreadystatechange = function () {
if (this.readyState === 'complete' || this.readyState === 'loaded') {
script.onreadystatechange = null;
setTimeout(callback, 0);
}
};
script.onload = callback; script.onload = callback;
// Fire the loading // Fire the loading
......
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
} }
} }
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "})();"; var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "\n})();";
eval(_script); eval(_script);
if (pluginData.getAttribute("recalculate") == true) if (pluginData.getAttribute("recalculate") == true)
......
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