Skip to content

Commit

Permalink
fix info box
Browse files Browse the repository at this point in the history
  • Loading branch information
stevencohn committed Apr 20, 2024
1 parent ebbbf95 commit 84f1c6d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions OneMore/Commands/Snippets/InsertInfoBoxCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public override async Task Execute(params object[] args)
normalStyle.Color = theme["titleColor"].ToString();
normalStyle.IsBold = true;


System.Diagnostics.Debugger.Launch();


row.Cells.ElementAt(1).SetContent(
new XElement(ns + "OEChildren",
new XElement(ns + "OE",
Expand Down Expand Up @@ -135,15 +139,19 @@ public override async Task Execute(params object[] args)
page.AddNextParagraph(outer.Root);
//page.InsertParagraph(outer.Root, true);
}
else if (anchor.HasElements)
{
// selected text was a subset of runs under an OE
anchor.AddAfterSelf(new XElement(ns + "OE", outer.Root));
}
else
{
// selected text was all of an OE
anchor.Add(outer.Root);
var localName = anchor.Name.LocalName;
var box = new XElement(ns + "OE", outer.Root);

if (localName.In("OE", "HTMLBlock"))
{
anchor.AddAfterSelf(box);
}
else // if (localName.In("OEChildren", "Outline"))
{
anchor.AddFirst(box);
}
}

await one.Update(page);
Expand Down

0 comments on commit 84f1c6d

Please sign in to comment.