Skip to content

Commit 76e1d44

Browse files
committed
refactor: 精简脚本
1 parent 1f3cb19 commit 76e1d44

1 file changed

Lines changed: 0 additions & 22 deletions

File tree

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)