A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using Markdig.Syntax;
5using osu.Framework.Allocation;
6
7namespace osu.Framework.Graphics.Containers.Markdown
8{
9 /// <summary>
10 /// Visualises a paragraph.
11 /// </summary>
12 public class MarkdownParagraph : CompositeDrawable, IMarkdownTextFlowComponent
13 {
14 private readonly ParagraphBlock paragraphBlock;
15
16 [Resolved]
17 private IMarkdownTextFlowComponent parentFlowComponent { get; set; }
18
19 public MarkdownParagraph(ParagraphBlock paragraphBlock)
20 {
21 this.paragraphBlock = paragraphBlock;
22
23 RelativeSizeAxes = Axes.X;
24 AutoSizeAxes = Axes.Y;
25 }
26
27 [BackgroundDependencyLoader]
28 private void load()
29 {
30 MarkdownTextFlowContainer textFlow;
31 InternalChild = textFlow = CreateTextFlow();
32
33 textFlow.AddInlineText(paragraphBlock.Inline);
34 }
35
36 public virtual MarkdownTextFlowContainer CreateTextFlow() => parentFlowComponent.CreateTextFlow();
37 }
38}