Operations

Both the sidebar details and context menu can have operations to solve or improve the content based on an annotation. The add-on provides some convenient operations to perform common mutations on the content. These operations only need an annotation id and some input like text or element information.

Alternatively you can create your own operation and use one of the helper operations which provide some information based on the annotation id and supplies your operation steps with the annotation's range.

For example you can use all Fonto Editor built-in operations which support the overrideRange argument. See operations documentation for a list of all built-in operations of which some support the overrideRange argument.

Custom operations example (operations.json)

JSON

{
	"my-operation-with-sub-operation": {
		"label": "My operation with sub operation",
		"description": "An example custom operation for Fonto Content Quality which does a mutation using a sub operation"
		"steps": [
			{
				"type": "operation/content-quality-execute-operation",
				"data": {
					"operationName": "wrap-selection-in-structure"
				}
			}
		]
	},

	"my-operation-with-custom-mutation": {
		"label": "My operation with custom mutation",
		"description": "An example custom operation for Fonto Content Quality which does a mutation using a custom mutation"
		"steps": [
			{
				"type": "operation/content-quality-get-context-node-id-and-range"
			},
			{
				"type": "custom-mutation/myCustomMutation"
			}
		]
	}
}