IITC.toolbox

Toolbox API

Methods

private, static _applySort()

Internal method to apply sorting to the buttons.

private, static _renderButton(buttonId)

Internal method to render a button.

Parameters:
Name Type Description
buttonId string

The ID of the button to render.

private, static _syncWithLegacyToolbox() → {void}

Internal method to synchronize the toolbox with the legacy toolbox.

Returns:
void

static addButton(buttonArgs) → {string|null}

Adds a button to the toolbox.

Parameters:
Name Type Description
buttonArgs ButtonArgs

The arguments for the button.

Returns:
string | null -

The ID of the added button or null if required parameters are missing.

Examples
const buttonId = IITC.toolbox.addButton({
  label: 'AboutIITC',
  action: window.AboutIITC
});
const buttonId = IITC.toolbox.addButton({
  label: 'Test Button',
  action: () => alert('Clicked!')
});

static removeButton(buttonId) → {boolean}

Removes a button from the toolbox.

Parameters:
Name Type Description
buttonId string

The ID of the button to remove.

Returns:
boolean -

True if the button is successfully removed, false otherwise.

Example
const isRemoved = IITC.toolbox.removeButton(buttonId);

static setSortMethod(sortMethod) → {void}

Sets the sorting method for the toolbox buttons.

Parameters:
Name Type Description
sortMethod function

The sorting method to be used.

Returns:
void
Example
IITC.toolbox.setSortMethod((a, b) => a.label.localeCompare(b.label));

static updateButton(buttonId, newButtonArgs) → {boolean}

Updates an existing button in the toolbox.

Parameters:
Name Type Description
buttonId string

The ID of the button to update.

newButtonArgs ButtonArgs

The new arguments for the button.

Returns:
boolean -

True if the button is successfully updated, false otherwise.

Example
const isUpdated = IITC.toolbox.updateButton(buttonId, { label: 'Updated Button', action: () => console.log('New Action') });