feat: use general create vditor method

This commit is contained in:
James Yeung 2020-07-13 00:14:49 +08:00
Родитель 87da8fca13
Коммит 71ad091caa
6 изменённых файлов: 16 добавлений и 14 удалений

Просмотреть файл

@ -5,11 +5,11 @@ VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vditor.Docs.Server", "src\Vditor.Docs.Server\Vditor.Docs.Server.csproj", "{23C760C0-98FE-4ED5-881C-070CBB94FE74}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vditor", "src\Vditor\Vditor.csproj", "{CA2D52FC-0A3E-4B75-B63F-ECBE4716B3BB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vditor.Docs", "src\Vditor.Docs\Vditor.Docs.csproj", "{E994DD0D-C3E0-47CA-B584-E0F92E9AB7EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vditor.Docs.WebAssembly", "src\Vditor.Docs.WebAssembly\Vditor.Docs.WebAssembly.csproj", "{1863ABD1-9C93-4CBC-8645-6FD02394F28B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vditor.Docs.WebAssembly", "src\Vditor.Docs.WebAssembly\Vditor.Docs.WebAssembly.csproj", "{1863ABD1-9C93-4CBC-8645-6FD02394F28B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vditor", "src\Vditor\Vditor.csproj", "{BC1EAC5D-51CD-4E1E-96E1-157242FE205F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,10 +21,6 @@ Global
{23C760C0-98FE-4ED5-881C-070CBB94FE74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23C760C0-98FE-4ED5-881C-070CBB94FE74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23C760C0-98FE-4ED5-881C-070CBB94FE74}.Release|Any CPU.Build.0 = Release|Any CPU
{CA2D52FC-0A3E-4B75-B63F-ECBE4716B3BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA2D52FC-0A3E-4B75-B63F-ECBE4716B3BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA2D52FC-0A3E-4B75-B63F-ECBE4716B3BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA2D52FC-0A3E-4B75-B63F-ECBE4716B3BB}.Release|Any CPU.Build.0 = Release|Any CPU
{E994DD0D-C3E0-47CA-B584-E0F92E9AB7EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E994DD0D-C3E0-47CA-B584-E0F92E9AB7EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E994DD0D-C3E0-47CA-B584-E0F92E9AB7EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -33,6 +29,10 @@ Global
{1863ABD1-9C93-4CBC-8645-6FD02394F28B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1863ABD1-9C93-4CBC-8645-6FD02394F28B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1863ABD1-9C93-4CBC-8645-6FD02394F28B}.Release|Any CPU.Build.0 = Release|Any CPU
{BC1EAC5D-51CD-4E1E-96E1-157242FE205F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC1EAC5D-51CD-4E1E-96E1-157242FE205F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC1EAC5D-51CD-4E1E-96E1-157242FE205F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC1EAC5D-51CD-4E1E-96E1-157242FE205F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -15,7 +15,7 @@
<ItemGroup>
<ProjectReference Include="..\Vditor.Docs\Vditor.Docs.csproj" />
<ProjectReference Include="..\Vditor\Vditor.csproj" />
<ProjectReference Include="..\Vditor\Charts.csproj" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -4,4 +4,6 @@
Vditor of blazor.
<Vditor.Editor />
<Vditor.Editor />

Просмотреть файл

@ -1,5 +1,3 @@
@namespace Vditor
<div id="vditor"></div>
<div @ref="Ref"></div>

Просмотреть файл

@ -8,13 +8,15 @@ namespace Vditor
{
[Inject] private IJSRuntime JS { get; set; }
private ElementReference Ref;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
if (firstRender)
{
await JS.InvokeVoidAsync("vditorScript");
await JS.InvokeVoidAsync("createVditor", Ref);
}
}
}

Просмотреть файл

@ -1,8 +1,8 @@
// This file is to show how a library package may provide JavaScript interop features
// wrapped in a .NET API
vditorScript = () => {
new Vditor('vditor', {
createVditor = (domRef) => {
new Vditor(domRef, {
height: 360,
cache: {
enable: false,