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 = ...@@ -4903,133 +4903,99 @@ CMathContent.prototype =
} }
else 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 NewRuns;
var LRun, CRun, RRun; var LRun, CRun, RRun;
if(StartPos == EndPos)
{
NewRuns = this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, false);
LRun = NewRuns[0]; if( !this.Selection.Use || (this.Selection.Use && StartPos == EndPos) ) // TextPr меняем только в одном Run
CRun = NewRuns[1]; {
RRun = NewRuns[2]; var Pos = !this.Selection.Use ? this.CurPos : StartPos;
var CRunPos = StartPos; NewRuns = this.content[Pos].Apply_TextPr(TextPr, IncFontSize, false);
var Pos;
if(LRun !== null) LRun = NewRuns[0];
{ CRun = NewRuns[1];
this.Internal_Content_Add(StartPos+1, CRun); RRun = NewRuns[2];
CRunPos = StartPos + 1;
}
if(RRun !== null) var CRunPos = Pos;
{
this.Internal_Content_Add(CRunPos+1, RRun);
}
this.CurPos = CRunPos; if(LRun !== null)
this.Selection.Start = CRunPos;
this.Selection.End = CRunPos;
}
else
{ {
if(StartPos > EndPos) this.Internal_Content_Add(Pos+1, CRun);
{ CRunPos = Pos + 1;
var temp = StartPos; }
StartPos = EndPos;
EndPos = temp;
}
for(var i = StartPos + 1; i < EndPos; i++) if(RRun !== null)
this.content[i].Apply_TextPr(TextPr, IncFontSize, true ); {
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) }
{ else
NewRuns = this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, ApplyToAll); {
if(StartPos > EndPos)
{
var temp = StartPos;
StartPos = EndPos;
EndPos = temp;
}
// LRun - null for(var i = StartPos + 1; i < EndPos; i++)
CRun = NewRuns[1]; this.content[i].Apply_TextPr(TextPr, IncFontSize, true );
RRun = NewRuns[2];
if(RRun !== null)
{
this.Internal_Content_Add(EndPos+1, RRun);
}
} if(this.content[EndPos].Type == para_Math_Run)
else {
this.content[EndPos].Apply_TextPr(TextPr, IncFontSize, true); 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); this.Internal_Content_Add(EndPos+1, RRun);
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);
}
} }
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 ) if(LRun !== null)
{ {
elem = this.content[StartPos]; 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 else
{ this.content[StartPos].Apply_TextPr(TextPr, IncFontSize, true);
for(var i = StartPos; i <= EndPos; i++)
{
elem = this.content[i];
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 );
}
}*/ if ( this.Selection.Start < this.Selection.End && true === this.content[this.Selection.Start].Selection_IsEmpty(true) )
} this.Selection.Start++;
else else if ( this.Selection.End < this.Selection.Start && true === this.content[this.Selection.End].Selection_IsEmpty(true) )
{ this.Selection.End++;
this.content[this.CurPos].Apply_TextPr( TextPr, IncFontSize, false );
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