diff --git a/OneMore/Commands/Snippets/InsertInfoBoxCommand.cs b/OneMore/Commands/Snippets/InsertInfoBoxCommand.cs index 9fb6215aac..6a1ed0be91 100644 --- a/OneMore/Commands/Snippets/InsertInfoBoxCommand.cs +++ b/OneMore/Commands/Snippets/InsertInfoBoxCommand.cs @@ -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", @@ -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);