Skip to content

Commit b694416

Browse files
Merge pull request #3 from Backiaraj/richtext
Update the project
2 parents bcaaea5 + b55b5ba commit b694416

30 files changed

+185
-278
lines changed

App.razor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly">
22
<Found Context="routeData">
33
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
45
</Found>
56
<NotFound>
7+
<PageTitle>Not found</PageTitle>
68
<LayoutView Layout="@typeof(MainLayout)">
7-
<p>Sorry, there's nothing at this address.</p>
9+
<p role="alert">Sorry, there's nothing at this address.</p>
810
</LayoutView>
911
</NotFound>
1012
</Router>

BlazorMarkdig.csproj

Lines changed: 0 additions & 12 deletions
This file was deleted.

Data/WeatherForecast.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
using System;
2-
3-
namespace BlazorMarkdig.Data
1+
namespace MarkdownEditUsingMarkdig.Data
42
{
53
public class WeatherForecast
64
{
7-
public DateTime Date { get; set; }
5+
public DateOnly Date { get; set; }
86

97
public int TemperatureC { get; set; }
108

119
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1210

13-
public string Summary { get; set; }
11+
public string? Summary { get; set; }
1412
}
15-
}
13+
}

Data/WeatherForecastService.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
using System;
2-
using System.Linq;
3-
using System.Threading.Tasks;
4-
5-
namespace BlazorMarkdig.Data
1+
namespace MarkdownEditUsingMarkdig.Data
62
{
73
public class WeatherForecastService
84
{
95
private static readonly string[] Summaries = new[]
106
{
11-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
12-
};
7+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
8+
};
139

14-
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
10+
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
1511
{
16-
var rng = new Random();
1712
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
1813
{
1914
Date = startDate.AddDays(index),
20-
TemperatureC = rng.Next(-20, 55),
21-
Summary = Summaries[rng.Next(Summaries.Length)]
15+
TemperatureC = Random.Shared.Next(-20, 55),
16+
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
2217
}).ToArray());
2318
}
2419
}
25-
}
20+
}

MarkdownEditUsingMarkdig.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Markdig" Version="0.33.0" />
11+
<PackageReference Include="Syncfusion.Blazor.RichTextEditor" Version="23.1.40" />
12+
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.40" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30516.212
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.4.33213.308
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorMarkdig", "BlazorMarkdig.csproj", "{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownEditUsingMarkdig", "MarkdownEditUsingMarkdig.csproj", "{129D0070-717C-44BD-A322-B7161581320B}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{129D0070-717C-44BD-A322-B7161581320B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{129D0070-717C-44BD-A322-B7161581320B}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{129D0070-717C-44BD-A322-B7161581320B}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{129D0070-717C-44BD-A322-B7161581320B}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {11AC6ADA-1CCA-48C1-9710-D51F6E9A9F3E}
23+
SolutionGuid = {75FFF336-0060-4360-BB68-11F394C711C2}
2424
EndGlobalSection
2525
EndGlobal

Pages/Counter.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
@page "/counter"
22

3+
<PageTitle>Counter</PageTitle>
4+
35
<h1>Counter</h1>
46

5-
<p>Current count: @currentCount</p>
7+
<p role="status">Current count: @currentCount</p>
68

79
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
810

Pages/Error.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
@page
2-
@model BlazorMarkdig.Pages.ErrorModel
2+
@model MarkdownEditUsingMarkdig.Pages.ErrorModel
33

44
<!DOCTYPE html>
5-
<html>
5+
<html lang="en">
66

77
<head>
88
<meta charset="utf-8" />
99
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
1010
<title>Error</title>
1111
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
12-
<link href="~/css/app.css" rel="stylesheet" />
12+
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
1313
</head>
1414

1515
<body>

Pages/Error.cshtml.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
using Microsoft.AspNetCore.Mvc;
22
using Microsoft.AspNetCore.Mvc.RazorPages;
3-
using Microsoft.Extensions.Logging;
4-
using System;
5-
using System.Collections.Generic;
63
using System.Diagnostics;
7-
using System.Linq;
8-
using System.Threading.Tasks;
94

10-
namespace BlazorMarkdig.Pages
5+
namespace MarkdownEditUsingMarkdig.Pages
116
{
127
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
138
[IgnoreAntiforgeryToken]
149
public class ErrorModel : PageModel
1510
{
16-
public string RequestId { get; set; }
11+
public string? RequestId { get; set; }
1712

1813
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
1914

@@ -29,4 +24,4 @@ public void OnGet()
2924
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
3025
}
3126
}
32-
}
27+
}

Pages/FetchData.razor

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
@page "/fetchdata"
2-
3-
@using BlazorMarkdig.Data
2+
@using MarkdownEditUsingMarkdig.Data
43
@inject WeatherForecastService ForecastService
54

5+
<PageTitle>Weather forecast</PageTitle>
6+
67
<h1>Weather forecast</h1>
78

89
<p>This component demonstrates fetching data from a service.</p>
@@ -37,10 +38,10 @@ else
3738
}
3839

3940
@code {
40-
private WeatherForecast[] forecasts;
41+
private WeatherForecast[]? forecasts;
4142

4243
protected override async Task OnInitializedAsync()
4344
{
44-
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
45+
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
4546
}
4647
}

0 commit comments

Comments
 (0)