Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overflow auto for content larger than max height. #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions BlazorTextDiff.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTextDiff", "src\BlazorTextDiff.csproj", "{BD68CFEA-CA90-4513-9B45-F56891BB82CD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorTextDiff.Web", "samples\BlazorTextDiff.Web\BlazorTextDiff.Web.csproj", "{6AEC9F46-B137-48E0-BC43-C62E339B5483}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorTextDiffCore", "BlazorTextDiffCore\BlazorTextDiffCore.csproj", "{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorTextDiffCore.Web", "BlazorTextDiffCore.Web\BlazorTextDiffCore.Web.csproj", "{3D074FDC-FD1B-4E1E-9A9E-030727444A66}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +25,14 @@ Global
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AEC9F46-B137-48E0-BC43-C62E339B5483}.Release|Any CPU.Build.0 = Release|Any CPU
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8268065C-5552-47C2-B8DE-38EFF8A0F0E8}.Release|Any CPU.Build.0 = Release|Any CPU
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D074FDC-FD1B-4E1E-9A9E-030727444A66}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
10 changes: 10 additions & 0 deletions BlazorTextDiffCore.Web/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
18 changes: 18 additions & 0 deletions BlazorTextDiffCore.Web/BlazorTextDiffCore.Web.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.10" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BlazorTextDiffCore\BlazorTextDiffCore.csproj" />
</ItemGroup>

</Project>
33 changes: 33 additions & 0 deletions BlazorTextDiffCore.Web/Pages/Async.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@inject HttpClient Http
@page "/async"

<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible">
<Header>
<h6 style="padding: 12px; margin: 0px;">
Loaded From <a target="_blank" href="https://github.com/lzinga/TTTWeightedTraitorSelection">My Github Repo</a>

<span class="badge badge-primary">@($"{context.LineModificationCount} Line Modifications")</span>
<span class="badge badge-danger">@($"{context.LineDeletionCount} Line Deletions")</span>
<span class="badge badge-success">@($"{context.LineAdditionCount} Line Additions")</span>

<span class="badge badge-primary">@($"{context.WordModificationCount} Word Modifications")</span>
<span class="badge badge-danger">@($"{context.WordDeletionCount} Word Deletions")</span>
<span class="badge badge-success">@($"{context.WordAdditionCount} Word Additions")</span>
</h6>
<button type="button" @onclick="@(() => collapsible = !collapsible)">Toggle Collapse</button>
</Header>
</TextDiff>

@code {

string left = "";
string right = "";
bool collapsible = true;


protected override async Task OnInitializedAsync()
{
left = await Http.GetStringAsync("https://raw.githubusercontent.com/lzinga/TTTWeightedTraitorSelection/fe20c3e645aaa20e40cecc615037d51a34f9cb4a/README.md");
right = await Http.GetStringAsync("https://raw.githubusercontent.com/lzinga/TTTWeightedTraitorSelection/c763193e8a5bddfbec097c7b96ea0f875eedb01b/README.md");
}
}
45 changes: 45 additions & 0 deletions BlazorTextDiffCore.Web/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@page "/"
@inject HttpClient Http


<h1>Static</h1>
<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible">
<Header>
<h6 style="padding: 12px; margin: 0px;">
Harry Potter and the Metabolic Stone
<span class="badge badge-primary">@($"{context.LineModificationCount} Line Modifications")</span>
<span class="badge badge-danger">@($"{context.LineDeletionCount} Line Deletions")</span>
<span class="badge badge-success">@($"{context.LineAdditionCount} Line Additions")</span>

<span class="badge badge-primary">@($"{context.WordModificationCount} Word Modifications")</span>
<span class="badge badge-danger">@($"{context.WordDeletionCount} Word Deletions")</span>
<span class="badge badge-success">@($"{context.WordAdditionCount} Word Additions")</span>
</h6>
</Header>
</TextDiff>


<h1 style="margin-top: 40px;">Static (No header)</h1>
<TextDiff OldText="@left" NewText="@right" CollapseContent="@collapsible" />


@code {
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.
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.
The Dursleys had everything they wanted...

<some>
<xml1>
</xml1>
</some>
";
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.
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.
The Dursleys had everything they wanted...

<some>
<xml2>
</xml2>
</some>";
bool collapsible = true;
}
16 changes: 16 additions & 0 deletions BlazorTextDiffCore.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using BlazorTextDiffCore.Web;
using DiffPlex.DiffBuilder;
using DiffPlex;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

builder.Services.AddScoped<ISideBySideDiffBuilder, SideBySideDiffBuilder>();
builder.Services.AddScoped<IDiffer, Differ>();

await builder.Build().RunAsync();
30 changes: 30 additions & 0 deletions BlazorTextDiffCore.Web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:31718",
"sslPort": 44347
}
},
"profiles": {
"BlazorTextDiffCore.Web": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7142;http://localhost:5142",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
15 changes: 15 additions & 0 deletions BlazorTextDiffCore.Web/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@inherits LayoutComponentBase

<div class="sidebar">
<NavMenu />
</div>

<div class="main">
<div class="top-row px-4">
<a href="http://blazor.net" target="_blank" class="ml-md-auto">About</a>
</div>

<div class="content px-4">
@Body
</div>
</div>
32 changes: 32 additions & 0 deletions BlazorTextDiffCore.Web/Shared/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="top-row pl-4 navbar navbar-dark">
<a class="navbar-brand" href="">BlazorTextDiff.Web</a>
<button class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="nav-link" href="/" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="nav-link" href="/async">
<span class="oi oi-home" aria-hidden="true"></span> Async
</NavLink>
</li>
</ul>
</div>

@code {
private bool collapseNavMenu = true;

private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;

private void ToggleNavMenu()
{
collapseNavMenu = !collapseNavMenu;
}
}
16 changes: 16 additions & 0 deletions BlazorTextDiffCore.Web/Shared/SurveyPrompt.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="alert alert-secondary mt-4" role="alert">
<span class="oi oi-pencil mr-2" aria-hidden="true"></span>
<strong>@Title</strong>

<span class="text-nowrap">
Please take our
<a target="_blank" class="font-weight-bold" href="https://go.microsoft.com/fwlink/?linkid=2116045">brief survey</a>
</span>
and tell us what you think.
</div>

@code {
// Demonstrates how a parent component can supply parameters
[Parameter]
public string Title { get; set; }
}
8 changes: 8 additions & 0 deletions BlazorTextDiffCore.Web/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@using System.Net.Http
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using BlazorTextDiffCore.Web
@using BlazorTextDiffCore.Web.Shared
@using BlazorTextDiffCore

Large diffs are not rendered by default.

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions BlazorTextDiffCore.Web/wwwroot/css/open-iconic/FONT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
SIL OPEN FONT LICENSE Version 1.1

Copyright (c) 2014 Waybury

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
21 changes: 21 additions & 0 deletions BlazorTextDiffCore.Web/wwwroot/css/open-iconic/ICON-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Waybury

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading