From 2a54664e120bfc4481ae021a792b1a7fead086d9 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Thu, 19 Sep 2024 14:59:14 +0300 Subject: [PATCH] Fix bug #70342 Fix autocorrection of the first letter in table cell --- tests/word/text-autocorrection/as-you-type.js | 2 -- word/Editor/Paragraph/Run/RunAutoCorrect.js | 16 ++++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/word/text-autocorrection/as-you-type.js b/tests/word/text-autocorrection/as-you-type.js index 27f0c50a18..d9145778de 100644 --- a/tests/word/text-autocorrection/as-you-type.js +++ b/tests/word/text-autocorrection/as-you-type.js @@ -57,8 +57,6 @@ $(function () assert.strictEqual(AscTest.GetParagraphText(p), checkText + " ", text + " -> " + checkText); } - - QUnit.test("Test: capitalize first letter of the sentence", function (assert) { logicDocument.SetAutoCorrectFirstLetterOfSentences(true); diff --git a/word/Editor/Paragraph/Run/RunAutoCorrect.js b/word/Editor/Paragraph/Run/RunAutoCorrect.js index 66d9458664..8a37e56ff8 100644 --- a/word/Editor/Paragraph/Run/RunAutoCorrect.js +++ b/word/Editor/Paragraph/Run/RunAutoCorrect.js @@ -769,17 +769,13 @@ if (!this.AsYouType) return false; - - if (!oDocument.IsAutoCorrectFirstLetterOfSentences()) + + let isCellFistLetter = (oRunElementsBefore.IsEnd() && oParagraph.IsTableCellContent()); + + if ((isCellFistLetter && !oDocument.IsAutoCorrectFirstLetterOfCells()) + || (!isCellFistLetter && !oDocument.IsAutoCorrectFirstLetterOfSentences())) return false; - - if (oRunElementsBefore.IsEnd() - && oParagraph.IsTableCellContent() - && !oDocument.IsAutoCorrectFirstLetterOfCells()) - { - return false; - } - + if ("www" === sText || "http" === sText || "https" === sText) return false;