Commit d949eb38 authored by Oleg Korshul's avatar Oleg Korshul

.

parent 13b31cf3
...@@ -396,7 +396,6 @@ ...@@ -396,7 +396,6 @@
this.documents = _docs; this.documents = _docs;
this.returnDocuments = []; this.returnDocuments = [];
this.current = -1; this.current = -1;
this.isAsync = false;
this.start = function() this.start = function()
{ {
...@@ -427,14 +426,12 @@ ...@@ -427,14 +426,12 @@
return; return;
} }
var LogicDocument = this.WordControl.m_oLogicDocument; var LogicDocument = this.api.WordControl.m_oLogicDocument;
if (0 == this.current) if (0 == this.current)
LogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_InsertDocumentsByUrls); LogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_InsertDocumentsByUrls);
while (true) // no recursion while (this.current < this.documents.length) // no recursion
{ {
this.isAsync = true;
if (false === LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_Content_Add)) if (false === LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_Content_Add))
{ {
var _current = this.documents[this.current]; var _current = this.documents[this.current];
...@@ -455,12 +452,15 @@ ...@@ -455,12 +452,15 @@
if (_current.Url !== undefined) if (_current.Url !== undefined)
{ {
// insert/replace document // insert/replace document
this.insertDocumentUrlsData = {imageMap: null, documents: arrDocuments, oSdt: null, endCallback : function(_api, _props) { this.api.insertDocumentUrlsData = {imageMap: null, documents: [{url : _current.Url, format: _current.Format}], oSdt: null, endCallback : function(_api, _props) {
_api.__content_control_worker.isAsync = false;
_api.__content_control_worker.returnDocuments.push(_props); _api.__content_control_worker.returnDocuments.push(_props);
_api.__content_control_worker.run();
setTimeout(function() {
window.g_asc_plugins.api.__content_control_worker.run();
}, 1);
}}; }};
this.asc_DownloadAs(Asc.c_oAscFileType.CANVAS_WORD); this.api.asc_DownloadAs(Asc.c_oAscFileType.CANVAS_WORD);
return;
} }
else if (_current.Script !== undefined) else if (_current.Script !== undefined)
{ {
...@@ -477,6 +477,9 @@ ...@@ -477,6 +477,9 @@
this.returnDocuments.push(_blockStd.GetContentControlPr()); this.returnDocuments.push(_blockStd.GetContentControlPr());
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + _current.Script + "\n})();";
eval(_script);
if(_blockStd.Content.Get_ElementsCount() > 1) if(_blockStd.Content.Get_ElementsCount() > 1)
{ {
_blockStd.Content.Remove_FromContent(_blockStd.Content.Get_ElementsCount() - 1 , 1); _blockStd.Content.Remove_FromContent(_blockStd.Content.Get_ElementsCount() - 1 , 1);
...@@ -484,9 +487,6 @@ ...@@ -484,9 +487,6 @@
} }
LogicDocument.MoveCursorRight(false, false, true); LogicDocument.MoveCursorRight(false, false, true);
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + _current.Script + "\n})();";
eval(_script);
var _fonts = LogicDocument.Document_Get_AllFontNames(); var _fonts = LogicDocument.Document_Get_AllFontNames();
var _imagesArray = LogicDocument.Get_AllImageUrls(); var _imagesArray = LogicDocument.Get_AllImageUrls();
var _images = {}; var _images = {};
...@@ -499,14 +499,18 @@ ...@@ -499,14 +499,18 @@
AscCommon.Check_LoadingDataBeforePrepaste(window.g_asc_plugins.api, _fonts, _images, AscCommon.Check_LoadingDataBeforePrepaste(window.g_asc_plugins.api, _fonts, _images,
function() function()
{ {
window.g_asc_plugins.api.__content_control_worker.isAsync = false; var _api = window.g_asc_plugins.api;
delete window.g_asc_plugins.images_rename; delete window.g_asc_plugins.images_rename;
window.g_asc_plugins.api.asc_Recalculate(); _api.asc_Recalculate();
window.g_asc_plugins.api.WordControl.m_oLogicDocument.UnlockPanelStyles(true); _api.WordControl.m_oLogicDocument.UnlockPanelStyles(true);
window.g_asc_plugins.api.__content_control_worker.run(); setTimeout(function() {
window.g_asc_plugins.api.__content_control_worker.run();
}, 1);
}); });
return;
} }
else else
{ {
...@@ -514,12 +518,7 @@ ...@@ -514,12 +518,7 @@
var _blockStd = LogicDocument.GetContentControl(_content_control_pr.InternalId); var _blockStd = LogicDocument.GetContentControl(_content_control_pr.InternalId);
_blockStd.SetContentControlPr(_content_control_pr); _blockStd.SetContentControlPr(_content_control_pr);
this.returnDocuments.push(_blockStd.GetContentControlPr()); this.returnDocuments.push(_blockStd.GetContentControlPr());
this.isAsync = false;
} }
if (this.isAsync)
return;
} }
++this.current; ++this.current;
...@@ -2352,7 +2351,7 @@ background-repeat: no-repeat;\ ...@@ -2352,7 +2351,7 @@ background-repeat: no-repeat;\
asc_docs_api.prototype.endInsertDocumentUrls = function() asc_docs_api.prototype.endInsertDocumentUrls = function()
{ {
if (this.insertDocumentUrlsData) { if (this.insertDocumentUrlsData) {
this.insertDocumentUrlsData.endCallback(); this.insertDocumentUrlsData.endCallback(this);
this.insertDocumentUrlsData = null; this.insertDocumentUrlsData = null;
//this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); //this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
} }
......
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