From ea83126d5bef8e04affc63f07040e68bdc8981db Mon Sep 17 00:00:00 2001 From: EvgeniyIgol Date: Thu, 13 Nov 2025 08:30:47 +0300 Subject: [PATCH] [de] Update move cursor up/down and Document.InsertParagraphAtCursor method --- common/macro-recorder.js | 2 +- word/Editor/Document.js | 20 ++++++++++++-------- word/apiBuilder.js | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/common/macro-recorder.js b/common/macro-recorder.js index a055d9d79a..6181386266 100644 --- a/common/macro-recorder.js +++ b/common/macro-recorder.js @@ -642,7 +642,7 @@ + "\tdoc.GetRangeBySelect().GetAllParagraphs().forEach(para => {\n\t\tpara.SetNumbering(" + CounterStore.get('numbering') + ".GetLevel(0));\n\t\tpara.SetContextualSpacing(true)\n\t});\n" }, addParagraph : function(){ - return "\tdoc.EnterParagraph();\n"; + return "\tdoc.InsertParagraphAtCursor();\n"; }, addBlankPage : function(){return "\tdoc.InsertBlankPage();\n"}, addPageBreak : function(type){ diff --git a/word/Editor/Document.js b/word/Editor/Document.js index 901063b3eb..b96a5e1f3b 100644 --- a/word/Editor/Document.js +++ b/word/Editor/Document.js @@ -6495,10 +6495,6 @@ CDocument.prototype.MoveCursorUp = function(AddToSelect, CtrlKey) if (true === AscCommon.CollaborativeEditing.Get_GlobalLockSelection()) return; - this.AddMacroData(AscDFH.historydescription_Document_MoveCursorUp, [{ - isWord: CtrlKey, - isAddSelect: AddToSelect - }]); this.ResetWordSelection(); this.private_UpdateTargetForCollaboration(); this.Controller.MoveCursorUp(AddToSelect, CtrlKey); @@ -6508,10 +6504,6 @@ CDocument.prototype.MoveCursorDown = function(AddToSelect, CtrlKey) if (true === AscCommon.CollaborativeEditing.Get_GlobalLockSelection()) return; - this.AddMacroData(AscDFH.historydescription_Document_MoveCursorDown, [{ - isWord: CtrlKey, - isAddSelect: AddToSelect - }]); this.ResetWordSelection(); this.private_UpdateTargetForCollaboration(); this.Controller.MoveCursorDown(AddToSelect, CtrlKey); @@ -20106,6 +20098,12 @@ CDocument.prototype.controller_MoveCursorUp = function(AddToSelect) this.private_UpdateCursorXY(false, true); var Result = this.private_MoveCursorUp(this.CurPos.RealX, this.CurPos.RealY, AddToSelect); + if (Result) + this.AddMacroData(AscDFH.historydescription_Document_MoveCursorUp, [{ + isWord: false, + isAddSelect: AddToSelect + }]); + // TODO: Вообще Word селектит до начала данной колонки в таком случае, а не до начала документа if (true === AddToSelect && true !== Result) this.MoveCursorToStartPos(true); @@ -20136,6 +20134,12 @@ CDocument.prototype.controller_MoveCursorDown = function(AddToSelect) this.private_UpdateCursorXY(false, true); var Result = this.private_MoveCursorDown(this.CurPos.RealX, this.CurPos.RealY, AddToSelect); + if (Result) + this.AddMacroData(AscDFH.historydescription_Document_MoveCursorDown, [{ + isWord: false, + isAddSelect: AddToSelect + }]); + if (true === AddToSelect && true !== Result) this.MoveCursorToEndPos(true); diff --git a/word/apiBuilder.js b/word/apiBuilder.js index 37a723781f..6abcbab691 100644 --- a/word/apiBuilder.js +++ b/word/apiBuilder.js @@ -9444,9 +9444,9 @@ * @returns {boolean} * @typeofeditors ["CDE"] * @since 9.2.0 - * @see office-js-api/Examples/{Editor}/ApiDocument/Methods/EnterParagraph.js + * @see office-js-api/Examples/{Editor}/ApiDocument/Methods/InsertParagraphAtCursor.js */ - ApiDocument.prototype.EnterParagraph = function() + ApiDocument.prototype.InsertParagraphAtCursor = function() { this.Document.AddNewParagraph(); return true;