-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
777 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: publish | ||
env: | ||
VERSION: '0.6.6-preview' | ||
VERSION: '0.7.0-preview' | ||
PRERELEASE: true | ||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
<div class="wiki-site-subtitle">From @WikiOptions.SiteName</div> | ||
@if (!IsDiff && FrontMatterType is not null) | ||
{ | ||
<DynamicComponent Type="FrontMatterType" Parameters="FrontEndMatterParameters" /> | ||
<DynamicRenderModeComponent CanEdit="CanEdit" | ||
ComponentType="FrontMatterType" | ||
Page="Page" | ||
RenderMode="FrontMatterRenderMode" | ||
User="User" /> | ||
} | ||
<tf-syntax-highlight class="wiki-parser-output">@Content</tf-syntax-highlight> | ||
@if (!IsDiff && EndMatterType is not null) | ||
{ | ||
<DynamicComponent Type="EndMatterType" Parameters="FrontEndMatterParameters" /> | ||
<DynamicRenderModeComponent CanEdit="CanEdit" | ||
ComponentType="EndMatterType" | ||
Page="Page" | ||
RenderMode="EndMatterRenderMode" | ||
User="User" /> | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.AspNetCore.Components.Rendering; | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace Tavenem.Wiki.Blazor.Client.Shared; | ||
|
||
/// <summary> | ||
/// Dynamically renders a component with a render mode. | ||
/// </summary> | ||
public class DynamicRenderModeComponent : ComponentBase | ||
{ | ||
/// <summary> | ||
/// Whether the current user has permission to edit this article. | ||
/// </summary> | ||
[Parameter] public bool CanEdit { get; set; } | ||
|
||
/// <summary> | ||
/// The article to display. | ||
/// </summary> | ||
[Parameter] public Page? Page { get; set; } | ||
|
||
/// <summary> | ||
/// The current user (may be null if the current user is browsing anonymously). | ||
/// </summary> | ||
[Parameter] public IWikiUser? User { get; set; } | ||
|
||
/// <summary> | ||
/// The type of component to render. | ||
/// </summary> | ||
[Parameter] | ||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] | ||
public Type? ComponentType { get; set; } | ||
|
||
/// <summary> | ||
/// The render mode to use, or <see langword="null"/> if static rendering should be used. | ||
/// </summary> | ||
[Parameter] public IComponentRenderMode? RenderMode { get; set; } | ||
|
||
/// <inheritdoc/> | ||
protected override void BuildRenderTree(RenderTreeBuilder builder) | ||
{ | ||
if (ComponentType is null) | ||
{ | ||
return; | ||
} | ||
|
||
builder.OpenComponent(0, ComponentType); | ||
builder.AddAttribute(1, "Article", Page); | ||
builder.AddAttribute(2, "CanEdit", CanEdit); | ||
builder.AddAttribute(3, "User", User); | ||
builder.AddComponentRenderMode(RenderMode); | ||
builder.CloseComponent(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/ExampleWikiOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Tavenem.Wiki.Blazor.Client; | ||
|
||
namespace Tavenem.Wiki.Blazor.Example; | ||
|
||
public static class ExampleWikiOptions | ||
{ | ||
public static readonly WikiOptions Instance = new() | ||
{ | ||
ContactPageTitle = null, | ||
ContentsPageTitle = null, | ||
CopyrightPageTitle = null, | ||
LinkTemplate = WikiBlazorClientOptions.DefaultLinkTemplate, | ||
MaxFileSize = 0, | ||
PolicyPageTitle = null, | ||
}; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/MainFrontMatter.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<button class="btn primary my-3" @onclick=@(_ => _value++)>Counter: <span>@_value.ToString("N0")</span></button> | ||
|
||
@code { | ||
[Parameter] public Page? Article { get; set; } | ||
[Parameter] public bool CanEdit { get; set; } | ||
[Parameter] public IWikiUser? User { get; set; } | ||
private int _value; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
using Tavenem.Wiki.Blazor.Example.Services; | ||
|
||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
|
||
var httpClient = new HttpClient() { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }; | ||
builder.Services.AddScoped(_ => httpClient); | ||
|
||
builder.Services.AddAuthorizationCore(); | ||
await builder.Services.AddWikiClientAsync(false); | ||
|
||
await builder.Build().RunAsync(); |
19 changes: 19 additions & 0 deletions
19
src/Tavenem.Wiki.Blazor.Example/Tavenem.Wiki.Blazor.Example.Client/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Tavenem.Wiki.Blazor.Example | ||
== | ||
|
||
This project is a bare-bones example with the minimum required code for a `NeverFoundry.Wiki.Blazor` | ||
wiki. | ||
|
||
The sample uses a project reference to Tavenem.Wiki.Blazor.Client (i.e. not a package references to | ||
the NuGet release). The easiest way to get it up and running is to clone the entire repo to your own | ||
system, then run the example server project. | ||
|
||
## WARNING | ||
This sample is **not** suitable for use in a production environment. It's using an | ||
in-memory database and mocked user identity system. ***DO NOT*** copy this code as-is and put it | ||
into production. It is intended only for you to quickly and easily experience the capabilities and | ||
the look-and-feel of the main package's defaults in a live sandbox. | ||
|
||
A production implementation should override the various properties as described in the README of | ||
this project and [Tavenem.Wiki](https://github.com/Tavenem/Wiki) with production-ready values and | ||
services. |
Oops, something went wrong.