-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from dorthl/mian
fix admin
- Loading branch information
Showing
59 changed files
with
913 additions
and
562 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,5 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "7.0.304" | ||
"version": "7.0.400" | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,11 @@ | ||
@inject IJSRuntime _jsRuntime; | ||
@inject CommonJsInterop _commonJsInterop | ||
|
||
@code { | ||
[Parameter] public string Title { get; set; } = default!; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
await SetTitleAsync(); | ||
await _commonJsInterop.SetTitleAsync(Title); | ||
} | ||
private async Task SetTitleAsync() => await _jsRuntime.InvokeVoidAsync("commonJsFunctions.setTitle", Title); | ||
} |
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,7 @@ | ||
namespace Blogifier.Admin; | ||
|
||
public class FrontBlobInfo | ||
{ | ||
public string FileName { get; set; } = default!; | ||
public string Url { get; set; } = default!; | ||
} |
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,49 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Blogifier.Admin.Interop; | ||
|
||
public class CommonJsInterop : IAsyncDisposable | ||
{ | ||
private readonly Lazy<Task<IJSObjectReference>> moduleTask; | ||
|
||
public CommonJsInterop(IJSRuntime jsRuntime) | ||
{ | ||
moduleTask = new(() => jsRuntime.InvokeAsync<IJSObjectReference>("import", "./admin/js/common.js").AsTask()); | ||
} | ||
|
||
public async ValueTask SetTooltipAsync() | ||
{ | ||
var module = await moduleTask.Value; | ||
await module.InvokeVoidAsync("setTooltip"); | ||
} | ||
|
||
public async ValueTask SetTitleAsync(string content) | ||
{ | ||
var module = await moduleTask.Value; | ||
await module.InvokeVoidAsync("setTitle", content); | ||
} | ||
|
||
public async ValueTask TriggerClickAsync(ElementReference? element) | ||
{ | ||
var module = await moduleTask.Value; | ||
await module.InvokeVoidAsync("triggerClick", element); | ||
} | ||
|
||
public async ValueTask<FrontBlobInfo> GetInputFileBlobInfoAsync(ElementReference? inputUpload) | ||
{ | ||
var module = await moduleTask.Value; | ||
return await module.InvokeAsync<FrontBlobInfo>("getInputFileBlobInfo", inputUpload); | ||
} | ||
|
||
public async ValueTask DisposeAsync() | ||
{ | ||
if (moduleTask.IsValueCreated) | ||
{ | ||
var module = await moduleTask.Value; | ||
await module.DisposeAsync(); | ||
} | ||
} | ||
} |
Oops, something went wrong.