mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 19:38:16 +08:00
fix: 全局事件动作避免死锁
This commit is contained in:
parent
d315f22fce
commit
1fd4573382
@ -225,8 +225,12 @@ export const bindGlobalEventForRenderer = (renderer: any) => {
|
||||
scoped: renderer?.context,
|
||||
data
|
||||
});
|
||||
// 过滤掉当前的广播事件,避免循环广播
|
||||
const actions = listener.actions.filter(
|
||||
a => !(a.actionType === 'broadcast' && a.eventName === eventName)
|
||||
);
|
||||
|
||||
runActions(listener.actions, renderer, rendererEvent);
|
||||
runActions(actions, renderer, rendererEvent);
|
||||
};
|
||||
}
|
||||
return () => {
|
||||
|
@ -46,7 +46,7 @@ export default class ActionConfigPanel extends React.Component<RendererProps> {
|
||||
} else {
|
||||
const __originActionSchema = data.__actionSchema;
|
||||
schema = isFunction(__originActionSchema)
|
||||
? __originActionSchema(manager)
|
||||
? __originActionSchema(manager, data)
|
||||
: __originActionSchema;
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ registerActionPanel('broadcast', {
|
||||
</div>
|
||||
);
|
||||
},
|
||||
schema: (manager: EditorManager) => {
|
||||
schema: (manager: EditorManager, data: any) => {
|
||||
const globalEvents =
|
||||
manager.config?.actionOptions?.globalEventGetter?.(manager) || [];
|
||||
return {
|
||||
@ -34,7 +34,8 @@ registerActionPanel('broadcast', {
|
||||
options: globalEvents.map(item => ({
|
||||
label: item.label,
|
||||
value: item.name,
|
||||
mapping: item.mapping
|
||||
mapping: item.mapping,
|
||||
disabled: item.name === data.eventKey
|
||||
})),
|
||||
size: 'lg',
|
||||
mode: 'horizontal',
|
||||
|
Loading…
Reference in New Issue
Block a user