Commit dde0b744 authored by Sergey.Tsarkov's avatar Sergey.Tsarkov Committed by Alexander.Trofimov

вставка элементов в плейсхолдер

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56591 954022d7-b5bf-4e40-9824-e11837661b57
parent 02d918fb
...@@ -155,41 +155,55 @@ ParaMath.prototype = ...@@ -155,41 +155,55 @@ ParaMath.prototype =
} }
else if ( para_Math === Type ) else if ( para_Math === Type )
{ {
var nPosStart = oStartContent.State.ContentPos; if (oStartContent.typeObj == MATH_PLACEHOLDER)
var nLenStart = oStartContent.Content.length;
var nPosEnd = oEndContent.State.ContentPos;
History.Create_NewPoint();
if(nPosStart != nLenStart)
{ {
var oMRun = new ParaRun(this.Paragraph, true); History.Create_NewPoint();
oMRun.Pr = oStartContent.Pr;
var Items = [];
for (var i=nPosStart; i<nLenStart; i++) Items.push(oContent.Content.content[0]);
oContent.Content.content.splice( 0, 1 );
History.Add(oContent.Content, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: 0});
oContent.Content.Load_FromMenu(Item.Menu, this.Paragraph);
}
else
{
nPosStart = oStartContent.State.ContentPos;
nLenStart = oStartContent.Content.length;
nPosEnd = oEndContent.State.ContentPos;
History.Create_NewPoint();
if(nPosStart != nLenStart) //вставка идет в mathcontent
{ {
var Pos = oMRun.Content.length; var oMRun = new ParaRun(this.Paragraph, true);
var EndPos = Pos + 1; oMRun.Pr = oStartContent.Pr;
var oItem = oStartContent.Content[i];
oMRun.Add(oItem); for (i=nPosStart; i<nLenStart; i++)
oStartContent.Remove_FromContent(i, 1, false); {
var Pos = oMRun.Content.length;
var EndPos = Pos + 1;
var oItem = oStartContent.Content[i];
oMRun.Add(oItem);
oStartContent.Remove_FromContent(i, 1, false);
}
} }
}
oContent.Content.CurPos++; oContent.Content.CurPos++;
oContent.Content.Load_FromMenu(Item.Menu, this.Paragraph); oContent.Content.Load_FromMenu(Item.Menu, this.Paragraph);
if(nPosStart != nLenStart) if(nPosStart != nLenStart)
{ {
var items = []; var items = [];
oContent.Content.addElementToContent(oMRun); oContent.Content.addElementToContent(oMRun);
items.push(oMRun); items.push(oMRun);
var Pos = oContent.Content.CurPos, var Pos = oContent.Content.CurPos,
PosEnd = Pos + 1; PosEnd = Pos + 1;
History.Add(oContent.Content, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd}); History.Add(oContent.Content, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd});
}
oContent.Content.SetRunEmptyToContent(false);
} }
oContent.Content.SetRunEmptyToContent(false);
} }
}, },
...@@ -202,8 +216,27 @@ ParaMath.prototype = ...@@ -202,8 +216,27 @@ ParaMath.prototype =
if (oContent.Start == oContent.End) if (oContent.Start == oContent.End)
{ {
var oElem = oContent.Content.getElem(oContent.Start); var oElem = oContent.Content.getElem(oContent.Start);
if (oElem.typeObj == MATH_COMP || oElem.typeObj == MATH_PLACEHOLDER) if (oElem.typeObj == MATH_COMP)
this.RemoveElem(oContent, Direction, bOnAddText); this.RemoveElem(oContent, Direction, bOnAddText);
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == false)
return;
else if (oElem.typeObj == MATH_PLACEHOLDER && bOnAddText == true)
{
History.Create_NewPoint();
var Items = new Array();
Items.push(oContent.Content.content[0]);
oContent.Content.content.splice( 0, 1 );
History.Add(oContent.Content, {Type: historyitem_Math_RemoveItem, Items:Items, Pos: 0});
var oMRun = new ParaRun(this.Paragraph, true);
oContent.Content.addElementToContent(oMRun);
var items = new Array();
items.push(oMRun);
var Pos = oContent.Content.CurPos,
PosEnd = Pos + 1;
History.Add(oContent.Content, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd});
}
else //pararun else //pararun
{ {
History.Create_NewPoint(); History.Create_NewPoint();
......
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