From e64d0d7cc5956635057eeffe5d54ea679cdb1a55 Mon Sep 17 00:00:00 2001 From: Matt Swanson Date: Tue, 12 Dec 2023 21:05:04 -0500 Subject: [PATCH] Pass invoking element as event data --- src/trix/controllers/editor_controller.js | 8 ++++---- src/trix/controllers/toolbar_controller.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/trix/controllers/editor_controller.js b/src/trix/controllers/editor_controller.js index 89c222df0..6f469db5a 100644 --- a/src/trix/controllers/editor_controller.js +++ b/src/trix/controllers/editor_controller.js @@ -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) { @@ -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) } diff --git a/src/trix/controllers/toolbar_controller.js b/src/trix/controllers/toolbar_controller.js index 588228035..a1178fea7 100644 --- a/src/trix/controllers/toolbar_controller.js +++ b/src/trix/controllers/toolbar_controller.js @@ -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) } }