Skip to content

Commit 46bea10

Browse files
authored
feat(Editor): update return type nullable (#538)
* refactor: 精简代码 * refactor: 返回值更改为可为空 * chore: bump version 9.0.7
1 parent e91fabf commit 46bea10

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/components/BootstrapBlazor.SummerNote/BootstrapBlazor.SummerNote.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.0.6</Version>
4+
<Version>9.0.7</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/components/BootstrapBlazor.SummerNote/Components/Editor/Editor.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public async Task<string> ClickPluginItem(string pluginItemName)
270270
/// <param name="size"></param>
271271
/// <param name="stream"></param>
272272
[JSInvokable]
273-
public async Task<string> ImageUpload(string name, string contentType, long size, IJSStreamReference stream)
273+
public async Task<string?> ImageUpload(string name, string contentType, long size, IJSStreamReference stream)
274274
{
275275
string? ret = null;
276276
await using var data = await stream.OpenReadStreamAsync(size);
@@ -279,7 +279,7 @@ public async Task<string> ImageUpload(string name, string contentType, long size
279279
{
280280
ret = await OnFileUpload(file);
281281
}
282-
return ret ?? "";
282+
return ret;
283283
}
284284

285285
/// <summary>

src/components/BootstrapBlazor.SummerNote/Components/Editor/Editor.razor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ export async function init(id, invoker, methodGetPluginAttrs, methodClickPluginI
5151
editor.files = files
5252
for (let i = 0; i < files.length; i++) {
5353
const file = files[i];
54-
const buffer = await file.arrayBuffer();
55-
const stream = DotNet.createJSStreamReference(buffer);
54+
const stream = DotNet.createJSStreamReference(file);
5655
const url = await editor.invoker.invokeMethodAsync('ImageUpload',
5756
file.name,
5857
file.type || 'application/octet-stream',

0 commit comments

Comments
 (0)