TransformerConfiguration

Type: Object

A TransformerConfiguration object described a translation between a DOM node and a node in the pivot model used for pasting content across schemas.

Examples

Match any inline as a strong, and any strong as an inline

{ qualifiedName: 'strong', type: 'inline' }

Using flags

{ qualifiedName: 'i', type: 'inline', 'flags': ['italic'] }

HTML definition lists

{
  qualifiedName: 'DL',
  type: 'group',
  contents: [
    { qualifiedName: 'DD', type: 'frame', contents: [{ qualifiedName: null, type: 'block' }] },
    { qualifiedName: 'DT', type: 'frame', contents: [{ qualifiedName: null, type: 'block' }] }
  ]
}

By default, a text transformer is registered under the key text.

Properties

Name Type Description
attributes Object<String | String>

The attributes which need to be specified on elements this transformer handles. The key is the qualified name of the attribute.

[cellQualifiedName] String

The qualified name of the cells, required when isTable is true

contents Array<TransformerConfiguration | String>

An array of configured transformers (or keys of configurations) which are only valid to be used directly inside the outer transformer.

[figureQualifiedName] String

Some tables require a wrapping element around the element that is actually configured to represent the table in Fonto ({@see configureAsTableElements}). If isTable is true and this is specified, the element specified will be automatically created around the table when one is pasted.

flags Array<String>

An array of strings further describing a pivot node outputted and accepted by the transformer.

[ignoreContents] Boolean

Decides if the pivot node or the DOM should be traversed further. This can be used for FONT or META elements present in HTML DOMs, which are never interesting.

[isTable] Boolean

Signals the structure should be transformed as a table. The kind of table is decided by the name and attributes of the table.

[key] String

A string identifying a transformer. The key is used to refer to the transformer in a contents array.

[localName] String

The local name of the element in the DOM. If the localName and the qualifiedname are both omitted, there will be no counterpart of a pivot node in the resulting DOM.

[namespaceUri] String

The namespace uri of the element in the dom. Though this can be set manually, it is possible to set the qualifiedName property and rely on the automatic fall back to the namespaceManager.

[qualifiedName] String

The name of the element in the DOM. If the qualifiedname and the localname are both omitted, there will be no counterpart of a pivot node in the resulting DOM. This is used to set the localName and namespaceUri using the NamespaceManager.

[type] PIVOT_NODE_TYPES

The type of the pivot node to output in the pivot tree. If ommited, there will be no pivot node in the resulting DOM.

Was this page helpful?