-
Notifications
You must be signed in to change notification settings - Fork 43
CFI blacklist (element, class, id) #30
Description
Related issue: readium/readium-js-viewer#278
The CFI library currently doesn't expose an API to easily customize blacklists across the board (i.e. for all the features that rely on CFI interpretation/generation). There are functions / methods that take blacklist parameters, but this is not integrated consistently. For example (abbreviated code):
https://github.com/readium/readium-shared-js/blob/develop/js/views/cfi_navigation_logic.js#L544
this.getFirstVisibleElementCfi = function(topOffset) {
var foundElement = this.findFirstVisibleElement(topOffset);
...
var cfi = EPUBcfi.Generator.generateElementCFIComponent(foundElement.$element[0]);
...
return cfi + "@0:" + foundElement.percentY;
};
Note how EPUBcfi.Generator.generateElementCFIComponent() does not take into account default blacklists, let alone custom ones. Yet, the low-level API itself is capable of handling blacklists:
https://github.com/readium/readium-cfi-js/blob/develop/src/models/cfi_generator.js#L161
generateElementCFIComponent : function (startElement, classBlacklist, elementBlacklist, idBlacklist) {
...
},
We need a top-level registry of blacklisted elements, classes, ids. There should be a default set (annotation highlights, media overlays character-range highlights, mathjax, etc.), and this should be configurable when the Readium instance is created (allowing vendor customization, e.g. jQuery "highlight" plugin)