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