From d8eeb91261fb563cdb2704b13a3382416e0b2ed9 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Wed, 27 Nov 2024 13:23:25 +0300 Subject: [PATCH] [pdf] Fix composite input --- pdf/src/document.js | 65 ++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/pdf/src/document.js b/pdf/src/document.js index 0a71672f37..cbd24b8fb9 100644 --- a/pdf/src/document.js +++ b/pdf/src/document.js @@ -2647,7 +2647,36 @@ var CPresentation = CPresentation || function(){}; } } }; - + + CPDFDoc.prototype.DoAction = function(fAction, nDescription, oThis, Additional) { + let nChangesType; + + switch (nDescription) { + case AscDFH.historydescription_Document_BackSpaceButton: + case AscDFH.historydescription_Document_DeleteButton: + nChangesType = AscCommon.changestype_Delete; + break; + case AscDFH.historydescription_Pdf_FreeTextGeom: + case AscDFH.historydescription_CommonDrawings_EndTrack: + case AscDFH.historydescription_Pdf_FreeTextFitTextBox: + nChangesType = AscCommon.changestype_Drawing_Props; + break; + case AscDFH.historydescription_Document_ChangeComment: + case AscDFH.historydescription_Pdf_AddComment: + case AscDFH.historydescription_Pdf_RemoveComment: + nChangesType = AscCommon.changestype_2_Comment; + break; + } + + if (this.IsSelectionLocked(nChangesType, Additional)) { + return; + } + + this.StartAction(nDescription); + let result = fAction.call(oThis); + this.FinalizeAction(true); + return result; + }; /** * Начинаем новое действие, связанное с изменением документа * @param {number} nDescription - тип изменения, ex.: AscDFH.historydescription_Pdf_FieldCommit @@ -6612,35 +6641,11 @@ var CPresentation = CPresentation || function(){}; this.startPoint = -1; }; - CPDFDoc.prototype.DoAction = function(fAction, nDescription, oThis, Additional) { - let nChangesType; - - switch (nDescription) { - case AscDFH.historydescription_Document_BackSpaceButton: - case AscDFH.historydescription_Document_DeleteButton: - nChangesType = AscCommon.changestype_Delete; - break; - case AscDFH.historydescription_Pdf_FreeTextGeom: - case AscDFH.historydescription_CommonDrawings_EndTrack: - case AscDFH.historydescription_Pdf_FreeTextFitTextBox: - nChangesType = AscCommon.changestype_Drawing_Props; - break; - case AscDFH.historydescription_Document_ChangeComment: - case AscDFH.historydescription_Pdf_AddComment: - case AscDFH.historydescription_Pdf_RemoveComment: - nChangesType = AscCommon.changestype_2_Comment; - break; - } - - if (this.IsSelectionLocked(nChangesType, Additional)) { - return; - } - - this.StartAction(nDescription); - let result = fAction.call(oThis); - this.FinalizeAction(true); - return result; - }; + CPDFCompositeInput.prototype.doAction = function(action, description) { + this.pdfDocument.DoAction(function() { + action.bind(this)(); + }, description, this); + }; CPDFCompositeInput.prototype.checkState = function() {}; CPDFCompositeInput.prototype.canSquashChanges = function() { let localHistory = this.pdfDocument.GetHistory();