mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-05 15:32:55 +02:00
modified: src/annotations.js
modified: src/managers/views/iframe.js modified: types/annotations.d.ts
This commit is contained in:
parent
9c2ac40ebe
commit
38d50b0860
3 changed files with 12 additions and 11 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;
|
||||
|
|
|
@ -627,11 +627,11 @@ class IframeView {
|
|||
|
||||
h.element.setAttribute("ref", className);
|
||||
h.element.addEventListener("click", emitter);
|
||||
h.element.addEventListener("touchstart", emitter);
|
||||
// h.element.addEventListener("touchstart", emitter);
|
||||
|
||||
if (cb) {
|
||||
h.element.addEventListener("click", cb);
|
||||
h.element.addEventListener("touchstart", cb);
|
||||
// h.element.addEventListener("touchstart", cb);
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
@ -659,16 +659,16 @@ class IframeView {
|
|||
|
||||
h.element.setAttribute("ref", className);
|
||||
h.element.addEventListener("click", emitter);
|
||||
h.element.addEventListener("touchstart", emitter);
|
||||
// h.element.addEventListener("touchstart", emitter);
|
||||
|
||||
if (cb) {
|
||||
h.element.addEventListener("click", cb);
|
||||
h.element.addEventListener("touchstart", cb);
|
||||
// h.element.addEventListener("touchstart", cb);
|
||||
}
|
||||
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;
|
||||
|
@ -711,11 +712,11 @@ class IframeView {
|
|||
|
||||
if (cb) {
|
||||
mark.addEventListener("click", cb);
|
||||
mark.addEventListener("touchstart", cb);
|
||||
// mark.addEventListener("touchstart", cb);
|
||||
}
|
||||
|
||||
mark.addEventListener("click", emitter);
|
||||
mark.addEventListener("touchstart", emitter);
|
||||
// mark.addEventListener("touchstart", emitter);
|
||||
|
||||
this.placeMark(mark, range);
|
||||
|
||||
|
|
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