fontoxml-spell-checker

Spell Checker

This add-on provides spell checking for documents in Fonto Editor. By default, the add-on connects to a Fonto Spell Checker backend hosted by Fonto.

Configuration

By default, the Fonto Spell Checker add-on uses the values of the standard xml:lang attribute to determine which language to spell check against, and configures US English as fallback language. The default configuration can be modified using the spell-checker-configuration configuration value.

To allow users to toggle the spell checker on and off (it is off by default), add a toolbar button for the toggle-spell-checker operation.

Backend

It is highly recommended to self host the Fonto Spell Checker backend, since (parts of) documents will otherwise be sent over the public internet. To do so, set the usePublicSpellChecker property of the SpellCheckerConfiguration to false, and use Fonto Development Tools to obtain the Fonto Spell Checker backend. All network requests to a self-hosted Fonto Spell Checker backend will be sent through the /proxy/spell-checker/ endpoint.

Getting started

Prerequisites

  • A working instance of Fonto Editor, with the Fonto Spell Checker add-on integrated.

  • A development license for Fonto Editor.

  • Fonto Development Tools.

  • Docker, installed and running.

Step 1

Add the usePublicSpellChecker property to the Fonto Spell Checker checker add-on configuration in the config/configuration.js file of your Fonto Editor instance, and set it to false.

configurationManager.set('spell-checker-configuration', {
	language: 'en-US',
	usePublicSpellChecker: false
});

Step 2

Add proxy configuration in the config.json or config.js file of your Fonto Editor instance.

{
	"scope": {
		// Omitted for clarity
	},
	"proxy": {
		"spell-checker": "http://localhost:6050/"
	}
}

Step 3

Run the following command in an empty directory. Match the version parameter with the version of your Fonto Editor instance, e.g. 7.8.0.

fdt spell-checker init --version <version>

Step 4

Run the following command from the root of your Fonto Editor instance.

fdt editor run

Also, run the following command from the folder in which you initialized the Fonto Spell Checker (backend).

fdt spell-checker run

You are done!

You should now have a running instance of both Fonto Editor and the Fonto Spell Checker backend. Visit the editor at http://localhost:8080 to verify whether the spell checker is working as expected.

Configuration

Host configuration options

The Fonto Spell Checker backend provides several generic host configuration options. These options can be configured using any of the supported configuration providers. Information about configuration conventions might prove useful. When running the Fonto Review backend using Fonto Development Tools, configuring the options as environment variables in an .env file is supported.

Command line parameters

The Fonto Spell Checker backend provides a --as-windows-service command line parameter to run the backend as Windows Service. This parameter is only available for self-contained builds on Windows.

Logging

Logging options can be provided using any of the supported configuration providers. Please refer to the logging configuration page for available options. In addition, the Fonto Spell Checker backend supports an optional NLog configuration file. Information about how to configure NLog can be found in its official documentation.

Deployment

Docker

A Docker image of the Fonto Spell Checker backend for use on production environments can be built using Fonto Development Tools.

For usage examples and available options, run:

fdt spell-checker build --help

Information about running Docker images is available in the Docker documentation. Additionally, the ASP.NET Core documentation regarding hosting Docker containers might come in useful.

Self-contained

Self-contained builds of the Fonto Spell Checker backend can be downloaded using Fonto Development Tools.

For usage examples and available options, run:

fdt spell-checker download-self-contained --help

The hosting and deployment section of the ASP.NET Core documentation is a helpful resource for information about hosting self-contained builds.

Monitoring

The Fonto Spell Checker backend provides a health endpoint which can be utilized to check the health of the service. Located at /api/health, it returns information about the current product and its version.

Example response:

/api/health (200 OK)

{
	"application": {
		"company": "Fonto",
		"product": "Spell Checker",
		"version": "7.8.0"
	}
}

This endpoint is used to define a Docker HEALTHCHECK instruction when running the Fonto Spell Checker backend in a Docker container.

When modifying the port the Fonto Spell Checker backend is running on within a (production) container, make sure to redefine the HEALTHCHECK instruction to match the modified port.


APIs in fontoxml-spell-checker

Was this page helpful?