Page MenuHomePhabricator

Callback actions are run when the toolbar is loaded, not when the tool button is clicked
Closed, ResolvedPublic

Description

In order for the WikiEditor toolbar to be extensible, we need a way to allow addition of toolbar buttons which execute custom functions when clicked. The 'callback' action seems to be created to address this issue. However, when you create a custom button with 'callback' action and pass the callback function name using the 'execute' property, this function is called when the toolbar is loaded (that is, right after the edit page is loaded).

Expected result would be not to execute the function on page load, but to only execute it when the specific button is clicked on.


Version: unspecified
Severity: enhancement

Details

Reference
bz24753

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:07 PM
bzimport added a project: WikiEditor.
bzimport set Reference to bz24753.
bzimport added a subscriber: Unknown Object (MLST).

I think the idea is to use the callback to bind event handlers and do other manipulation.

If that's the case, then I'd like to propose an enhancement allowing calling custom functions for button clicks directly through action{} object.

TheDJ claimed this task.
TheDJ subscribed.

worksforme

action: {
	type: 'callback',
	execute: function () {
		console.log( "testing" );
	}
}