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:
commit
d013ba70ec
3 changed files with 6 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
2
types/annotations.d.ts
vendored
2
types/annotations.d.ts
vendored
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue