epub.js icon indicating copy to clipboard operation
epub.js copied to clipboard

Render content without iframe

Open mdeprezzo opened this issue 7 years ago • 9 comments

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

mdeprezzo avatar Mar 21 '19 08:03 mdeprezzo

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

Janglee123 avatar Jun 06 '19 09:06 Janglee123

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

nikme avatar Aug 12 '19 19:08 nikme

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.

unsyn avatar Sep 01 '19 23:09 unsyn

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

scott-engemann avatar Sep 04 '19 15:09 scott-engemann

Looks like InlineView is not available from the typescript bindings.

InputNeuron avatar Feb 29 '20 01:02 InputNeuron

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

Losses avatar Jun 16 '20 04:06 Losses

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

declare module 'epubjs/lib/managers/views/inline' {
  export default class InlineView {}
}

hrkazemi avatar Jun 30 '20 09:06 hrkazemi

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

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

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

hrkazemi avatar Jun 30 '20 09:06 hrkazemi

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.

nikme avatar Jun 30 '20 10:06 nikme