From 7f04a1b4a11f69fc03f1e65cf9f72a5437fb1ddc Mon Sep 17 00:00:00 2001 From: Victor Soares Date: Mon, 25 Mar 2024 20:05:27 -0300 Subject: [PATCH] modified: package-lock.json modified: package.json modified: src/annotations.js --- package-lock.json | 4 ++-- package.json | 2 +- src/annotations.js | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index f59e8d2..9823da1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@victorsoares96/epubjs", - "version": "0.3.96", + "version": "0.3.98", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@victorsoares96/epubjs", - "version": "0.3.96", + "version": "0.3.98", "license": "BSD-2-Clause", "dependencies": { "@types/localforage": "0.0.34", diff --git a/package.json b/package.json index 4d968e8..014f7f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@victorsoares96/epubjs", - "version": "0.3.97", + "version": "0.3.98", "description": "Parse and Render Epubs", "main": "lib/index.js", "module": "src/index.js", diff --git a/src/annotations.js b/src/annotations.js index 0e414fb..11c9bdb 100644 --- a/src/annotations.js +++ b/src/annotations.js @@ -47,6 +47,18 @@ class Annotations { this._annotations[hash] = annotation; + if (type === "highlight") { + this.highlights.push(annotation); + } + + if (type === "underline") { + this.underlines.push(annotation); + } + + if (type === "mark") { + this.marks.push(annotation); + } + if (sectionIndex in this._annotationsBySectionIndex) { this._annotationsBySectionIndex[sectionIndex].push(hash); } else { @@ -146,7 +158,9 @@ class Annotations { * iterate over annotations in the store */ each () { - return this._annotations.forEach.apply(this._annotations, arguments); + const annotations = [...this.highlights, ...this.underlines, ...this.marks]; + + return annotations; } /**