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:
parent
3e47dbbef1
commit
2cb5513fc6
1 changed files with 2 additions and 2 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue