diff --git a/tests/word/shortcuts/shortcuts.js b/tests/word/shortcuts/shortcuts.js index 32ee50ed6b..57bb374e70 100644 --- a/tests/word/shortcuts/shortcuts.js +++ b/tests/word/shortcuts/shortcuts.js @@ -1322,8 +1322,10 @@ TurnOnRecalculate(); ClearDocumentAndAddParagraph(''); const complexForm = AddComplexForm(); + AscTest.Recalculate(); + assert.strictEqual(complexForm.GetLinesCount(), 1, "Check line count before adding line break"); ExecuteHotkey(testHotkeyActions.addBreakLineInlineLvlSdt); - assert.strictEqual(complexForm.Lines[0], 2, "Check add break line"); + assert.strictEqual(complexForm.GetLinesCount(), 2, "Check line count after adding line break"); TurnOffRecalculate(); }); diff --git a/word/Editor/Document.js b/word/Editor/Document.js index 15b71210c2..5e1c478c1f 100644 --- a/word/Editor/Document.js +++ b/word/Editor/Document.js @@ -9750,8 +9750,21 @@ CDocument.prototype.executeShortcut = function(type) { if (!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content, null, false, this.IsFormFieldEditing())) { + let selectedInfo = this.GetSelectedElementsInfo(); + let math = selectedInfo.GetMath(); + this.StartAction(AscDFH.historydescription_Document_EnterButton); - this.AddToParagraph(new AscWord.CRunBreak(AscWord.break_Line)); + if (math && math.Is_InInnerContent()) + { + math.Handle_AddNewLine(); + math.ProcessAutoCorrect(); + // TODO: Implement case !math.Is_InInnerContent() + } + else + { + this.AddToParagraph(new AscWord.CRunBreak(AscWord.break_Line)); + } + this.Recalculate(); this.FinalizeAction(); result = true; } @@ -11841,9 +11854,14 @@ CDocument.prototype.EndFormEditing = function() if (oInlineSdt && oInlineSdt.IsForm()) { if (oInlineSdt.IsFixedForm()) + { this.EndDrawingEditing(); + } else + { + this.RemoveSelection(); oInlineSdt.MoveCursorOutsideElement(true); + } this.UpdateSelection(); this.UpdateInterface(); diff --git a/word/Editor/ParagraphContentBase.js b/word/Editor/ParagraphContentBase.js index b5b846caaf..0e8f3d662e 100644 --- a/word/Editor/ParagraphContentBase.js +++ b/word/Editor/ParagraphContentBase.js @@ -56,6 +56,10 @@ CParagraphContentBase.prototype.GetLogicDocument = function() { return this.Paragraph ? this.Paragraph.GetLogicDocument() : null; }; +CParagraphContentBase.prototype.GetLinesCount = function() +{ + return 0; +}; CParagraphContentBase.prototype.CanSplit = function() { return false; @@ -1062,6 +1066,10 @@ CParagraphContentWithContentBase.prototype.getRangePos = function(line, range) this.protected_GetRangeEndPos(_line, _range), ]; }; +CParagraphContentWithContentBase.prototype.GetLinesCount = function() +{ + return this.protected_GetLinesCount(); +}; // Здесь предполагается, что строки с номерами меньше, чем LineIndex заданы, а также заданы и отрезки в строке // LineIndex, с номерами меньшими, чем RangeIndex. В данной функции удаляются все записи, которые идут после LineIndex,