Skip to content

Commit

Permalink
Pass invoking element as event data
Browse files Browse the repository at this point in the history
  • Loading branch information
swanson committed Dec 13, 2023
1 parent bceee69 commit e64d0d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/trix/controllers/editor_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ export default class EditorController extends Controller {
}
}

toolbarDidInvokeAction(actionName) {
return this.invokeAction(actionName)
toolbarDidInvokeAction(actionName, invokingElement) {
return this.invokeAction(actionName, invokingElement)
}

toolbarDidToggleAttribute(attributeName) {
Expand Down Expand Up @@ -448,9 +448,9 @@ export default class EditorController extends Controller {
}
}

invokeAction(actionName) {
invokeAction(actionName, invokingElement) {
if (this.actionIsExternal(actionName)) {
return this.notifyEditorElement("action-invoke", { actionName })
return this.notifyEditorElement("action-invoke", { actionName, invokingElement })
} else {
return this.actions[actionName]?.perform?.call(this)
}
Expand Down
2 changes: 1 addition & 1 deletion src/trix/controllers/toolbar_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class ToolbarController extends BasicObject {
if (this.getDialog(actionName)) {
return this.toggleDialog(actionName)
} else {
return this.delegate?.toolbarDidInvokeAction(actionName)
return this.delegate?.toolbarDidInvokeAction(actionName, element)
}
}

Expand Down

0 comments on commit e64d0d7

Please sign in to comment.