Skip to content

Commit 1907856

Browse files
authored
Add overflow auto for content larger than max height. (#8)
* Add text wrapping for content larger than max height. * Add DotNet 6.0 version
1 parent 1cd5a7b commit 1907856

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1851
-5
lines changed

BlazorTextDiff.sln

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29613.14
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32929.385
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTextDiff", "src\BlazorTextDiff.csproj", "{BD68CFEA-CA90-4513-9B45-F56891BB82CD}"
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTextDiff.Web", "samples\BlazorTextDiff.Web\BlazorTextDiff.Web.csproj", "{6AEC9F46-B137-48E0-BC43-C62E339B5483}"
99
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorTextDiffCore", "BlazorTextDiffCore\BlazorTextDiffCore.csproj", "{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorTextDiffCore.Web", "BlazorTextDiffCore.Web\BlazorTextDiffCore.Web.csproj", "{3D074FDC-FD1B-4E1E-9A9E-030727444A66}"
13+
EndProject
1014
Global
1115
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1216
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +25,14 @@ Global
2125
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Debug|Any CPU.Build.0 = Debug|Any CPU
2226
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Release|Any CPU.ActiveCfg = Release|Any CPU
2327
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Release|Any CPU.Build.0 = Release|Any CPU
2436
EndGlobalSection
2537
GlobalSection(SolutionProperties) = preSolution
2638
HideSolutionNode = FALSE

BlazorTextDiffCore.Web/App.razor

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Router AppAssembly="@typeof(Program).Assembly">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
</Found>
5+
<NotFound>
6+
<LayoutView Layout="@typeof(MainLayout)">
7+
<p>Sorry, there's nothing at this address.</p>
8+
</LayoutView>
9+
</NotFound>
10+
</Router>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.10" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.10" PrivateAssets="all" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\BlazorTextDiffCore\BlazorTextDiffCore.csproj" />
16+
</ItemGroup>
17+
18+
</Project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@inject HttpClient Http
2+
@page "/async"
3+
4+
<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible">
5+
<Header>
6+
<h6 style="padding: 12px; margin: 0px;">
7+
Loaded From <a target="_blank" href="https://github.com/lzinga/TTTWeightedTraitorSelection">My Github Repo</a>
8+
9+
<span class="badge badge-primary">@($"{context.LineModificationCount} Line Modifications")</span>
10+
<span class="badge badge-danger">@($"{context.LineDeletionCount} Line Deletions")</span>
11+
<span class="badge badge-success">@($"{context.LineAdditionCount} Line Additions")</span>
12+
13+
<span class="badge badge-primary">@($"{context.WordModificationCount} Word Modifications")</span>
14+
<span class="badge badge-danger">@($"{context.WordDeletionCount} Word Deletions")</span>
15+
<span class="badge badge-success">@($"{context.WordAdditionCount} Word Additions")</span>
16+
</h6>
17+
<button type="button" @onclick="@(() => collapsible = !collapsible)">Toggle Collapse</button>
18+
</Header>
19+
</TextDiff>
20+
21+
@code {
22+
23+
string left = "";
24+
string right = "";
25+
bool collapsible = true;
26+
27+
28+
protected override async Task OnInitializedAsync()
29+
{
30+
left = await Http.GetStringAsync("https://raw.githubusercontent.com/lzinga/TTTWeightedTraitorSelection/fe20c3e645aaa20e40cecc615037d51a34f9cb4a/README.md");
31+
right = await Http.GetStringAsync("https://raw.githubusercontent.com/lzinga/TTTWeightedTraitorSelection/c763193e8a5bddfbec097c7b96ea0f875eedb01b/README.md");
32+
}
33+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@page "/"
2+
@inject HttpClient Http
3+
4+
5+
<h1>Static</h1>
6+
<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible">
7+
<Header>
8+
<h6 style="padding: 12px; margin: 0px;">
9+
Harry Potter and the Metabolic Stone
10+
<span class="badge badge-primary">@($"{context.LineModificationCount} Line Modifications")</span>
11+
<span class="badge badge-danger">@($"{context.LineDeletionCount} Line Deletions")</span>
12+
<span class="badge badge-success">@($"{context.LineAdditionCount} Line Additions")</span>
13+
14+
<span class="badge badge-primary">@($"{context.WordModificationCount} Word Modifications")</span>
15+
<span class="badge badge-danger">@($"{context.WordDeletionCount} Word Deletions")</span>
16+
<span class="badge badge-success">@($"{context.WordAdditionCount} Word Additions")</span>
17+
</h6>
18+
</Header>
19+
</TextDiff>
20+
21+
22+
<h1 style="margin-top: 40px;">Static (No header)</h1>
23+
<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible" />
24+
25+
26+
@code {
27+
string left = @"Mr. and Mrs. Fursley, of number six, Sunset Drive, were proud to say that they were almost perfectly normal. They were the last people you'd expect to be involved in anything weird or mysterious, because they just didn't hold with such nonsense.
28+
Mr. Fursley was the director of a firm called Brunings, which made hatchets. He was a big, well fed man with no neck, although he did have a very large mustache. Mrs. Fursley was petite and blonde and had nearly twice the usual amount of neck, which came in very useful as she spent so much of her time bending over garden fences, spying on the neighbors. The Fursley's had a small son called Fudley and in their opinion there was no finer boy anywhere.
29+
The Dursleys had everything they wanted...
30+
31+
<some>
32+
<xml1>
33+
</xml1>
34+
</some>
35+
";
36+
string right = @"Mr. and Mrs. Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much. They were the last people you'd expect to be involved in anything strange or mysterious, because they just didn't hold with such nonsense.
37+
Mr. Dursley was the director of a firm called Grunnings, which made drills. He was a big, beefy man with hardly any neck, although he did have a very large mustache. Mrs. Dursley was thin and blonde and had nearly twice the usual amount of neck, which came in very useful as she spent so much of her time craning over garden fences, spying on the neighbors. The Dursleys had a small son called Dudley and in their opinion there was no finer boy anywhere.
38+
The Dursleys had everything they wanted...
39+
40+
<some>
41+
<xml2>
42+
</xml2>
43+
</some>";
44+
bool collapsible = true;
45+
}

BlazorTextDiffCore.Web/Program.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using BlazorTextDiffCore.Web;
2+
using DiffPlex.DiffBuilder;
3+
using DiffPlex;
4+
using Microsoft.AspNetCore.Components.Web;
5+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
6+
7+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
8+
builder.RootComponents.Add<App>("app");
9+
builder.RootComponents.Add<HeadOutlet>("head::after");
10+
11+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
12+
13+
builder.Services.AddScoped<ISideBySideDiffBuilder, SideBySideDiffBuilder>();
14+
builder.Services.AddScoped<IDiffer, Differ>();
15+
16+
await builder.Build().RunAsync();
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:31718",
7+
"sslPort": 44347
8+
}
9+
},
10+
"profiles": {
11+
"BlazorTextDiffCore.Web": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "https://localhost:7142;http://localhost:5142",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"IIS Express": {
22+
"commandName": "IISExpress",
23+
"launchBrowser": true,
24+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
25+
"environmentVariables": {
26+
"ASPNETCORE_ENVIRONMENT": "Development"
27+
}
28+
}
29+
}
30+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="sidebar">
4+
<NavMenu />
5+
</div>
6+
7+
<div class="main">
8+
<div class="top-row px-4">
9+
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
10+
</div>
11+
12+
<div class="content px-4">
13+
@Body
14+
</div>
15+
</div>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<div class="top-row pl-4 navbar navbar-dark">
2+
<a class="navbar-brand" href="">BlazorTextDiff.Web</a>
3+
<button class="navbar-toggler" @onclick="ToggleNavMenu">
4+
<span class="navbar-toggler-icon"></span>
5+
</button>
6+
</div>
7+
8+
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
9+
<ul class="nav flex-column">
10+
<li class="nav-item px-3">
11+
<NavLink class="nav-link" href="/" Match="NavLinkMatch.All">
12+
<span class="oi oi-home" aria-hidden="true"></span> Home
13+
</NavLink>
14+
</li>
15+
<li class="nav-item px-3">
16+
<NavLink class="nav-link" href="/async">
17+
<span class="oi oi-home" aria-hidden="true"></span> Async
18+
</NavLink>
19+
</li>
20+
</ul>
21+
</div>
22+
23+
@code {
24+
private bool collapseNavMenu = true;
25+
26+
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
27+
28+
private void ToggleNavMenu()
29+
{
30+
collapseNavMenu = !collapseNavMenu;
31+
}
32+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div class="alert alert-secondary mt-4" role="alert">
2+
<span class="oi oi-pencil mr-2" aria-hidden="true"></span>
3+
<strong>@Title</strong>
4+
5+
<span class="text-nowrap">
6+
Please take our
7+
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2116045">brief survey</a>
8+
</span>
9+
and tell us what you think.
10+
</div>
11+
12+
@code {
13+
// Demonstrates how a parent component can supply parameters
14+
[Parameter]
15+
public string Title { get; set; }
16+
}

0 commit comments

Comments
 (0)