1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-19 12:23:13 +08:00

Merge pull request #25478 from Joehuu/fix-comment-markdown

Fix `CommentMarkdownTextFlowContainer` not inheriting osu! class
This commit is contained in:
Dean Herbert 2023-11-16 17:39:35 +09:00 committed by GitHub
commit 87a76b9ee8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 15 deletions

View File

@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.Online
new[] { "Plain", "This is plain comment" }, new[] { "Plain", "This is plain comment" },
new[] { "Pinned", "This is pinned comment" }, new[] { "Pinned", "This is pinned comment" },
new[] { "Link", "Please visit https://osu.ppy.sh" }, new[] { "Link", "Please visit https://osu.ppy.sh" },
new[] { "Big Image", "![](Backgrounds/bg1)" }, new[] { "Big Image", "![](Backgrounds/bg1 \"Big Image\")" },
new[] { "Small Image", "![](Cursor/cursortrail)" }, new[] { "Small Image", "![](Cursor/cursortrail)" },
new[] new[]
{ {

View File

@ -10,7 +10,6 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Testing; using osu.Framework.Testing;
@ -298,7 +297,7 @@ This is a line after the fenced code block!
{ {
public LinkInline Link; public LinkInline Link;
public override MarkdownTextFlowContainer CreateTextFlow() => new TestMarkdownTextFlowContainer public override OsuMarkdownTextFlowContainer CreateTextFlow() => new TestMarkdownTextFlowContainer
{ {
UrlAdded = link => Link = link, UrlAdded = link => Link = link,
}; };

View File

@ -5,7 +5,6 @@ using Markdig.Extensions.Footnotes;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays; using osu.Game.Overlays;
@ -62,7 +61,7 @@ namespace osu.Game.Graphics.Containers.Markdown.Footnotes
lastFootnote = Text = footnote; lastFootnote = Text = footnote;
} }
public override MarkdownTextFlowContainer CreateTextFlow() => new FootnoteMarkdownTextFlowContainer(); public override OsuMarkdownTextFlowContainer CreateTextFlow() => new FootnoteMarkdownTextFlowContainer();
} }
private partial class FootnoteMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer private partial class FootnoteMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer

View File

@ -63,7 +63,7 @@ namespace osu.Game.Graphics.Containers.Markdown
Font = OsuFont.GetFont(Typeface.Inter, size: 14, weight: FontWeight.Regular), Font = OsuFont.GetFont(Typeface.Inter, size: 14, weight: FontWeight.Regular),
}; };
public override MarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer(); public override OsuMarkdownTextFlowContainer CreateTextFlow() => new OsuMarkdownTextFlowContainer();
protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new OsuMarkdownHeading(headingBlock); protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new OsuMarkdownHeading(headingBlock);

View File

@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Comments
protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new CommentMarkdownHeading(headingBlock); protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new CommentMarkdownHeading(headingBlock);
public override MarkdownTextFlowContainer CreateTextFlow() => new CommentMarkdownTextFlowContainer(); public override OsuMarkdownTextFlowContainer CreateTextFlow() => new CommentMarkdownTextFlowContainer();
private partial class CommentMarkdownHeading : OsuMarkdownHeading private partial class CommentMarkdownHeading : OsuMarkdownHeading
{ {
@ -49,14 +49,14 @@ namespace osu.Game.Overlays.Comments
} }
} }
private partial class CommentMarkdownTextFlowContainer : MarkdownTextFlowContainer private partial class CommentMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{ {
protected override void AddImage(LinkInline linkInline) => AddDrawable(new CommentMarkdownImage(linkInline.Url)); protected override void AddImage(LinkInline linkInline) => AddDrawable(new CommentMarkdownImage(linkInline));
private partial class CommentMarkdownImage : MarkdownImage private partial class CommentMarkdownImage : OsuMarkdownImage
{ {
public CommentMarkdownImage(string url) public CommentMarkdownImage(LinkInline linkInline)
: base(url) : base(linkInline)
{ {
} }

View File

@ -7,7 +7,6 @@ using Markdig.Extensions.Yaml;
using Markdig.Syntax; using Markdig.Syntax;
using Markdig.Syntax.Inlines; using Markdig.Syntax.Inlines;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown; using osu.Game.Graphics.Containers.Markdown;
namespace osu.Game.Overlays.Wiki.Markdown namespace osu.Game.Overlays.Wiki.Markdown
@ -53,7 +52,7 @@ namespace osu.Game.Overlays.Wiki.Markdown
base.AddMarkdownComponent(markdownObject, container, level); base.AddMarkdownComponent(markdownObject, container, level);
} }
public override MarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer(); public override OsuMarkdownTextFlowContainer CreateTextFlow() => new WikiMarkdownTextFlowContainer();
private partial class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer private partial class WikiMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
{ {

View File

@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Wiki
public override SpriteText CreateSpriteText() => base.CreateSpriteText().With(t => t.Font = t.Font.With(Typeface.Torus, weight: FontWeight.Bold)); public override SpriteText CreateSpriteText() => base.CreateSpriteText().With(t => t.Font = t.Font.With(Typeface.Torus, weight: FontWeight.Bold));
public override MarkdownTextFlowContainer CreateTextFlow() => base.CreateTextFlow().With(f => f.TextAnchor = Anchor.TopCentre); public override OsuMarkdownTextFlowContainer CreateTextFlow() => base.CreateTextFlow().With(f => f.TextAnchor = Anchor.TopCentre);
protected override MarkdownParagraph CreateParagraph(ParagraphBlock paragraphBlock, int level) protected override MarkdownParagraph CreateParagraph(ParagraphBlock paragraphBlock, int level)
=> base.CreateParagraph(paragraphBlock, level).With(p => p.Margin = new MarginPadding { Bottom = 10 }); => base.CreateParagraph(paragraphBlock, level).With(p => p.Margin = new MarginPadding { Bottom = 10 });