Skip to content

Commit 7710f34

Browse files
authored
fix(Editor): upload image not work (#851)
* fix: 修复上传等事件无响应问题 * chore: bump version 10.0.1
1 parent 861111e commit 7710f34

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

3+
<PropertyGroup>
4+
<Version>10.0.1</Version>
5+
</PropertyGroup>
6+
37
<PropertyGroup>
48
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components Editor SummerNote</PackageTags>
59
<Description>Bootstrap UI components extensions of Editor</Description>

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,18 @@ export async function init(id, invoker, methodGetPluginAttrs, methodClickPluginI
145145
const reloadCallbacks = (id, option) => {
146146
const events = ['Blur', 'BlurCodeview', 'Change', 'ChangeCodeview', 'DialogShown', 'Enter', 'Focus', 'ImageUpload', 'ImageLinkInsert', 'ImageUploadError', 'Init', 'Keydown', 'Keyup', 'Mousedown', 'Mouseup', 'Paste', 'Scroll'];
147147

148-
events.forEach(event => {
149-
option.callbacks[`on${event}`] = function () {
150-
const callbacks = window.BootstrapBlazor?.SummerNote?.callbacks;
151-
const cb = callbacks?.find(i => i.id === id);
152-
cb?.[`on${event}`]?.apply(this, arguments);
153-
};
154-
});
148+
const callbacks = window.BootstrapBlazor?.SummerNote?.callbacks;
149+
const cb = callbacks?.find(i => i.id === id);
150+
if (cb) {
151+
events.forEach(event => {
152+
const method = cb[`on${event}`];
153+
if (method) {
154+
option.callbacks[`on${event}`] = function () {
155+
method.apply(this, arguments);
156+
};
157+
}
158+
});
159+
}
155160
}
156161

157162
export function update(id, val) {

0 commit comments

Comments
 (0)