diff --git a/README.md b/README.md index ae9513e..8f16397 100644 --- a/README.md +++ b/README.md @@ -138,13 +138,13 @@ An action has the following settings:
Show supported operations -| Operation | Description | -| --------------- | ------------------------------------------------------------------------------ | -| `addTag` | Add tag(s) to the target item. | -| `removeTag` | Remove tag(s) from the target item. | -| `toggleTag` | Add tag(s) to the target item if it doesn't have the tag, otherwise remove it. | -| `anotherAction` | Run another custom action. | -| `customScript` | Run a custom script. | +| Operation | Description | +| -------------- | ------------------------------------------------------------------------------ | +| `addTag` | Add tag(s) to the target item. | +| `removeTag` | Remove tag(s) from the target item. | +| `toggleTag` | Add tag(s) to the target item if it doesn't have the tag, otherwise remove it. | +| `otherAction` | Run other custom actions. | +| `customScript` | Run a custom script. |
@@ -152,7 +152,7 @@ An action has the following settings: - For tag operations, it's tags separated by comma - For custom script, it's the script code. - - For trigger another action, it's the target action's name. + - For trigger other actions, it's the target actions' names (each in one line). > Click `⤤` in the edit action popup to open editor for multi-line data. diff --git a/addon/locale/en-US/addon.ftl b/addon/locale/en-US/addon.ftl index cbe8cc9..12aa26c 100644 --- a/addon/locale/en-US/addon.ftl +++ b/addon/locale/en-US/addon.ftl @@ -30,7 +30,7 @@ prefs-action-operation-add = Add Tags prefs-action-operation-remove = Remove Tags prefs-action-operation-toggle = Toggle Tags prefs-action-operation-script = Script -prefs-action-operation-triggerAction = Trigger Another Action +prefs-action-operation-triggerAction = Trigger Other Actions prefs-action-edit-title = Edit Action prefs-action-edit-save = Save diff --git a/addon/locale/it-IT/addon.ftl b/addon/locale/it-IT/addon.ftl index d2c96de..130b123 100644 --- a/addon/locale/it-IT/addon.ftl +++ b/addon/locale/it-IT/addon.ftl @@ -29,7 +29,7 @@ prefs-action-operation-add = Aggiungi Tag prefs-action-operation-remove = Rimuovi Tag prefs-action-operation-toggle = Aggiungi/rimuovi Tag prefs-action-operation-script = Script -prefs-action-operation-triggerAction = Innesca altra azione +prefs-action-operation-triggerAction = Trigger Other Actions prefs-action-edit-title = Modifica azione prefs-action-edit-save = Salva diff --git a/addon/locale/zh-CN/preferences.ftl b/addon/locale/zh-CN/preferences.ftl index dfb31d5..d7c67af 100644 --- a/addon/locale/zh-CN/preferences.ftl +++ b/addon/locale/zh-CN/preferences.ftl @@ -19,7 +19,7 @@ action-operation-add = 添加标签 action-operation-remove = 移除标签 action-operation-toggle = 切换标签 action-operation-script = 自定义脚本 -action-operation-triggerAction = 触发另一个动作 +action-operation-triggerAction = 触发其他动作 action-add = .tooltiptext = 创建新动作 diff --git a/src/utils/actions.ts b/src/utils/actions.ts index 0b0034d..cf24bab 100644 --- a/src/utils/actions.ts +++ b/src/utils/actions.ts @@ -293,16 +293,17 @@ async function applyAction(action: ActionData, args: ActionArgs) { break; } case ActionOperationTypes.triggerAction: { - const actions = getActions(); - // Find the action by name - const nextAction = Object.values(actions).find( - (_action) => _action.name === action.data, - ); - if (nextAction) { - await applyAction(nextAction, args); - return true; + const actions = Object.values(getActions()); + const actionNames = action.data.split("\n"); + const targetActions = actionNames + .map((name) => actions.find((a) => a.name === name)) + .filter((action) => action) as ActionData[]; + if (targetActions.length === 0) { + return false; + } + for (const action of targetActions) { + await applyAction(action, args); } - message = `Action ${action.data} not found`; return false; } }