The ro.sync.ecss.extensions.api.UniqueAttributesRecognizer
interface can be implemented if you want to provide for your framework the following features:
- Automatic ID generation - You can automatically generate unique IDs for newly inserted elements. Implementations
are already available for the DITA and Docbook frameworks. The following methods can be
implemented to accomplish this: assignUniqueIDs(int startOffset, int
endOffset), isAutoIDGenerationActive()
- Avoiding copying unique attributes when "Split" is called inside an element - You
can split the current block element by pressing the "Enter" key and then choosing "Split".
This is a very useful way to create new paragraphs, for example. All attributes are by
default copied on the new element but if those attributes are IDs you sometimes want to
avoid creating validation errors in the editor. Implementing the following method, you can
decide whether an attribute should be copied or not during the split: boolean
copyAttributeOnSplit(String attrQName, AuthorElement element)
Tip:
The ro.sync.ecss.extensions.commons.id.DefaultUniqueAttributesRecognizer
class is an implementation of the interface which can be extended by your customization
to provide easy assignation of IDs in your framework. You can also check out the DITA
and Docbook implementations of
ro.sync.ecss.extensions.api.UniqueAttributesRecognizer to see how
they were implemented and connected to the extensions bundle.