From 8b882f387e1a98e103545befec0ac2524e0bb473 Mon Sep 17 00:00:00 2001 From: AlexeyMatveev686 Date: Fri, 29 Sep 2023 16:21:34 +0300 Subject: [PATCH] [plugins][macros] Change how plugin "Macros" works with history. --- common/apiBase.js | 4 ++++ common/plugins.js | 4 ++-- slide/Editor/Format/Presentation.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/apiBase.js b/common/apiBase.js index 3ab9688646..725db1bab6 100644 --- a/common/apiBase.js +++ b/common/apiBase.js @@ -3724,6 +3724,10 @@ if (!this.macros) return true; + // we shouldn't create a history point and update it if macros haven't been changed + if (this.macros.Data && this.macros.Data === sData) + return true; + if (true === AscCommon.CollaborativeEditing.Get_GlobalLock()) return true; diff --git a/common/plugins.js b/common/plugins.js index 2bc22972de..8ee8b4ed15 100644 --- a/common/plugins.js +++ b/common/plugins.js @@ -1264,7 +1264,7 @@ AscFonts.IsCheckSymbols = false; - if (task.recalculate === true) + if (task.recalculate === true && !AscCommon.History.Is_LastPointEmpty()) { this.api._afterEvalCommand(function() { window.g_asc_plugins.shiftCommand(commandReturnValue); @@ -1278,7 +1278,7 @@ case AscCommon.c_oEditorId.Word: case AscCommon.c_oEditorId.Presentation: { - this.api.WordControl.m_oLogicDocument.FinalizeAction(); + this.api.WordControl.m_oLogicDocument.FinalizeAction(true); break; } case AscCommon.c_oEditorId.Spreadsheet: diff --git a/slide/Editor/Format/Presentation.js b/slide/Editor/Format/Presentation.js index 826f18859c..84c1ff3906 100644 --- a/slide/Editor/Format/Presentation.js +++ b/slide/Editor/Format/Presentation.js @@ -12218,9 +12218,12 @@ CPresentation.prototype.StartAction = function (nDescription) { this.Create_NewHistoryPoint(nDescription); this.StopAnimationPreview(); }; -CPresentation.prototype.FinalizeAction = function () { +CPresentation.prototype.FinalizeAction = function (isCheckEmptyAction) { this.Recalculate(); this.Api.checkChangesSize(); + if (true === isCheckEmptyAction && AscCommon.History.Is_LastPointEmpty()) { + AscCommon.History.RemoveLastPoint(); + } }; CPresentation.prototype.IsSplitPageBreakAndParaMark = function () {