fix: fixed text going offscreen in comment and post

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-13 14:35:44 +02:00
parent 9d733af389
commit 13b4935d6a
3 changed files with 70 additions and 46 deletions

View file

@ -38,7 +38,7 @@
{
className = "greenText";
}
<span class='threadText @className'>
<p class='threadText @className'>
@for (var x = 0; x < s.Split(" ").Length; x++)
{
var line = s.Split(" ")[x];
@ -49,11 +49,12 @@
var y1 = y;
var commentNumber = int.Parse(Regex.Match(s, ">>(\\d+)").Value.Substring(2));
className2 = "redText";
<span
@onmouseenter="() => onHover(x1, y1, commentNumber)"
@onmouseleave="() => onHover(x1, y1, -1)" class="threadMsg @className2">
<a
@onmousedown="() => onHover(x1, y1, commentNumber)"
@onmouseup="() => onHover(x1, y1, -1)"
class="threadMsg @className2">
@line
</span>
</a>
@if (hoveringOver.p != -1 && hoveringOver == (x, y, commentNumber) && (hoverComment.ContainsKey(commentNumber) || hoverPost.ContainsKey(commentNumber)))
{
@if (isComment[commentNumber])
@ -74,17 +75,16 @@
{
@if (line.StartsWith("https://") || line.StartsWith("http://"))
{
<a href="@line" target="_blank">@line</a>
<a href="@line">@line</a>
}
else
{
<span class="threadMsg">@line</span>
@line
}
<span >&nbsp;</span>
@(" ")
}
<span>&nbsp;</span>
}
</span>
</p>
}
</div>
</div>

View file

@ -22,34 +22,40 @@
</div>
}
<div class="threadTextContainer">
@foreach (string s in @comment.Content.Split("\n"))
@for (var y = 0; y < comment.Content.Split("\n").Length; y++)
{
var s = comment.Content.Split("\n")[y];
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<span class='threadText @className'>
@foreach (string line in s.Split(" "))
<p class='threadText @className'>
@for (var x = 0; x < s.Split(" ").Length; x++)
{
var className2 = "";
var line = s.Split(" ")[x];
@if (@Regex.IsMatch(line, ">>\\d+"))
{
className2 = "redText";
<a href="/@comment.Board/@comment.PostID/@Regex.Match(s, ">>(\\d+)").Value.Substring(2)" class="threadMsg @className2">
var className2 = "";
<a class="redText">
@line
</a>
}
else
{
<span class="threadMsg">
@if (line.StartsWith("https://") || line.StartsWith("http://"))
{
<a href="@line">@line</a>
}
else
{
@line
</span>
}
<span>&nbsp;</span>
@(" ")
}
</span>
}
</p>
}
</div>
</div>

View file

@ -50,31 +50,32 @@
<div class="threadTextContainer">
@if (showOpenThread)
{
@foreach (string s in post.Content.Split("\n").ToList().Take(6))
@foreach (string s in post.Content.Split("\n").Take(6))
{
var className = "";
@if (s.StartsWith(">") && !Regex.IsMatch(s, "^>{2,}"))
{
className = "greenText";
}
<p class="@className">
@foreach (string s2 in s.Split(" "))
{
@if (s2.StartsWith("https://") || s.StartsWith("http://"))
@if (s2.StartsWith("https://") || s2.StartsWith("http://"))
{
<a href="@s2" target="_blank">@s2</a>
<a href="@s2">@s2</a>
}
else
{
<span class="@className">@s2</span>
@s2
}
<span class="@className">&nbsp;</span>
@(" ")
}
<br/>
</p>
<p/>
}
@if (post.Content.Split("\n").Length > 6)
{
<br/>
<span class="greenText">[Open Thread to read more...]</span>
<p class="greenText">[Open thread to read more...]</p>
}
}
else
@ -86,19 +87,21 @@
{
className = "greenText";
}
<p class="@className">
@foreach (string s2 in s.Split(" "))
{
@if (s2.StartsWith("https://") || s2.StartsWith("http://"))
{
<a href="@s2" target="_blank">@s2</a>
<a href="@s2">@s2</a>
}
else
{
<span class="@className">@s2</span>
@s2
}
<span class="@className">&nbsp;</span>
@(" ")
}
<br/>
</p>
<p/>
}
}
</div>
@ -146,6 +149,21 @@
</div>
@code {
/*
private RenderFragment[] RenderWithAnchorTags(string input)
{
return input.Split(' ').Select(e => e.StartsWith("https://") || e.StartsWith("http://")
? (RenderFragment)(builder =>
{
builder.OpenElement(0, "a");
builder.AddAttribute(1, "href", e);
builder.AddContent(2, e);
builder.CloseElement();
})
: (RenderFragment)(builder => builder.AddContent(0, e))).ToArray();
}
*/
private string reportURL { get; set; }
private string threadURL { get; set; }