Skip to content

Commit 6c05499

Browse files
authored
refactor(Editor): remove BootstrapBlazor.SummerNote.callbacks (#863)
* refactor: 更新文档注释 * refactor: 精简脚本 * chore: bump version 10.0.2
1 parent 3275974 commit 6c05499

3 files changed

Lines changed: 2 additions & 24 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>10.0.1</Version>
4+
<Version>10.0.2</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public partial class Editor
3232
public string? PlaceHolder { get; set; }
3333

3434
/// <summary>
35-
/// 获得/设置 是否直接显示为富文本编辑框
35+
/// 获得/设置 是否直接显示为富文本编辑框 默认 false
3636
/// </summary>
3737
[Parameter]
3838
public bool IsEditor { get; set; }

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import { addLink, addScript } from '../../../BootstrapBlazor/modules/utility.js'
33
import Data from '../../../BootstrapBlazor/modules/data.js'
44
import EventHandler from '../../../BootstrapBlazor/modules/event-handler.js'
55

6-
if (window.BootstrapBlazor === void 0) {
7-
window.BootstrapBlazor = {};
8-
}
9-
106
export async function init(id, invoker, methodGetPluginAttrs, methodClickPluginItem, height, value, lang, langUrl, hasUpload) {
117
const el = document.getElementById(id)
128
if (el === null) {
@@ -45,7 +41,6 @@ export async function init(id, invoker, methodGetPluginAttrs, methodClickPluginI
4541

4642
const showSubmit = el.getAttribute("data-bb-submit") === "true"
4743
option.toolbar = toolbar;
48-
reloadCallbacks(id, option);
4944
if (hasUpload) {
5045
option.callbacks.onImageUpload = async files => {
5146
editor.files = files
@@ -142,23 +137,6 @@ export async function init(id, invoker, methodGetPluginAttrs, methodClickPluginI
142137
await initEditor();
143138
}
144139

145-
const reloadCallbacks = (id, option) => {
146-
const events = ['Blur', 'BlurCodeview', 'Change', 'ChangeCodeview', 'DialogShown', 'Enter', 'Focus', 'ImageUpload', 'ImageLinkInsert', 'ImageUploadError', 'Init', 'Keydown', 'Keyup', 'Mousedown', 'Mouseup', 'Paste', 'Scroll'];
147-
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-
}
160-
}
161-
162140
export function update(id, val) {
163141
const editor = Data.get(id)
164142
if (editor.$editor) {

0 commit comments

Comments
 (0)