docs: fix some issue (#2629)

This commit is contained in:
James Yeung 2022-08-21 23:52:23 +08:00 committed by GitHub
parent 3ac7701da4
commit 685678e82d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 212 additions and 201 deletions

View File

@ -100,31 +100,31 @@
animation: antSpinMove 1s infinite linear alternate; animation: antSpinMove 1s infinite linear alternate;
} }
.ant-spin-dot-item:nth-child(1) { .ant-spin-dot-item:nth-child(1) {
top: 0; top: 0;
left: 0; left: 0;
} }
.ant-spin-dot-item:nth-child(2) { .ant-spin-dot-item:nth-child(2) {
top: 0; top: 0;
right: 0; right: 0;
-webkit-animation-delay: 0.4s; -webkit-animation-delay: 0.4s;
animation-delay: 0.4s; animation-delay: 0.4s;
} }
.ant-spin-dot-item:nth-child(3) { .ant-spin-dot-item:nth-child(3) {
right: 0; right: 0;
bottom: 0; bottom: 0;
-webkit-animation-delay: 0.8s; -webkit-animation-delay: 0.8s;
animation-delay: 0.8s; animation-delay: 0.8s;
} }
.ant-spin-dot-item:nth-child(4) { .ant-spin-dot-item:nth-child(4) {
bottom: 0; bottom: 0;
left: 0; left: 0;
-webkit-animation-delay: 1.2s; -webkit-animation-delay: 1.2s;
animation-delay: 1.2s; animation-delay: 1.2s;
} }
.ant-spin-dot-spin { .ant-spin-dot-spin {
-webkit-transform: rotate(45deg); -webkit-transform: rotate(45deg);
@ -140,13 +140,12 @@
height: 32px; height: 32px;
} }
.ant-spin-lg .ant-spin-dot i { .ant-spin-lg .ant-spin-dot i {
width: 14px; width: 14px;
height: 14px; height: 14px;
} }
@media all and (-ms-high-contrast: none), @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
(-ms-high-contrast: active) {
.ant-spin-blur { .ant-spin-blur {
background: #fff; background: #fff;
opacity: 0.5; opacity: 0.5;
@ -179,8 +178,7 @@
} }
} }
</style> </style>
<div <div style="display: flex; justify-content: center; align-items: center; flex-direction: column; min-height: 420px; height: 100%;">
style="display: flex; justify-content: center; align-items: center; flex-direction: column; min-height: 420px; height: 100%;">
<img src="logo.png" alt="logo" width="256"> <img src="logo.png" alt="logo" width="256">
<div class="page-loading-warp"> <div class="page-loading-warp">
<div class="ant-spin ant-spin-lg ant-spin-spinning"> <div class="ant-spin ant-spin-lg ant-spin-spinning">
@ -199,9 +197,7 @@
</div> </div>
</app> </app>
<div id="toast-zh" class="toast ">文档已更新,请点击 <a class="reload" onclick="reload()">此处</a> 更新。</div> <div id="toast-zh" class="toast ">文档已更新,请点击 <a class="reload" onclick="reload()">此处</a> 更新。</div>
<div id="toast-en" class="toast ">A new version of this app is available. Click <a class="reload" <div id="toast-en" class="toast ">A new version of this app is available. Click <a class="reload" onclick="reload()">here</a> to update.</div>
onclick="reload()">here</a> to update.
</div>
<!-- Start Single Page Apps for GitHub Pages --> <!-- Start Single Page Apps for GitHub Pages -->
<script type="text/javascript"> <script type="text/javascript">
@ -256,21 +252,21 @@
}).then(() => ref.invokeMethodAsync('OnColorChanged')) }).then(() => ref.invokeMethodAsync('OnColorChanged'))
} }
fetch("/version.json?t=" + new Date().getTime()) //fetch("/version.json?t=" + new Date().getTime())
.then(response => response.json()) // .then(response => response.json())
.then(data => { // .then(data => {
console.log('Latest version is:' + data.version); // console.log('Latest version is:' + data.version);
if (data.version != '{version}') { // if (data.version != '{version}') {
showUpdateBar(); // showUpdateBar();
} // }
}); // });
</script> </script>
<script src="_framework/blazor.webassembly.js"></script> <script src="_framework/blazor.webassembly.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js" crossorigin="anonymous" <script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.7.2/less.min.js" crossorigin="anonymous"
referrerpolicy="no-referrer"></script> referrerpolicy="no-referrer"></script>
<script src="https://unpkg.com/@docsearch/js@3.0.0/dist/umd/index.js" crossorigin="anonymous" <script src="https://unpkg.com/@docsearch/js@3.0.0/dist/umd/index.js" crossorigin="anonymous"
referrerpolicy="no-referrer"></script> referrerpolicy="no-referrer"></script>
<script src="_content/AntDesign.Docs/js/docsearch.js"></script> <script src="_content/AntDesign.Docs/js/docsearch.js"></script>
<script> <script>
let newWorker; let newWorker;
@ -305,7 +301,6 @@
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
// The click event on the pop up notification // The click event on the pop up notification
navigator.serviceWorker.register('/service-worker.js').then(reg => { navigator.serviceWorker.register('/service-worker.js').then(reg => {
if (reg.waiting) { if (reg.waiting) {
newWorker = reg.waiting; newWorker = reg.waiting;
@ -334,8 +329,6 @@
refreshing = true; refreshing = true;
}); });
} }
</script> </script>
</body> </body>
</html> </html>

View File

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks> <TargetFrameworks>net6</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,42 @@
@page
@model blazorserver.Pages.ErrorModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,26 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace blazorserver.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}

View File

@ -2,59 +2,8 @@
@namespace AntDesign.Docs.Server.Pages @namespace AntDesign.Docs.Server.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html> @{
<html lang="en"> Layout = "_Layout";
<head> }
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Ant Design of Blazor</title>
<base href="~/" />
<link rel="icon" href="logo.png" type="image/x-icon">
<link rel="preconnect" href="https://C9UTAZSOWW-dsn.algolia.net" crossorigin />
<link rel="stylesheet" href="@("https://unpkg.com/@docsearch/css@3.0.0/dist/style.css")" />
<link href="_content/AntDesign.Docs/css/default.css" rel="stylesheet">
</head>
<body>
<app>
<component type="typeof(App)" render-mode="ServerPrerendered" />
</app>
@{
#if NET5_0_OR_GREATER
var polyfillPath = "_framework/blazor.polyfill.min.js";
#else
var polyfillPath = "https://raw.githubusercontent.com/Daddoon/Blazor.Polyfill/3.0.8/Publish/Blazor.Polyfill.Publish/blazor.polyfill.min.js";
#endif
#if NET6_0
var isNET6 = true;
#else
var isNET6 = false;
#endif
if (isNET6)
{
<script src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script>
}
}
<script src="@polyfillPath"></script>
<script src="_content/AntDesign.Charts/g2plot.js"></script>
<script src="_content/AntDesign.Charts/ant-design-charts-blazor.js"></script>
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
<script src="_content/AntDesign.Docs/js/prism.js"></script>
<script src="_framework/blazor.server.js"></script>
<script>
window.AntDesign.Prism = {};
window.AntDesign.Prism.highlight = function (code, language) {
return Prism.highlight(code, Prism.languages[language], language);
}
window.AntDesign.Prism.highlightAll = function () { <component type="typeof(App)" render-mode="ServerPrerendered" />
Prism.highlightAll();
}
</script>
<script src="@("https://unpkg.com/@docsearch/js@3.0.0/dist/umd/index.js")"></script>
<script src="_content/AntDesign.Docs/js/docsearch.js"></script>
@if (!isNET6)
{
<script src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script>
}
</body>
</html>

View File

@ -0,0 +1,60 @@
@using Microsoft.AspNetCore.Components.Web
@namespace blazorserver.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="icon" href="logo.png" type="image/x-icon">
<link rel="preconnect" href="https://C9UTAZSOWW-dsn.algolia.net" crossorigin />
<link rel="stylesheet" href="@("https://unpkg.com/@docsearch/css@3.0.0/dist/style.css")" />
<link href="_content/AntDesign.Docs/css/default.css" rel="stylesheet">
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<app>
@RenderBody()
</app>
@{
#if NET5_0_OR_GREATER
var polyfillPath = "_framework/blazor.polyfill.min.js";
#else
var polyfillPath = "https://raw.githubusercontent.com/Daddoon/Blazor.Polyfill@3.0.8/Publish/Blazor.Polyfill.Publish/blazor.polyfill.min.js";
#endif
#if NET6_0
var isNET6 = true;
#else
var isNET6 = false;
#endif
if (isNET6)
{
<script src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script>
}
}
<script src="@polyfillPath"></script>
<script src="_content/AntDesign.Charts/g2plot.js"></script>
<script src="_content/AntDesign.Charts/ant-design-charts-blazor.js"></script>
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
<script src="_content/AntDesign.Docs/js/prism.js"></script>
<script src="_framework/blazor.server.js"></script>
<script>
window.AntDesign.Prism = {};
window.AntDesign.Prism.highlight = function (code, language) {
return Prism.highlight(code, Prism.languages[language], language);
}
window.AntDesign.Prism.highlightAll = function () {
Prism.highlightAll();
}
</script>
<script src="@("https://unpkg.com/@docsearch/js@3.0.0/dist/umd/index.js")"></script>
<script src="_content/AntDesign.Docs/js/docsearch.js"></script>
@if (!isNET6)
{
<script src="https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver"></script>
}
</body>
</html>

View File

@ -1,20 +1,43 @@
using Microsoft.AspNetCore.Hosting; using Blazor.Polyfill.Server;
using Microsoft.Extensions.Hosting; using Microsoft.AspNetCore.Builder;
namespace AntDesign.Docs.Server var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddTransient(sp => new HttpClient()
{ {
public class Program DefaultRequestHeaders =
{ {
public static void Main(string[] args) // Use to call the github API on server side
{ {"User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36 Edg/81.0.416.68"}
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
} }
} });
builder.Services.AddAntDesignDocs();
#if NET5_0_OR_GREATER
builder.Services.AddBlazorPolyfill();
#endif
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
#if NET5_0_OR_GREATER
app.UseBlazorPolyfill();
#endif
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();

View File

@ -1,72 +0,0 @@
using System.Net.Http;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
#if NET5_0_OR_GREATER
using Blazor.Polyfill.Server;
#endif
namespace AntDesign.Docs.Server
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddTransient(sp => new HttpClient()
{
DefaultRequestHeaders =
{
// Use to call the github API on server side
{"User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36 Edg/81.0.416.68"}
}
});
services.AddAntDesignDocs();
#if NET5_0_OR_GREATER
services.AddBlazorPolyfill();
#endif
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
#if NET5_0_OR_GREATER
app.UseBlazorPolyfill();
#endif
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapBlazorHub();
endpoints.MapFallbackToPage("/_Host");
});
}
}
}

View File

@ -2,7 +2,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks> <TargetFrameworks>net6</TargetFrameworks>
<LangVersion>9.0</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -15,11 +14,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="wwwroot\docs\assets\links\**" />
<Content Remove="wwwroot\docs\assets\links\**" />
<EmbeddedResource Remove="wwwroot\docs\assets\links\**" />
<None Remove="Resources\*.json" />
<None Remove="wwwroot\docs\assets\links\**" />
<EmbeddedResource Include="Resources\*.json" /> <EmbeddedResource Include="Resources\*.json" />
</ItemGroup> </ItemGroup>
@ -32,9 +26,5 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\components\AntDesign.csproj" /> <ProjectReference Include="..\..\components\AntDesign.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\assets\" />
</ItemGroup>
</Project> </Project>

View File

@ -117,5 +117,4 @@
} }
</article> </article>
<ContributorsList FilePaths="_filePaths" /> <ContributorsList FilePaths="_filePaths" />
@*<ul class="contributors-list" style="display: flex; list-style: none; margin: 0px; padding: 0px; flex-flow: wrap;"></ul>*@
</section> </section>

View File

@ -37,7 +37,7 @@
<a href="/@Language.CurrentCulture.Name/docs"> <a href="/@Language.CurrentCulture.Name/docs">
<Button Type="primary" Shape="round">@Language.Resources["app.home.getting-started"]</Button> <Button Type="primary" Shape="round">@Language.Resources["app.home.getting-started"]</Button>
</a> </a>
<a href="/@Language.CurrentCulture.Name/components"> <a href="https://github.com/ant-design-blazor/ant-design-blazor/stargazers">
<Button Shape="round" Icon="github">@Language.Resources["app.home.star-on-github"]</Button> <Button Shape="round" Icon="github">@Language.Resources["app.home.star-on-github"]</Button>
</a> </a>
</div> </div>