OperationsManager

Type: Class

How to get operationsManager?

JavaScript

import operationsManager from 'fontoxml-operations/src/operationsManager.js'

Operations control all interaction with the document and most state of the application. The operationManager manages the operations pipeline. It may execute operations and retrieve the state of an operation.

More information can be found in our Operations concept page. Also refer to our guide on creating operations.

Methods

addAlternativeOperation

Type: Function

Provides a way to dynamically compose a set of alternatives. This method uses key as a key of alternative operations' names. Moreover it can update alternatives of an existing operation defined in an 'operation.json' file when the operation keeps the alternative as a 'string' which is a key rather than an array.

Example usage: tab, shift-tab, move-item-up and move-item-down operation handles their keybindings. A few alternative operations are already added and new alternatives can be added as below. For example, to add rows-delete operation for deleting a row(s) from a table to shift+tab key.

Other

	operationsManager.addAlternativeOperation('shift-tab', 'rows-delete', 75);

Arguments

executeOperation

Type: Function

Execute the Operation with the specified operationName, optionally passing the specified initialData as its step data. Returns a promise that resolves to the resulting step data when the operation completes.

Code calling this method should always handle rejection, to prevent console errors about unhandled rejections.

Arguments

Returns

getOperationState

Type: Function

Compute the state of the operation with the specified operationName, optionally passing the specified initialData as its step data.

If resultAsStepData is true, this function returns the resulting step data with the operation state object under the operationState property.

Otherwise, directly returns the resulting state object.

Arguments

Returns

invalidateOperationStateByOperationName

Type: Function

Cause the state of the given operation to be re-evaluated.

This will also re-evaluate the state of any operation that uses this operation.

Arguments

invalidateOperationStatesByStepType

Type: Function

Cause the state of any operation using the given step type to be re-evaluated.

This includes any operation using the step type indirectly through another operation.

Arguments