mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-02 14:49:16 +02:00
Merge 6498afae90
into f09089cf77
This commit is contained in:
commit
32cd5eb568
2 changed files with 13 additions and 6 deletions
|
@ -77,9 +77,7 @@ class Views {
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(view) {
|
destroy(view) {
|
||||||
if(view.displayed){
|
|
||||||
view.destroy();
|
view.destroy();
|
||||||
}
|
|
||||||
|
|
||||||
if(this.container){
|
if(this.container){
|
||||||
this.container.removeChild(view.element);
|
this.container.removeChild(view.element);
|
||||||
|
|
|
@ -6,7 +6,12 @@ import { EVENTS } from "../../utils/constants";
|
||||||
import { Pane, Highlight, Underline } from "marks-pane";
|
import { Pane, Highlight, Underline } from "marks-pane";
|
||||||
|
|
||||||
class IframeView {
|
class IframeView {
|
||||||
|
static ViewMap = new Map();
|
||||||
constructor(section, options) {
|
constructor(section, options) {
|
||||||
|
const oldView = IframeView.ViewMap.get(section.href);
|
||||||
|
if (oldView) oldView.destroy();
|
||||||
|
IframeView.ViewMap.set(section.href, this);
|
||||||
|
|
||||||
this.settings = extend({
|
this.settings = extend({
|
||||||
ignoreClass : "",
|
ignoreClass : "",
|
||||||
axis: undefined, //options.layout && options.layout.props.flow === "scrolled" ? "vertical" : "horizontal",
|
axis: undefined, //options.layout && options.layout.props.flow === "scrolled" ? "vertical" : "horizontal",
|
||||||
|
@ -48,6 +53,7 @@ class IframeView {
|
||||||
this.highlights = {};
|
this.highlights = {};
|
||||||
this.underlines = {};
|
this.underlines = {};
|
||||||
this.marks = {};
|
this.marks = {};
|
||||||
|
this.loading = undefined;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +164,6 @@ class IframeView {
|
||||||
return this.load(contents);
|
return this.load(contents);
|
||||||
}.bind(this))
|
}.bind(this))
|
||||||
.then(function(){
|
.then(function(){
|
||||||
|
|
||||||
// find and report the writingMode axis
|
// find and report the writingMode axis
|
||||||
let writingMode = this.contents.writingMode();
|
let writingMode = this.contents.writingMode();
|
||||||
|
|
||||||
|
@ -382,7 +387,8 @@ class IframeView {
|
||||||
|
|
||||||
|
|
||||||
load(contents) {
|
load(contents) {
|
||||||
var loading = new defer();
|
this.loading && this.loading.reject('cancel');
|
||||||
|
var loading = this.loading = new defer();
|
||||||
var loaded = loading.promise;
|
var loaded = loading.promise;
|
||||||
|
|
||||||
if(!this.iframe) {
|
if(!this.iframe) {
|
||||||
|
@ -841,6 +847,9 @@ class IframeView {
|
||||||
this._height = null;
|
this._height = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loading && this.loading.reject('cancel');
|
||||||
|
|
||||||
|
|
||||||
// this.element.style.height = "0px";
|
// this.element.style.height = "0px";
|
||||||
// this.element.style.width = "0px";
|
// this.element.style.width = "0px";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue