Skip to content

Commit

Permalink
[de] Refactor adding symbol to the math equation
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Nov 27, 2024
1 parent 4866dcf commit 0236c5e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
4 changes: 1 addition & 3 deletions word/Editor/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,11 @@ ParaMath.prototype.Add = function(Item)
this.Get_ParaContentPos(true, true, ContentPos);
else
this.Get_ParaContentPos(false, false, ContentPos);

var TextPr = this.Root.GetMathTextPrForMenu(ContentPos, 0);
if (Item.TextPr)
TextPr.Merge(Item.TextPr);

var bPlh = oContent.IsPlaceholder();

// Нам нужно разделить данный Run на 2 части
var RightRun = Run.Split2(Run.State.ContentPos);

Expand Down
30 changes: 12 additions & 18 deletions word/Math/mathContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2757,24 +2757,18 @@ CMathContent.prototype.private_LoadFromMenuSymbol = function(Type, Pr)
case c_oAscMathType.Symbol_Psi : Code = 0x03A8; break;
case c_oAscMathType.Symbol_Omega : Code = 0x03A9; break;
}

if (-1 !== Code)
{
var TextPr,
MathPr;

if (this.Content.length <= 0)
this.Correct_Content();

if(this.Content.length > 0 && this.Content[this.CurPos].Type == para_Math_Run && this.IsSelectionEmpty() == true) // находимся в Run, селект отсутствует
{
TextPr = this.Content[this.CurPos].Get_TextPr();
TextPr.RFonts.SetAll("Cambria Math", -1); // на данный момент добавляются символы исключительно из Cambria Math
MathPr = this.Content[this.CurPos].GetMathPr();
}

this.Add_Symbol(Code, TextPr, MathPr);
}

if (-1 === Code)
return;

if (this.Content.length <= 0)
this.Correct_Content();

let mathPr = undefined;
if (this.Content.length > 0 && this.Content[this.CurPos].Type == para_Math_Run && this.IsSelectionEmpty() == true) // находимся в Run, селект отсутствует
mathPr = this.Content[this.CurPos].GetMathPr();

this.Add_Symbol(Code, Pr.ctrPrp, mathPr);
};
CMathContent.prototype.private_LoadFromMenuFraction = function(Type, Pr, oSelectedContent)
{
Expand Down

0 comments on commit 0236c5e

Please sign in to comment.