mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-04 15:09:16 +02:00
move link replacement into Contents, make sure afterDisplayed is triggered
This commit is contained in:
parent
12b9803f54
commit
58893a88b4
7 changed files with 51 additions and 40 deletions
|
@ -2,7 +2,7 @@ import EventEmitter from "event-emitter";
|
|||
import {isNumber, prefixed} from "./utils/core";
|
||||
import EpubCFI from "./epubcfi";
|
||||
import Mapping from "./mapping";
|
||||
|
||||
import {replaceLinks} from "./utils/replacements";
|
||||
|
||||
class Contents {
|
||||
constructor(doc, content, cfiBase) {
|
||||
|
@ -396,8 +396,7 @@ class Contents {
|
|||
} else {
|
||||
position = range.getBoundingClientRect();
|
||||
}
|
||||
targetPos.left = position.left;
|
||||
targetPos.top = position.top;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,11 +408,14 @@ class Contents {
|
|||
|
||||
if(el) {
|
||||
position = el.getBoundingClientRect();
|
||||
targetPos.left = position.left;
|
||||
targetPos.top = position.top;
|
||||
}
|
||||
}
|
||||
|
||||
if (position) {
|
||||
targetPos.left = position.left;
|
||||
targetPos.top = position.top;
|
||||
}
|
||||
|
||||
return targetPos;
|
||||
}
|
||||
|
||||
|
@ -696,6 +698,14 @@ class Contents {
|
|||
return mapping.page(this, cfiBase, start, end);
|
||||
}
|
||||
|
||||
linksHandler(fn) {
|
||||
replaceLinks(this.content, fn);
|
||||
}
|
||||
|
||||
passEvents() {
|
||||
|
||||
}
|
||||
|
||||
destroy() {
|
||||
// Stop observing
|
||||
if(this.observer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue