1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

Hash of annotations is created with CfiRange and type, so two different annotations at the same range can coexist. (Example Highlight + Mark = Noted Highlight)

This commit is contained in:
Eugen 2019-02-19 11:31:16 +01:00
parent 3e47dbbef1
commit 2cb5513fc6

View file

@ -32,7 +32,7 @@ class Annotations {
* @returns {Annotation} annotation
*/
add (type, cfiRange, data, cb, className, styles) {
let hash = encodeURI(cfiRange);
let hash = encodeURI(cfiRange + type);
let cfi = new EpubCFI(cfiRange);
let sectionIndex = cfi.spinePos;
let annotation = new Annotation({
@ -70,7 +70,7 @@ class Annotations {
* @param {string} type Type of annotation to add: "highlight", "underline", "mark"
*/
remove (cfiRange, type) {
let hash = encodeURI(cfiRange);
let hash = encodeURI(cfiRange + type);
if (hash in this._annotations) {
let annotation = this._annotations[hash];