Git Product home page Git Product logo

r2-navigator-web's Introduction

r2-navigator-web Build Status

A web-based Readium Navigator implementation, written in TypeScript.

Usage

(WIP, placeholder)

import ReadiumNavigator from '@readium/navigator-web';

Development

Requirements

  • Node.js 10+
  • npm / yarn

Getting started

  1. Clone this repository
  2. Run npm install
  3. Use commands such as:
    • npm run build Build project.
    • npm run test Run the test suite.

r2-navigator-web's People

Contributors

denglili avatar denglili-ep avatar gebrial avatar jccr avatar nikitaevidentpoint avatar roberthodan avatar xueyaoj avatar yaoyao0821 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r2-navigator-web's Issues

Handle hyperlink navigation

Currently, click a element directly, will not "notify" the r2-navigator-web, the iframe will go to the link directly, and cause problems.

It looks like there is no implementation about this part.

How can I get updated cfi when scrolling

I'm testing the navigator-web, here is what I got so far.

I managed to render my Epub at spine of index 4, however I set the view as vertical and ScrollMode to be SpineItem. Here is the code

import * as ReadiumNavigator from '@readium/navigator-web'
let { ReadingSystem, Publication } = ReadiumNavigator
let baseUrl = "/path/to/json"
let hostContainer: HTMLElement = document.querySelector("#container");
(async function () {
    let pub = await Publication.fromURL(baseUrl)
    let readingSystem = new ReadingSystem()
    readingSystem.initRenderer(hostContainer);
    let rendition = readingSystem.openRendition(pub)
    rendition.setViewAsVertical(true)
    rendition.viewport.setViewportSize(600, 800);
    rendition.setPageLayout({
        spreadMode: ReadiumNavigator.SpreadMode.FitViewportSingleSpread,
    })
    await rendition.render()
    rendition.viewport.setScrollMode(ReadiumNavigator.ScrollMode.SpineItem)
    rendition.viewport.addLocationChangedListener(()=>{
        console.log('updated')
    })
    await rendition.viewport.renderAtSpineItem(4)
}());

I tried to use the viewport.addLocationChangedListener, but it doesn't work.

So How can I get latest reading CFI like r2-navigator-jsdid(setReadingLocationSaver, getCurrentReadingLocation).

And of course, do I use the right api to render?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.