Skip to content

Commit

Permalink
Fix bug #64668
Browse files Browse the repository at this point in the history
  • Loading branch information
KhromovNikita committed Oct 17, 2023
1 parent 0426658 commit d5ba42c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
28 changes: 27 additions & 1 deletion pdf/src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ var CPresentation = CPresentation || function(){};
CPDFDoc.prototype.DoUndo = function() {
let oViewer = editor.getDocumentRenderer();

this.TurnOffHistory();
if (AscCommon.History.Can_Undo())
{
this.currInkInDrawingProcess = null;
Expand Down Expand Up @@ -1176,6 +1177,7 @@ var CPresentation = CPresentation || function(){};
CPDFDoc.prototype.DoRedo = function() {
let oViewer = editor.getDocumentRenderer();

this.TurnOffHistory();
if (AscCommon.History.Can_Redo())
{
this.currInkInDrawingProcess = null;
Expand Down Expand Up @@ -1301,7 +1303,31 @@ var CPresentation = CPresentation || function(){};
CPDFDoc.prototype.GetActionsQueue = function() {
return this.actionsInfo;
};


CPDFDoc.prototype.EscapeForm = function() {
let oViewer = editor.getDocumentRenderer();

if (this.activeForm && this.activeForm.IsNeedDrawHighlight() == false) {
if (this.activeForm.GetType() == AscPDF.FIELD_TYPES.listbox) {
this.activeForm.UndoNotAppliedChanges();
}
else if (this.History.Index != -1) {
let oHistoryPoint = this.History.Points[this.History.Index];
if (oHistoryPoint.Additional.FormFilling == this.activeForm && oHistoryPoint.Additional.CanUnion != false) {
this.activeForm.UndoNotAppliedChanges();
}
}

if (this.activeForm.IsChanged() == false)
this.activeForm.SetDrawFromStream(true);

this.activeForm.AddToRedraw();
this.activeForm.SetDrawHighlight(true);
oViewer.Api.WordControl.m_oDrawingDocument.TargetEnd();
oViewer._paint();
}
};

/**
* Adds a new page to the active document.
* @memberof CPDFDoc
Expand Down
2 changes: 2 additions & 0 deletions pdf/src/forms/combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@
CComboBoxField.prototype.CalcDocPos = AscPDF.CTextField.prototype.CalcDocPos;
CComboBoxField.prototype.GetCalcOrderIndex = AscPDF.CTextField.prototype.GetCalcOrderIndex;
CComboBoxField.prototype.SetCalcOrderIndex = AscPDF.CTextField.prototype.SetCalcOrderIndex;
CComboBoxField.prototype.UndoNotAppliedChanges = AscPDF.CTextField.prototype.UndoNotAppliedChanges;
CComboBoxField.prototype.UnionLastHistoryPoints = AscPDF.CTextField.prototype.UnionLastHistoryPoints;

window["AscPDF"].CComboBoxField = CComboBoxField;
})();
Expand Down
8 changes: 7 additions & 1 deletion pdf/src/forms/listbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,13 @@
}
}
};

CListBoxField.prototype.UndoNotAppliedChanges = function() {
this.SetValue(this.GetApiValue());
this.SetNeedRecalc(true);
this.AddToRedraw();
this.SetNeedCommit(false);
};

function TurnOffHistory() {
if (AscCommon.History.IsOn() == true)
AscCommon.History.TurnOff();
Expand Down
8 changes: 3 additions & 5 deletions pdf/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2993,11 +2993,9 @@
{
this.Api.sync_MarkerFormatCallback(false);
}
else if (oDoc.activeForm)
{
// to do отмена ввода
}


oDoc.EscapeForm();

editor.sync_HideComment();
}
else if (e.KeyCode === 32) // Space
Expand Down

0 comments on commit d5ba42c

Please sign in to comment.