Commit 8e658618 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Исправлен баг с заменой. Исправлен баг с мержом табов в стилях (баг 20248).

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49940 954022d7-b5bf-4e40-9824-e11837661b57
parent d088031f
...@@ -392,10 +392,10 @@ Paragraph.prototype = ...@@ -392,10 +392,10 @@ Paragraph.prototype =
// Передвинем все метки поиска // Передвинем все метки поиска
for ( var CurSearch in this.SearchResults ) for ( var CurSearch in this.SearchResults )
{ {
if ( this.SearchResults[CurSearch].StartPos > Pos ) if ( this.SearchResults[CurSearch].StartPos >= Pos )
this.SearchResults[CurSearch].StartPos++; this.SearchResults[CurSearch].StartPos++;
if ( this.SearchResults[CurSearch].EndPos > Pos ) if ( this.SearchResults[CurSearch].EndPos >= Pos )
this.SearchResults[CurSearch].EndPos++; this.SearchResults[CurSearch].EndPos++;
} }
...@@ -403,6 +403,27 @@ Paragraph.prototype = ...@@ -403,6 +403,27 @@ Paragraph.prototype =
this.SpellChecker.Update_OnAdd( this, Pos, Item ); this.SpellChecker.Update_OnAdd( this, Pos, Item );
}, },
Internal_Content_Add2 : function (Pos, Item, bCorrectPos)
{
if ( true === Item.Is_RealContent() )
{
var ClearPos = this.Internal_Get_ClearPos( Pos );
History.Add( this, { Type : historyitem_Paragraph_AddItem, Pos : ClearPos, EndPos : ClearPos, Items : [ Item ] } );
}
this.Content.splice( Pos, 0, Item );
// Передвинем все метки поиска
for ( var CurSearch in this.SearchResults )
{
if ( this.SearchResults[CurSearch].StartPos >= Pos )
this.SearchResults[CurSearch].StartPos++;
if ( this.SearchResults[CurSearch].EndPos >= Pos )
this.SearchResults[CurSearch].EndPos++;
}
},
// Добавляем несколько элементов в конец параграфа. // Добавляем несколько элементов в конец параграфа.
Internal_Content_Concat : function(Items) Internal_Content_Concat : function(Items)
{ {
......
...@@ -103,6 +103,7 @@ CDocumentSearch.prototype = ...@@ -103,6 +103,7 @@ CDocumentSearch.prototype =
Replace : function(NewStr, Id) Replace : function(NewStr, Id)
{ {
//var _NewStr =
var Para = this.Elements[Id]; var Para = this.Elements[Id];
if ( undefined != Para ) if ( undefined != Para )
{ {
...@@ -119,13 +120,15 @@ CDocumentSearch.prototype = ...@@ -119,13 +120,15 @@ CDocumentSearch.prototype =
Para.Internal_Content_Remove(Pos); Para.Internal_Content_Remove(Pos);
} }
var Len = NewStr.length; var Len = NewStr.length;
for ( var Pos = 0; Pos < Len; Pos++ ) for ( var Pos = 0; Pos < Len; Pos++ )
{ {
Para.Internal_Content_Add( StartPos + Pos, new ParaText( NewStr[Pos] ) ); Para.Internal_Content_Add2( StartPos + Pos, new ParaText( NewStr[Pos] ) );
} }
Para.RecalcInfo.Set_Type_0( pararecalc_0_All ); Para.RecalcInfo.Set_Type_0( pararecalc_0_All );
Para.RecalcInfo.Set_Type_0_Spell( pararecalc_0_Spell_All );
// Удаляем запись о данном элементе // Удаляем запись о данном элементе
this.Count--; this.Count--;
......
...@@ -7086,6 +7086,7 @@ CParaTabs.prototype = ...@@ -7086,6 +7086,7 @@ CParaTabs.prototype =
var _Tab = _Tabs[Index]; var _Tab = _Tabs[Index];
var Index2 = 0; var Index2 = 0;
var Flag = 0;
for (Index2 = 0; Index2 < this.Tabs.length; Index2++ ) for (Index2 = 0; Index2 < this.Tabs.length; Index2++ )
{ {
var Tab = this.Tabs[Index2]; var Tab = this.Tabs[Index2];
...@@ -7093,9 +7094,9 @@ CParaTabs.prototype = ...@@ -7093,9 +7094,9 @@ CParaTabs.prototype =
if ( Math.abs( Tab.Pos - _Tab.Pos ) < 0.001 ) if ( Math.abs( Tab.Pos - _Tab.Pos ) < 0.001 )
{ {
if ( tab_Clear === _Tab.Value ) if ( tab_Clear === _Tab.Value )
Index2 = -2; // таб нужно удалить Flag = -2; // таб нужно удалить
else else
Index2 = -1; // табы совпали, не надо новый добавлять Flag = -1; // табы совпали, не надо новый добавлять
break; break;
} }
...@@ -7104,9 +7105,9 @@ CParaTabs.prototype = ...@@ -7104,9 +7105,9 @@ CParaTabs.prototype =
break; break;
} }
if ( -2 === Index2 ) if ( -2 === Flag )
this.Tabs.splice( Index2, 1 ); this.Tabs.splice( Index2, 1 );
else if ( -1 != Index2 ) else if ( -1 != Flag )
this.Tabs.splice( Index2, 0, _Tab ); this.Tabs.splice( Index2, 0, _Tab );
} }
}, },
......
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