Skip to content

Commit

Permalink
Merge branch 'release/v8.2.0' into fix/bug-70323
Browse files Browse the repository at this point in the history
  • Loading branch information
IgolJack committed Sep 20, 2024
2 parents 137875d + 78ae917 commit b0c5e40
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 31 deletions.
6 changes: 3 additions & 3 deletions common/CollaborativeEditingBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@
};
CCollaborativeChanges.prototype.private_SaveData = function(Binary)
{
var Writer = AscCommon.History.BinaryWriter;
var Pos = Binary.Pos;
var Len = Binary.Len;
let Writer = AscCommon.History.BinaryWriter;
let Pos = Binary.Pos;
let Len = Binary.Len;
if ((Asc.editor || editor).binaryChanges) {
return Writer.GetDataUint8(Pos, Len);
} else {
Expand Down
18 changes: 3 additions & 15 deletions common/wordcopypaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -4425,21 +4425,9 @@ PasteProcessor.prototype =
if (drawings && drawings.length) {
let paste_callback = function () {
if (false === oThis.bNested) {
let oIdMap = {};
let aCopies = [];
let oCopyPr = new AscFormat.CCopyObjectProperties();
oCopyPr.idMap = oIdMap;

for (let i = 0; i < arr_shapes.length; ++i) {
let shape = arr_shapes[i].graphicObject.copy(oCopyPr);
aCopies.push(shape);
oIdMap[arr_shapes[i].graphicObject.Id] = shape.Id;
shape.worksheet = null;
shape.drawingBase = null;

arr_shapes[i] = new AscPDF.DrawingCopyObject(shape, 0, 0, 0, 0);
}
AscFormat.fResetConnectorsIds(aCopies, oIdMap);
arr_shapes = arr_shapes.map(function(drawing) {
return new AscPDF.DrawingCopyObject(drawing.graphicObject, 0, 0, 0, 0);
});

let oPDFSelContent = new AscPDF.PDFSelectedContent();
oPDFSelContent.Drawings = arr_shapes;
Expand Down
22 changes: 21 additions & 1 deletion pdf/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@
}, AscDFH.historydescription_Pdf_AddAnnot, this);
}

if (oDoc.checkDefaultFonts(addFreeText)) {
if (oDoc.checkFonts(["Arial"], addFreeText)) {
addFreeText();
}
};
Expand Down Expand Up @@ -1736,6 +1736,18 @@
window["AscDesktopEditor"]["onDocumentModifiedChanged"](bValue);
}
};
PDFEditorApi.prototype.CheckChangedDocument = function() {
let oDoc = this.getPDFDoc();

if (true === oDoc.History.Have_Changes()) {
this.SetDocumentModified(true);
}
else {
this.SetDocumentModified(false);
}

this._onUpdateDocumentCanSave();
};
PDFEditorApi.prototype._autoSaveInner = function() {
let _curTime = new Date();
if (null === this.lastSaveTime) {
Expand Down Expand Up @@ -2462,6 +2474,13 @@
PDFEditorApi.prototype.sync_ContextMenuCallback = function(Data) {
this.sendEvent("asc_onContextMenu", new CPdfContextMenuData(Data));
};
PDFEditorApi.prototype._finalizeAction = function() {
let oDoc = this.getPDFDoc();
if (!oDoc){
return;
}
oDoc.FinalizeAction(true);
};

PDFEditorApi.prototype._waitPrint = function(actionType, options)
{
Expand Down Expand Up @@ -2546,6 +2565,7 @@
PDFEditorApi.prototype['asc_getHeaderFooterProperties'] = PDFEditorApi.prototype.asc_getHeaderFooterProperties;
PDFEditorApi.prototype['ChangeReaderMode'] = PDFEditorApi.prototype.ChangeReaderMode;

PDFEditorApi.prototype['CheckChangedDocument'] = PDFEditorApi.prototype.CheckChangedDocument;
PDFEditorApi.prototype['SetDrawingFreeze'] = PDFEditorApi.prototype.SetDrawingFreeze;
PDFEditorApi.prototype['OnMouseUp'] = PDFEditorApi.prototype.OnMouseUp;

Expand Down
10 changes: 8 additions & 2 deletions pdf/src/CollaborativeEditing.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,18 @@ CPDFCollaborativeEditing.prototype.GetDocument = function() {
CPDFCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, AdditionalInfo, IsUpdateInterface, isAfterAskSave) {
if (!this.canSendChanges())
return;

// Пересчитываем позиции
this.Refresh_DCChanges();

let oDoc = this.GetDocument();
let oHistory = oDoc.History;


let localHistory = AscCommon.History;
AscCommon.History = oHistory;

AscCommon.DocumentEditorApi.prototype.asc_Save.apply(this, arguments);


// Генерируем свои изменения
let StartPoint = ( null === oHistory.SavedIndex ? 0 : oHistory.SavedIndex + 1 );
let LastPoint = -1;
Expand Down Expand Up @@ -222,6 +227,7 @@ CPDFCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, Additiona
}

editor.WordControl.m_oLogicDocument.getCompositeInput().checkState();
AscCommon.History = localHistory;
};
CPDFCollaborativeEditing.prototype.OnEnd_Load_Objects = function()
{
Expand Down
1 change: 1 addition & 0 deletions pdf/src/GraphicObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@
CGraphicObjects.prototype.getDrawingsPasteShift = AscFormat.DrawingObjectsController.prototype.getDrawingsPasteShift;
CGraphicObjects.prototype.endTrackNewShape = AscFormat.DrawingObjectsController.prototype.endTrackNewShape;
CGraphicObjects.prototype.removeCallback = AscFormat.DrawingObjectsController.prototype.removeCallback;
CGraphicObjects.prototype.getAllSingularDrawings = AscFormat.DrawingObjectsController.prototype.getAllSingularDrawings;

CGraphicObjects.prototype.startRecalculate = function() {};

Expand Down
8 changes: 6 additions & 2 deletions pdf/src/annotations/textPrTrackHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@

if (!oAnnot)
return null;


let oDoc = oAnnot.GetDocument();
if (!oDoc) {
return null;
}

let aOrigRect = oAnnot.GetOrigRect();
let aRD = oAnnot.GetRectangleDiff() || [0, 0, 0, 0]; // отступ координат фигуры с текстом от ректа аннотации
let nPage = oAnnot.GetPage();
let oDoc = oAnnot.GetDocument();
let oTr = oDoc.pagesTransform[nPage].invert;

let aFreeTextRect = []; // прямоугольник
Expand Down
16 changes: 13 additions & 3 deletions pdf/src/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,16 +1205,26 @@ var CPresentation = CPresentation || function(){};
PDFSelectedContent.prototype.copy = function() {
let oCopy = new PDFSelectedContent();

let oIdMap = {};
let oCopyPr = new AscFormat.CCopyObjectProperties();
oCopyPr.idMap = oIdMap;

for (let i = 0; i < this.Drawings.length; i++) {
let oCopyDrawingObj = this.Drawings[i].Drawing.copy(oCopyPr);
oIdMap[this.Drawings[i].Drawing.GetId()] = oCopyDrawingObj.GetId();
oCopy.Drawings.push({
Drawing: this.Drawings[i].Drawing.copy(),
Drawing: oCopyDrawingObj,
ExtX: this.Drawings[i].ExtX,
X: this.Drawings[i].X,
Y: this.Drawings[i].Y,
base64: this.Drawings[i].base64
});
}

AscFormat.fResetConnectorsIds(oCopy.Drawings.map(function(drawing) {
return drawing.Drawing;
}), oIdMap);

if (this.DocContent) {
//TODO: перенести копирование в CSelectedContent;
oCopy.DocContent = new AscCommonWord.CSelectedContent();
Expand Down Expand Up @@ -4724,7 +4734,7 @@ var CPresentation = CPresentation || function(){};
case AscPDF.FREE_TEXT_INTENT_TYPE.FreeText: {
oFreeText.SetIntent(AscPDF.FREE_TEXT_INTENT_TYPE.FreeText);
oFreeText.SetSubject('Text box');
return;
break;
}
// прописываем RD и Callout
case AscPDF.FREE_TEXT_INTENT_TYPE.FreeTextCallout: {
Expand Down Expand Up @@ -4782,7 +4792,7 @@ var CPresentation = CPresentation || function(){};
}

oFreeText.SetCallout([x1, y1, x2, y2, x3, y3]);
return;
break;
}
}

Expand Down
3 changes: 2 additions & 1 deletion pdf/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3513,7 +3513,8 @@
}
else if ( e.KeyCode == 83 && true === e.CtrlKey ) // Ctrl + S + ...
{
// nothing
oDoc.BlurActiveObject();
this.Api.asc_Save(false);
bRetValue = true;
}
else if ( e.KeyCode == 89 && true === e.CtrlKey ) // Ctrl + Y
Expand Down
13 changes: 9 additions & 4 deletions word/Math/mathContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6081,13 +6081,17 @@ CMathContent.prototype.GetTextContent = function(bSelectedText, isLaTeX)
isLaTeX = false;

let nStartPos = 0;
let nEndPos = this.Content.length;
let nEndPos = this.Content.length - 1;
let oMathText = new AscMath.MathTextAndStyles(isLaTeX);

if (bSelectedText)
{
nStartPos = (this.Selection.Use == true ? Math.min(this.Selection.StartPos, this.Selection.EndPos) : this.CurPos.ContentPos);
nEndPos = (this.Selection.Use == true ? Math.max(this.Selection.StartPos, this.Selection.EndPos) : this.CurPos.ContentPos);
nStartPos = this.Selection.Use == true
? Math.min(this.Selection.StartPos, this.Selection.EndPos)
: this.CurPos.ContentPos;
nEndPos = this.Selection.Use == true
? Math.max(this.Selection.StartPos, this.Selection.EndPos)
: this.CurPos.ContentPos;
}

for (let i = nStartPos; i <= nEndPos; i++)
Expand All @@ -6096,7 +6100,8 @@ CMathContent.prototype.GetTextContent = function(bSelectedText, isLaTeX)
oMathText.Add(oElement, false, false, bSelectedText);
}

return {str: oMathText.GetText(), content: oMathText};
let strContent = oMathText.GetText();
return {str: strContent, content: oMathText};
};

var g_DefaultAutoCorrectMathFuncs =
Expand Down

0 comments on commit b0c5e40

Please sign in to comment.