kogmbh/WebODF — pull request #554 by adityab (2014-04-24 19:09:28+00:00)
Title: Fix paragraph merging issue and make OpRemoveText less magical

This patch:

1. Moves two methods `isOdfNode` and `isEmpty` from `OpRemoveText` to `OdfUtils`, along with the ODF Namespace map that they depend on. This makes the operation much smaller.
2. Changes the spec of `OpRemoveText` to take an optional `mergedParagraphStyleName` property, which is set as the style name for the final paragraph that results at the end of any merging. If the property is an string, the style attribute is removed from that paragraph for cleanliness.
3. Moves the logic that checks for emptiness of a paragraph (to decide the "winning" style) from `OpRemoveText` to `TextController`. This makes the operation shorter and less magical.
4. In `isEmpty(node)`, for the case when the supplied `node` is a text-node, checks whether it is a child of some ODF element. This fixes the case when foreign elements containing text (`editinfo`s) being present in a paragraph messed up the "winning" logic.

New tests are included.

Due to the explicit nature of style-setting, this patch paves the way for allowing OT logic to be written for `OpSetParagraphStyle`, which is a very important operation for a bunch of editing features: alignment, indentation, style selection, etc.