Commit 9779307c authored by Sergey Luzyanin's avatar Sergey Luzyanin

don't insert text in formulas

parent 5cf688d9
...@@ -1136,10 +1136,44 @@ ...@@ -1136,10 +1136,44 @@
if (null != paragraph && type_Paragraph == paragraph.GetType() && selectedContent.Elements && selectedContent.Elements.length) if (null != paragraph && type_Paragraph == paragraph.GetType() && selectedContent.Elements && selectedContent.Elements.length)
{ {
var NearPos = {Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false)}; var NearPos = {Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false)};
NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) };
paragraph.Check_NearestPos(NearPos);
var ParaNearPos = NearPos.Paragraph.Get_ParaNearestPos(NearPos);
if (null === ParaNearPos || ParaNearPos.Classes.length < 2)
return;
var LastClass = ParaNearPos.Classes[ParaNearPos.Classes.length - 1];
if (para_Math_Run === LastClass.Type)
{
// Проверяем, что вставляемый контент тоже формула
var Element = selectedContent.Elements[0].Element;
if (1 !== selectedContent.Elements.length || type_Paragraph !== Element.Get_Type() || null === LastClass.Parent)
return;
var Math = null;
var Count = Element.Content.length;
for (var Index = 0; Index < Count; Index++)
{
var Item = Element.Content[Index];
if (para_Math === Item.Type && null === Math)
Math = Element.Content[Index];
else if (true !== Item.Is_Empty({SkipEnd : true}))
return;
}
}
else if (para_Run !== LastClass.Type)
return;
if (null === paragraph.Parent || undefined === paragraph.Parent)
return;
paragraph.Check_NearestPos(NearPos); paragraph.Check_NearestPos(NearPos);
target_doc_content.Insert_Content(selectedContent, NearPos); target_doc_content.Insert_Content(selectedContent, NearPos);
worksheet.objectRender.controller.cursorMoveRight(false, false) worksheet.objectRender.controller.cursorMoveRight(false, false);
var oTargetTextObject = AscFormat.getTargetTextObject(worksheet.objectRender.controller); var oTargetTextObject = AscFormat.getTargetTextObject(worksheet.objectRender.controller);
oTargetTextObject && oTargetTextObject.checkExtentsByDocContent && oTargetTextObject.checkExtentsByDocContent(); oTargetTextObject && oTargetTextObject.checkExtentsByDocContent && oTargetTextObject.checkExtentsByDocContent();
......
...@@ -4050,6 +4050,38 @@ CPresentation.prototype = ...@@ -4050,6 +4050,38 @@ CPresentation.prototype =
{ {
NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) }; NearPos = { Paragraph: paragraph, ContentPos: paragraph.Get_ParaContentPos(false, false) };
paragraph.Check_NearestPos(NearPos); paragraph.Check_NearestPos(NearPos);
var ParaNearPos = NearPos.Paragraph.Get_ParaNearestPos(NearPos);
if (null === ParaNearPos || ParaNearPos.Classes.length < 2)
return;
var LastClass = ParaNearPos.Classes[ParaNearPos.Classes.length - 1];
if (para_Math_Run === LastClass.Type)
{
// Проверяем, что вставляемый контент тоже формула
var Element = Content.DocContent.Elements[0].Element;
if (1 !== Content.DocContent.Elements.length || type_Paragraph !== Element.Get_Type() || null === LastClass.Parent)
return;
var Math = null;
var Count = Element.Content.length;
for (var Index = 0; Index < Count; Index++)
{
var Item = Element.Content[Index];
if (para_Math === Item.Type && null === Math)
Math = Element.Content[Index];
else if (true !== Item.Is_Empty({SkipEnd : true}))
return;
}
}
else if (para_Run !== LastClass.Type)
return;
if (null === paragraph.Parent || undefined === paragraph.Parent)
return;
target_doc_content.Insert_Content(Content.DocContent, NearPos); target_doc_content.Insert_Content(Content.DocContent, NearPos);
} }
var oTargetTextObject = AscFormat.getTargetTextObject(this.Slides[this.CurPage].graphicObjects); var oTargetTextObject = AscFormat.getTargetTextObject(this.Slides[this.CurPage].graphicObjects);
......
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