Skip to content

Commit

Permalink
Merge pull request #3 from Backiaraj/richtext
Browse files Browse the repository at this point in the history
Update the project
  • Loading branch information
rajendranr-5483 committed Oct 22, 2023
2 parents bcaaea5 + b55b5ba commit b694416
Show file tree
Hide file tree
Showing 30 changed files with 185 additions and 278 deletions.
6 changes: 4 additions & 2 deletions App.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
12 changes: 0 additions & 12 deletions BlazorMarkdig.csproj

This file was deleted.

10 changes: 4 additions & 6 deletions Data/WeatherForecast.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System;

namespace BlazorMarkdig.Data
namespace MarkdownEditUsingMarkdig.Data
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public DateOnly Date { get; set; }

public int TemperatureC { get; set; }

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

public string Summary { get; set; }
public string? Summary { get; set; }
}
}
}
19 changes: 7 additions & 12 deletions Data/WeatherForecastService.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
using System;
using System.Linq;
using System.Threading.Tasks;

namespace BlazorMarkdig.Data
namespace MarkdownEditUsingMarkdig.Data
{
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};

public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
{
var rng = new Random();
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
}
}
15 changes: 15 additions & 0 deletions MarkdownEditUsingMarkdig.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

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

<ItemGroup>
<PackageReference Include="Markdig" Version="0.33.0" />
<PackageReference Include="Syncfusion.Blazor.RichTextEditor" Version="23.1.40" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.40" />
</ItemGroup>

</Project>
16 changes: 8 additions & 8 deletions BlazorMarkdig.sln → MarkdownEditUsingMarkdig.sln
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30516.212
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorMarkdig", "BlazorMarkdig.csproj", "{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarkdownEditUsingMarkdig", "MarkdownEditUsingMarkdig.csproj", "{129D0070-717C-44BD-A322-B7161581320B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07C4FFA6-EF3B-4681-BE8F-F7B5F1F75758}.Release|Any CPU.Build.0 = Release|Any CPU
{129D0070-717C-44BD-A322-B7161581320B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{129D0070-717C-44BD-A322-B7161581320B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{129D0070-717C-44BD-A322-B7161581320B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{129D0070-717C-44BD-A322-B7161581320B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {11AC6ADA-1CCA-48C1-9710-D51F6E9A9F3E}
SolutionGuid = {75FFF336-0060-4360-BB68-11F394C711C2}
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@page "/counter"

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p>Current count: @currentCount</p>
<p role="status">Current count: @currentCount</p>

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

Expand Down
6 changes: 3 additions & 3 deletions Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@page
@model BlazorMarkdig.Pages.ErrorModel
@model MarkdownEditUsingMarkdig.Pages.ErrorModel

<!DOCTYPE html>
<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/app.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>

<body>
Expand Down
11 changes: 3 additions & 8 deletions Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;

namespace BlazorMarkdig.Pages
namespace MarkdownEditUsingMarkdig.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public string? RequestId { get; set; }

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

Expand All @@ -29,4 +24,4 @@ public void OnGet()
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}
}
9 changes: 5 additions & 4 deletions Pages/FetchData.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@page "/fetchdata"

@using BlazorMarkdig.Data
@using MarkdownEditUsingMarkdig.Data
@inject WeatherForecastService ForecastService

<PageTitle>Weather forecast</PageTitle>

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from a service.</p>
Expand Down Expand Up @@ -37,10 +38,10 @@ else
}

@code {
private WeatherForecast[] forecasts;
private WeatherForecast[]? forecasts;

protected override async Task OnInitializedAsync()
{
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
forecasts = await ForecastService.GetForecastAsync(DateOnly.FromDateTime(DateTime.Now));
}
}
3 changes: 0 additions & 3 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@page "/"

@using Syncfusion.Blazor.RichTextEditor;
@using Markdig;

<div class="control-section">
<div class="e-rte-preview" style="height:500px;">
<div class="container">
Expand Down
14 changes: 7 additions & 7 deletions Pages/_Host.cshtml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
@page "/"
@namespace BlazorMarkdig.Pages
@using Microsoft.AspNetCore.Components.Web
@namespace MarkdownEditUsingMarkdig.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BlazorMarkdig</title>
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="_content/Syncfusion.Blazor/styles/bootstrap4.css" rel="stylesheet" />
<link href="BlazorMarkdig.styles.css" rel="stylesheet" />
<link href="MarkdownEditUsingMarkdig.styles.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
<component type="typeof(App)" render-mode="ServerPrerendered" />
Expand Down
55 changes: 31 additions & 24 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace BlazorMarkdig
using MarkdownEditUsingMarkdig.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Syncfusion.Blazor;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSyncfusionBlazor();
builder.Services.AddSingleton<WeatherForecastService>();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
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();

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();
23 changes: 16 additions & 7 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:49943",
"sslPort": 44320
"applicationUrl": "http://localhost:22904",
"sslPort": 44356
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5168",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorMarkdig": {
"https": {
"commandName": "Project",
"dotnetRunMessages": "true",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7288;http://localhost:5168",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ The [Blazor Markdown Editor](https://www.syncfusion.com/blazor-components/blazor

This example shows how to integrate the Markdig third-party library into Syncfusion Blazor Rich Text Editor’s Markdown editor (MD editor) to preview the Markdown.

## Project prerequisites
Make sure you have the compatible versions of .NET Core on your machine before starting to work on this project. You also need the following:
## Prerequisites

* [Visual Studio 2019 (version 16.4+)]( https://visualstudio.microsoft.com/downloads)
* [.NET Core SDK 3.1.2+](https://dotnet.microsoft.com/download/dotnet-core/3.1)
- [Markdig](https://www.nuget.org/packages/Markdig/).
* Visual Studio 2022

## How to run this application
To run this application, you need to first clone or download the ‘blazor-markdown-editor-preview’ repository and then open it in Visual Studio 2019. Now, build and run your project to view the output.
## How to run the project

* Checkout this project to a location in your disk.
* Open the solution file using the Visual Studio 2022.
* Restore the NuGet packages by rebuilding the solution.
* Run the project.

## Further help
To get more help, check out the [ASP.NET Core Blazor documentation](https://docs.microsoft.com/en-us/aspnet/core/blazor).
Expand Down
Loading

0 comments on commit b694416

Please sign in to comment.