Commit b7bbf9ad authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Поправила баг : теперь при отсутствии селекта добавляем пустой ран на...

Поправила баг : теперь при отсутствии селекта добавляем пустой ран на Apply_TextPr с новыми текстовыми настройками 

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57205 954022d7-b5bf-4e40-9824-e11837661b57
parent ab39902f
......@@ -4903,133 +4903,99 @@ CMathContent.prototype =
}
else
{
if(this.Selection.Use)
{
var StartPos = this.Selection.Start;
var EndPos = this.Selection.End;
var StartPos = this.Selection.Start;
var EndPos = this.Selection.End;
var NewRuns;
var LRun, CRun, RRun;
if(StartPos == EndPos)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, false);
var NewRuns;
var LRun, CRun, RRun;
LRun = NewRuns[0];
CRun = NewRuns[1];
RRun = NewRuns[2];
if( !this.Selection.Use || (this.Selection.Use && StartPos == EndPos) ) // TextPr меняем только в одном Run
{
var Pos = !this.Selection.Use ? this.CurPos : StartPos;
var CRunPos = StartPos;
var Pos;
NewRuns = this.content[Pos].Apply_TextPr(TextPr, IncFontSize, false);
if(LRun !== null)
{
this.Internal_Content_Add(StartPos+1, CRun);
CRunPos = StartPos + 1;
}
LRun = NewRuns[0];
CRun = NewRuns[1];
RRun = NewRuns[2];
if(RRun !== null)
{
this.Internal_Content_Add(CRunPos+1, RRun);
}
var CRunPos = Pos;
this.CurPos = CRunPos;
this.Selection.Start = CRunPos;
this.Selection.End = CRunPos;
}
else
if(LRun !== null)
{
if(StartPos > EndPos)
{
var temp = StartPos;
StartPos = EndPos;
EndPos = temp;
}
this.Internal_Content_Add(Pos+1, CRun);
CRunPos = Pos + 1;
}
for(var i = StartPos + 1; i < EndPos; i++)
this.content[i].Apply_TextPr(TextPr, IncFontSize, true );
if(RRun !== null)
{
this.Internal_Content_Add(CRunPos+1, RRun);
}
this.CurPos = CRunPos;
this.Selection.Start = CRunPos;
this.Selection.End = CRunPos;
if(this.content[EndPos].Type == para_Math_Run)
{
NewRuns = this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
else
{
if(StartPos > EndPos)
{
var temp = StartPos;
StartPos = EndPos;
EndPos = temp;
}
// LRun - null
CRun = NewRuns[1];
RRun = NewRuns[2];
for(var i = StartPos + 1; i < EndPos; i++)
this.content[i].Apply_TextPr(TextPr, IncFontSize, true );
if(RRun !== null)
{
this.Internal_Content_Add(EndPos+1, RRun);
}
}
else
this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, true);
if(this.content[EndPos].Type == para_Math_Run)
{
NewRuns = this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, false);
// LRun - null
CRun = NewRuns[1];
RRun = NewRuns[2];
if(this.content[StartPos].Type == para_Math_Run)
if(RRun !== null)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
LRun = NewRuns[0];
CRun = NewRuns[1];
// RRun - null
if(LRun !== null)
{
//Pos = StartPos + 1;
//History.Add(this, {Type: historyitem_Math_AddItem, Pos: Pos, PosEnd: Pos+1, Items: [CRun]});
//this.content.splice(Pos, 0, CRun);
this.Internal_Content_Add(StartPos+1, CRun);
}
this.Internal_Content_Add(EndPos+1, RRun);
}
else
this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, true);
}
else
this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, true);
if ( this.Selection.Start < this.Selection.End && true === this.content[this.Selection.Start].Selection_IsEmpty(true) )
this.Selection.Start++;
else if ( this.Selection.End < this.Selection.Start && true === this.content[this.Selection.End].Selection_IsEmpty(true) )
this.Selection.End++;
if ( this.Selection.Start < this.Selection.End && true === this.content[this.Selection.End].Selection_IsEmpty(true) )
this.Selection.End--;
else if ( this.Selection.End < this.Selection.Start && true === this.content[this.Selection.Start].Selection_IsEmpty(true) )
this.Selection.Start--;
}
if(this.content[StartPos].Type == para_Math_Run)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, false);
LRun = NewRuns[0];
CRun = NewRuns[1];
// RRun - null
/*if ( StartPos === EndPos )
{
elem = this.content[StartPos];
if(LRun !== null)
{
this.Internal_Content_Add(StartPos+1, CRun);
}
if( elem.Type == para_Math_Composition)
elem.Apply_TextPr( TextPr, IncFontSize, true );
else if(elem.Type == para_Math_Run)
elem.Apply_TextPr( TextPr, IncFontSize, false );
}
else
{
for(var i = StartPos; i <= EndPos; i++)
{
elem = this.content[i];
this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, true);
if( elem.Type == para_Math_Composition)
elem.Apply_TextPr( TextPr, IncFontSize, true );
else if(elem.Type == para_Math_Run)
elem.Apply_TextPr( TextPr, IncFontSize, false );
}
}*/
}
else
{
this.content[this.CurPos].Apply_TextPr( TextPr, IncFontSize, false );
if ( this.Selection.Start < this.Selection.End && true === this.content[this.Selection.Start].Selection_IsEmpty(true) )
this.Selection.Start++;
else if ( this.Selection.End < this.Selection.Start && true === this.content[this.Selection.End].Selection_IsEmpty(true) )
this.Selection.End++;
if ( this.Selection.Start < this.Selection.End && true === this.content[this.Selection.End].Selection_IsEmpty(true) )
this.Selection.End--;
else if ( this.Selection.End < this.Selection.Start && true === this.content[this.Selection.Start].Selection_IsEmpty(true) )
this.Selection.Start--;
}
}
},
......
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