Commit e355e0c7 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented lock/unlock for updating of panel of styles.

parent cf899afd
......@@ -390,6 +390,16 @@
{
if (window.g_asc_plugins.api.asc_canPaste())
{
var editorId = window.g_asc_plugins.api.getEditorId();
if (AscCommon.c_oEditorId.Word === editorId ||
AscCommon.c_oEditorId.Presentation === editorId)
{
var oLogicDocument = window.g_asc_plugins.api.WordControl ?
window.g_asc_plugins.api.WordControl.m_oLogicDocument : null;
oLogicDocument.LockPanelStyles();
}
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "})();";
eval(_script);
......@@ -422,6 +432,7 @@
}
delete window.g_asc_plugins.images_rename;
window.g_asc_plugins.api.asc_Recalculate();
oLogicDocument.UnlockPanelStyles(true);
});
}
else if (AscCommon.c_oEditorId.Spreadsheet === editorId)
......
......@@ -1482,6 +1482,7 @@ function CDocument(DrawingDocument, isMainLogicDocument)
// Контролируем изменения интерфейса
this.ChangedStyles = []; // Объект с Id стилями, которые были изменены/удалены/добавлены
this.TurnOffPanelStyles = 0; // == 0 - можно обновлять панельку со стилями, != 0 - нельзя обновлять
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
this.TableId.Add(this, this.Id);
......@@ -10108,6 +10109,9 @@ CDocument.prototype.Add_ChangedStyle = function(arrStylesId)
};
CDocument.prototype.Document_UpdateStylesPanel = function()
{
if (0 !== this.TurnOffPanelStyles)
return;
var bNeedUpdate = false;
for (var StyleId in this.ChangedStyles)
{
......@@ -10122,6 +10126,17 @@ CDocument.prototype.Document_UpdateStylesPanel = function()
editor.GenerateStyles();
}
};
CDocument.prototype.LockPanelStyles = function()
{
this.TurnOffPanelStyles++;
};
CDocument.prototype.UnlockPanelStyles = function(isUpdate)
{
this.TurnOffPanelStyles = Math.max(0, this.TurnOffPanelStyles - 1);
if (true === isUpdate)
this.Document_UpdateStylesPanel();
};
CDocument.prototype.Get_AllParagraphs = function(Props)
{
var ParaArray = [];
......
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