Feat:演示插件配置同步思维导图的选项配置

This commit is contained in:
wanglin2
2025-04-13 13:41:09 +08:00
parent 715627727e
commit b79076baa3

View File

@@ -43,6 +43,18 @@ class Demonstrate {
this.mindMap.opt.demonstrateConfig || {} this.mindMap.opt.demonstrateConfig || {}
) )
this.needRestorePerformanceMode = false this.needRestorePerformanceMode = false
this.onConfigUpdate = this.onConfigUpdate.bind(this)
this.mindMap.on('after_update_config', this.onConfigUpdate)
}
// 监听配置更新
onConfigUpdate(opt) {
if (typeof opt.demonstrateConfig !== 'undefined') {
this.config = {
...this.config,
...opt.demonstrateConfig
}
}
} }
// 进入演示模式 // 进入演示模式
@@ -417,11 +429,13 @@ class Demonstrate {
// 插件被移除前做的事情 // 插件被移除前做的事情
beforePluginRemove() { beforePluginRemove() {
this.unBindEvent() this.unBindEvent()
this.mindMap.off('after_update_config', this.onConfigUpdate)
} }
// 插件被卸载前做的事情 // 插件被卸载前做的事情
beforePluginDestroy() { beforePluginDestroy() {
this.unBindEvent() this.unBindEvent()
this.mindMap.off('after_update_config', this.onConfigUpdate)
} }
} }