feat:config动作优化

This commit is contained in:
pianruijie 2023-03-13 18:52:19 +08:00
parent 4475bb1702
commit f6be7b7ccb
2 changed files with 9 additions and 5 deletions

View File

@ -167,7 +167,6 @@ export const runActions = async (
// 这些节点的子节点运行逻辑由节点内部实现
await runAction(actionInstrance, actionConfig, renderer, event);
if (event.stoped) {
break;
}
@ -252,7 +251,8 @@ export const runAction = async (
console.group?.(`run action ${actionConfig.actionType}`);
console.debug(`[${actionConfig.actionType}] action args, data`, args, data);
await actionInstrance.run(
let stoped = false;
const actionResult = await actionInstrance.run(
{
...actionConfig,
args,
@ -262,12 +262,15 @@ export const runAction = async (
event,
mergeData
);
// 二次确认弹窗如果取消,则终止后续动作
if (actionConfig?.actionType === 'confirmDialog' && !actionResult) {
stoped = true;
}
console.debug(`[${actionConfig.actionType}] action end event`, event);
console.groupEnd?.();
// 阻止原有动作执行
preventDefault && event.preventDefault();
// 阻止后续动作执行
stopPropagation && event.stopPropagation();
(stopPropagation || stoped) && event.stopPropagation();
};

View File

@ -113,7 +113,8 @@ export class ConfirmAction implements RendererAction {
renderer: ListenerContext,
event: RendererEvent<any>
) {
event.context.env.confirm?.(action.args?.msg, action.args?.title);
const confirmed = await event.context.env.confirm?.(action.args?.msg, action.args?.title);
return confirmed;
}
}