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

JSON

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

Using flags

JSON

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

HTML definition lists

JSON

{
  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

attributes

Type: 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

Type: String

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

contents

Type: 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

Type: 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

Type: Array<String>

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

ignoreContents

Type: 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

Type: 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

Type: String

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

localName

Type: 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

Type: 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

Type: 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.

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