DOMImporter
Class defined in model/DOMImporter.js#25

A generic base implementation for XML/HTML importers.

new DOMImporter()
Constructor defined in model/DOMImporter.js#27
this.convertContainer(elements, containerId)
Method defined in model/DOMImporter.js#148

Converts and shows all children of a given element.

Parameters

elements | DOMElement[] | All elements that should be converted into the container.
containerId | String | The id of the target container node.

Returns

Object | the preliminary container node

this.convertElement(el)
Method defined in model/DOMImporter.js#198

Converts a single HTML element and creates a node in the current document.

Parameters

el | DOMElement | the HTML element

Returns

object | the created node as JSON

this.annotatedText(el, path, options)
Method defined in model/DOMImporter.js#321

Convert annotated text. You should call this method only for elements containing rich-text.

Parameters

el | DOMElement |
path | String[] | The target property where the extracted text (plus annotations) should be stored.
options | Object |
options.preserveWhitespace | Boolean | when true will preserve whitespace. Default: false.

Returns

String | The converted text as plain-text

this.plainText(el)
Method defined in model/DOMImporter.js#356

Converts the given element as plain-text.

Parameters

el | DOMElement |

Returns

String | The plain text

this.customText()
Method defined in model/DOMImporter.js#375

Tells the converter to insert a virutal custom text.

This is useful when during conversion a generated label needs to be inserted instead of real text.

Parameters

| String |

this.nextId(a)
Method defined in model/DOMImporter.js#391

Generates an id. The generated id is unique with respect to all ids generated so far.

Parameters

a | String | prefix

Returns

String | the generated id

this._wrapInlineElementsIntoBlockElement(childIterator)
Method defined in model/DOMImporter.js#549

Wraps the remaining (inline) elements of a node iterator into a default block node.

Parameters

childIterator | DOMImporter.ChildIterator |

Returns

model/DocumentNode |

this._createDefaultBlockElement(el)
Method defined in model/DOMImporter.js#578

Converts an element into a default block level node.

Parameters

el | DOMElement |

Returns

model/DocumentNode |

this._trimTextContent($el)
Method defined in model/DOMImporter.js#626

Removes any leading and trailing whitespaces from the content within the given element. Attention: this is not yet implemented fully. Atm, trimming is only done on the first and last text node (if they exist).

Parameters

$el | jQuery |

Returns

util/jQuery | an element with trimmed text