futurepress / epub.js

Enhanced eBooks in the browser.
http://futurepress.org
Other
6.39k stars 1.09k forks source link

Render content without iframe #930

Open mdeprezzo opened 5 years ago

mdeprezzo commented 5 years ago

Hi all, i've a question. It's possible to render the content, without the iframe ?

Janglee123 commented 5 years ago

Use view: inline option. Maybe it works. look here

nikme commented 5 years ago

Use view: inline option. Maybe it works. look here

I'm getting error when using anything else than iframe this.View is not a constructor

unsyn commented 5 years ago

From what I can tell, view: 'iframe' gets a special treatment (in Rendition class). Everything else has to be passed in as the actual class instead of a string. So you may do an import InlineView from 'epubjs/lib/managers/views/inline' and then pass that class as the view option directly.

scott-engemann commented 5 years ago

@unsyn - Would it be possible to make and share a working example of this?

burtonator commented 4 years ago

Looks like InlineView is not available from the typescript bindings.

Losses commented 4 years ago

@burtonator It seems that most type definition and document are outdated, //@ts-ignore is the only solution to survive maybe.

hrkazemi commented 4 years ago

@burtonator create a file name epub-reader.d.ts:

declare module 'epubjs/lib/managers/views/inline' {
  export default class InlineView {}
}
hrkazemi commented 4 years ago

InlineView has error anyway (TypeError: view.offset is not a function).

import InlineView from 'epubjs/lib/managers/views/inline';

const opt = {
  ...
   view: InlineView,
}
nikme commented 4 years ago

InlineView has error anyway (TypeError: view.offset is not a function).

import InlineView from 'epubjs/lib/managers/views/inline';

const opt = {
  ...
   view: InlineView,
}

same as @Losses answer, its just avoiding Typescript. not really a solution.