mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-20 05:29:58 +08:00
fix(editor): 避免services plugin重复添加
This commit is contained in:
parent
c2830fca6b
commit
cdb07dfaea
@ -206,7 +206,9 @@ export default class extends EventEmitter {
|
|||||||
|
|
||||||
public usePlugin(options: Record<string, Function>) {
|
public usePlugin(options: Record<string, Function>) {
|
||||||
for (const [methodName, method] of Object.entries(options)) {
|
for (const [methodName, method] of Object.entries(options)) {
|
||||||
if (typeof method === 'function') this.pluginOptionsList[methodName].push(method);
|
if (typeof method === 'function' && !this.pluginOptionsList[methodName].includes(method)) {
|
||||||
|
this.pluginOptionsList[methodName].push(method);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user