FxOperation

Type: React component

How to get FxOperation?

JavaScript

import FxOperation from 'fontoxml-fx/src/FxOperation.jsx'

A children as a function component that can be used to get the operationState of the given operationName and/or execute it without using a specific FX component.

if you can use a React hook because you're writing a functional component, prefer useOperation over this component. Note: this component simply uses useOperation internally and renders its children as a function that receives the results from useOperation as an argument.

This component has been optimized for performance. This component and its API will probably remain intact for more (major) versions than the operationsManager. This component is more flexible, but also more verbose than using an FX component: FX components all use this component internally to couple operation state to a specific UI element like a Button.

So: Prefer using a specific FX component if one suffices. (Send us a signal if you're missing one.) Prefer using this component instead of using the operationsManager directly. And prefer using the useOperation hook directly if possible, otherwise use this component.

Props

  1. children

    (Required)

    Type: Function

    Returns an object with the following properties, all related to the given operationName:

    • executeOperation: when called, executes the operation with the given operationName and

    operationData.

    • operation: the operation (config) as it is defined in operations.json

    • operationState: the current operationState (an object with active/enabled booleans)

    Returns

  2. focusEditorWhenDone

    (Optional)

    Type: Boolean

    Whether or not the editor (content view) should be focused after the operation with the given operationName is executed (using executeOperation as given to the children function of this component). This will not apply for other executions of the operation, outside of this component. Defaults to false.

    Default value

  3. operationName

    (Required)

    The operation name.

  4. operationData

    (Optional)

    The operation data to evaluate the operation with.

    Default value