Commit 58941eee authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлены баги, которые возникали при проверке орфографии: зацикливание...

Исправлены баги, которые возникали при проверке орфографии: зацикливание проверки на текущем параграфе, баг с неправильным порядком проверки вариантов слова и проверки орфографии параграфа целиком (правка 59932 переделана на более надежный вариант).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61330 954022d7-b5bf-4e40-9824-e11837661b57
parent 4758f606
......@@ -157,14 +157,19 @@ CDocumentSpelling.prototype =
}
},
Add_WaitingParagraph : function(Para)
Add_WaitingParagraph : function(Para, RecalcId, Words, Langs)
{
var ParaId = Para.Get_Id();
if (undefined === this.WaitingParagraphs[ParaId])
var WPara = this.WaitingParagraphs[ParaId];
if (undefined === WPara || RecalcId !== WPara.RecalcId || true !== this.private_CompareWordsAndLangs(WPara.Words, Words, WPara.Langs, Langs))
{
this.WaitingParagraphs[Para.Get_Id()] = Para;
this.WaitingParagraphs[ParaId] = {Words : Words, Langs : Langs, RecalcId : RecalcId};
this.WaitingParagraphsCount++;
return true;
}
return false;
},
Check_WaitingParagraph : function(Para)
......@@ -184,6 +189,20 @@ CDocumentSpelling.prototype =
delete this.WaitingParagraphs[ParaId];
this.WaitingParagraphsCount--;
}
},
private_CompareWordsAndLangs : function(Words1, Words2, Langs1, Langs2)
{
if (undefined === Words1 || undefined === Words2 || undefined === Langs1 || undefined === Langs2 || Words1.length !== Words2.length || Words1.length !== Langs1.length || Words1.length !== Langs2.length)
return false;
for (var nIndex = 0, nCount = Words1.length; nIndex < nCount; nIndex++)
{
if (Words1[nIndex] !== Words2[nIndex] || Langs1[nIndex] !== Langs2[nIndex])
return false;
}
return true;
}
};
......@@ -298,9 +317,14 @@ CParaSpellChecker.prototype =
if ( 0 < usrWords.length )
{
editor.WordControl.m_oLogicDocument.Spelling.Add_WaitingParagraph(this.Paragraph);
this.RecalcId += "_checked";
spellCheck(editor, {"type": "spell", "ParagraphId": this.ParaId, "RecalcId" : this.RecalcId, "ElementId" : 0, "usrWords" : usrWords, "usrLang" : usrLang });
if (true === editor.WordControl.m_oLogicDocument.Spelling.Add_WaitingParagraph(this.Paragraph, this.RecalcId, usrWords, usrLang))
{
spellCheck(editor, {"type" : "spell", "ParagraphId" : this.ParaId, "RecalcId" : this.RecalcId, "ElementId" : 0, "usrWords" : usrWords, "usrLang" : usrLang });
}
else
{
// Значит данный параграф с таким запросом уже обрабатывается
}
}
else if ( undefined != ParagraphForceRedraw )
ParagraphForceRedraw.ReDraw();
......@@ -443,7 +467,7 @@ CParaSpellChecker.prototype =
Check_CallBack2: function(RecalcId, ElementId, usrVariants)
{
if ( RecalcId == this.RecalcId )
if (RecalcId == this.RecalcId && undefined !== this.Elements[ElementId])
{
this.Elements[ElementId].Variants = usrVariants[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment