1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Merge pull request #4 from victorsoares96/feat/custom-classname-to-mark

 feat: custom classname to mark
This commit is contained in:
João Victor Moreira Soares 2024-03-23 09:52:47 -03:00 committed by GitHub
commit d013ba70ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

View file

@ -254,7 +254,7 @@ class Annotation {
} else if (type === "underline") {
result = view.underline(cfiRange, data, cb, className, styles);
} else if (type === "mark") {
result = view.mark(cfiRange, data, cb);
result = view.mark(cfiRange, data, cb, className, styles);
}
this.mark = result;
@ -298,4 +298,4 @@ class Annotation {
EventEmitter(Annotation.prototype);
export default Annotations
export default Annotations;

View file

@ -668,7 +668,7 @@ class IframeView {
return h;
}
mark(cfiRange, data={}, cb) {
mark(cfiRange, data={}, cb, className = "epubjs-mk", styles = {}) {
if (!this.contents) {
return;
}
@ -698,7 +698,8 @@ class IframeView {
}
let mark = this.document.createElement("a");
mark.setAttribute("ref", "epubjs-mk");
mark.setAttribute("ref", className);
mark.style = styles;
mark.style.position = "absolute";
mark.dataset["epubcfi"] = cfiRange;

View file

@ -12,7 +12,7 @@ export default class Annotations {
underline(cfiRange: string, data?: object, cb?: Function, className?: string, styles?: object): void;
mark(cfiRange: string, data?: object, cb?: Function): void;
mark(cfiRange: string, data?: object, cb?: Function, className?: string, styles?: object): void;
each(): Array<Annotation>