improving initial layout of markdown
issue: MatterHackers/MCCentral#3881 Markdown not doing correct layout on initial layout event
This commit is contained in:
parent
8d9a3435c7
commit
2d9b0d9dd9
3 changed files with 27 additions and 5 deletions
|
|
@ -58,7 +58,7 @@ namespace Markdig.Agg
|
|||
this.BaseUri = baseUri;
|
||||
}
|
||||
|
||||
public Uri BaseUri { get; set; }
|
||||
public Uri BaseUri { get; set; } = new Uri("https://www.matterhackers.com/");
|
||||
|
||||
public List<MarkdownDocumentLink> Children { get; private set; } = new List<MarkdownDocumentLink>();
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace Markdig.Renderers
|
|||
|
||||
public GuiWidget RootWidget { get; }
|
||||
|
||||
public Uri BaseUri { get; set; }
|
||||
public Uri BaseUri { get; set; } = new Uri("https://www.matterhackers.com/");
|
||||
public List<MarkdownDocumentLink> ChildLinks { get; internal set; }
|
||||
|
||||
public AggRenderer(ThemeConfig theme)
|
||||
|
|
@ -98,6 +98,16 @@ namespace Markdig.Renderers
|
|||
public override object Render(MarkdownObject markdownObject)
|
||||
{
|
||||
Write(markdownObject);
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
// TODO: investigate why this is required, layout should have already done this
|
||||
// but it didn't. markdown that looks like the following will not laout correctly without this
|
||||
// string badLayoutMarkdown = "I [s]()\n\nT";
|
||||
if (RootWidget?.Parent?.Parent != null)
|
||||
{
|
||||
RootWidget.Parent.Parent.Width = RootWidget.Parent.Parent.Width - 1;
|
||||
}
|
||||
});
|
||||
return RootWidget;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,13 +34,25 @@ namespace Markdig.Agg
|
|||
{
|
||||
public class MarkdownPage : DialogPage
|
||||
{
|
||||
string debugMarkdown = null;
|
||||
//string debugMarkdown = "I [s]()\n\nT";
|
||||
|
||||
public MarkdownPage()
|
||||
{
|
||||
this.WindowTitle = this.HeaderText = "Markdown Tests";
|
||||
contentRow.AddChild(
|
||||
new MarkdownWidget(
|
||||
MarkdownWidget widget;
|
||||
if (debugMarkdown != null)
|
||||
{
|
||||
widget = new MarkdownWidget(theme);
|
||||
widget.Markdown = debugMarkdown;
|
||||
}
|
||||
else
|
||||
{
|
||||
widget = new MarkdownWidget(
|
||||
theme,
|
||||
new Uri("https://raw.githubusercontent.com/lunet-io/markdig/master/readme.md")));
|
||||
new Uri("https://raw.githubusercontent.com/lunet-io/markdig/master/readme.md"));
|
||||
}
|
||||
contentRow.AddChild(widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue