All Projects → ridi → react-viewer

ridi / react-viewer

Licence: MIT license
Online EPUB/Comics viewer

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-viewer

Lector
Qt based ebook reader
Stars: ✭ 1,218 (+2242.31%)
Mutual labels:  ebook, comics, epub, reader
eBookReaderNX
A Nintendo Switch eBook Reader
Stars: ✭ 15 (-71.15%)
Mutual labels:  ebook, epub, reader
bookery
Manage all your ebooks and send them to your reader
Stars: ✭ 35 (-32.69%)
Mutual labels:  ebook, epub, reader
BookReader
📕 "任阅" 网络小说阅读器,3D翻页效果、txt/pdf/epub书籍阅读、Wifi传书~
Stars: ✭ 6,113 (+11655.77%)
Mutual labels:  ebook, epub, reader
kthoom
Comic Book Reader in the Browser
Stars: ✭ 97 (+86.54%)
Mutual labels:  ebook, comics, epub
Koodo Reader
A modern ebook manager and reader with sync and backup capacities for Windows, macOS, Linux and Web
Stars: ✭ 2,938 (+5550%)
Mutual labels:  ebook, epub, reader
Koreader
An ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats, running on Cervantes, Kindle, Kobo, PocketBook and Android devices
Stars: ✭ 9,467 (+18105.77%)
Mutual labels:  ebook, epub, reader
Work crawler
Download comics novels 小说漫画下载工具 小説漫画のダウンローダ 小說漫畫下載:腾讯漫画 大角虫漫画 有妖气 知音漫客 咪咕 SF漫画 哦漫画 看漫画 漫画柜 汗汗酷漫 動漫伊甸園 快看漫画 微博动漫 733动漫网 大古漫画网 漫画DB 無限動漫 動漫狂 卡推漫画 动漫之家 动漫屋 古风漫画网 36漫画网 亲亲漫画网 乙女漫画 comico webtoons 咚漫 ニコニコ静画 ComicWalker ヤングエースUP モアイ pixivコミック サイコミ;アルファポリス カクヨム ハーメルン 小説家になろう 起点中文网 八一中文网 顶点小说 落霞小说网 努努书坊 笔趣阁→epub.
Stars: ✭ 1,224 (+2253.85%)
Mutual labels:  ebook, comics, epub
Ichaival
Android client for the LANraragi manga/doujinshi web manager.
Stars: ✭ 89 (+71.15%)
Mutual labels:  comics, reader
Webpages To Ebook
Create an EPUB from a list of URLs. Standing on the shoulders of Wget, Readability and Pandoc.
Stars: ✭ 155 (+198.08%)
Mutual labels:  ebook, epub
Blitz
An eBook Framework (CSS + template)
Stars: ✭ 179 (+244.23%)
Mutual labels:  ebook, epub
Novel Grabber
Novel-Grabber can download novels from pretty much any webnovel and lightnovel site.
Stars: ✭ 125 (+140.38%)
Mutual labels:  ebook, epub
The Economist Ebooks
经济学人(含音频)、纽约客、自然、新科学人、卫报、科学美国人、连线、大西洋月刊、新闻周刊、国家地理等英语杂志免费下载、订阅(kindle推送),支持epub、mobi、pdf格式, 每周更新. The Economist 、The New Yorker 、Nature、The Atlantic 、New Scientist、The Guardian、Scientific American、Wired、Newsweek magazines, free download and subscription for kindle, mobi、epub、pdf format.
Stars: ✭ 3,471 (+6575%)
Mutual labels:  ebook, epub
Asciidoctor Epub3
📘 Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3 & KF8/MOBI
Stars: ✭ 166 (+219.23%)
Mutual labels:  ebook, epub
Worm Scraper
Scrapes the web serial Worm and its sequel Ward into an eBook format
Stars: ✭ 118 (+126.92%)
Mutual labels:  ebook, epub
Kepubify
Fast, standalone EPUB to KEPUB converter CLI app / library (and a few other utilities).
Stars: ✭ 225 (+332.69%)
Mutual labels:  ebook, epub
Laravel Book
Up to date Epub, Mobi and PDF versions from the official Laravel Docs
Stars: ✭ 221 (+325%)
Mutual labels:  ebook, epub
Kobo Book Downloader
A tool to download your purchased Kobo books and remove the DRM from them.
Stars: ✭ 117 (+125%)
Mutual labels:  ebook, epub
Pandoc Book Template
A simple Pandoc template to build documents and ebooks.
Stars: ✭ 214 (+311.54%)
Mutual labels:  ebook, epub
Open Publisher
Using Jekyll to create outputs that can be used as Pandoc inputs. In short - input markdown, output mobi, epub, pdf, and print-ready pdf. With a focus on fiction.
Stars: ✭ 242 (+365.38%)
Mutual labels:  ebook, epub

@ridi/react-viewer

Build Status npm version

Demo

https://ridi.github.io/react-viewer/demo/

Installation

npm install @ridi/react-viewer

How to Use

Initialize

Add @ridi/react-viewer reducer into your reducers.

import { reducers as reader } from '@ridi/react-viewer';
import { combineReducers } from 'redux';

const appReducer = combineReducers({
    ...
    reader,
    ...
});

Connect Connector with redux store.

import { createStore } from 'redux';
import { Connector } from '@ridi/react-viewer';

const store = createStore( ... );
Connector.connect(store);

Quick start

Service must be loaded for initializing Reader's lifecycle.

And put Reader component into your component.

import React from 'react';
import Reader, { Service } from '@ridi/react-viewer';

Service.loadAll();
export default ViewerPage extends React.Component {
    render() {
        return <Reader />;
    }
};

Service

  • loadAll
    • params:
      • restoreState(Object): state object for restoring redux store
      • config(Object)
        • beforeContentCalculated: Check out Hooks section for more details

<Reader> Component

Reader component provides all functionality of viewer and renders viewer body.

Here are Reader's properties:

  • footer(node): markup for the footer area
  • contentFooter(node): markup for the content footer area
  • selectable(boolean): set reader to be selectable
  • annotationable(boolean): set reader to be annotationable
  • annotations(array): annotation list is composed of items that has distinct id property.

Events

Below events can be used with EventBus

import { EventBus, Events, TouchEvent } from '@ridi/react-viewer';

EventBus.on(Events.TOUCH, (event) => {
  const { clientX, clientY, annotation } = event.detail;
  if (event.type === TouchEvent.TouchAnnotation) {
    console.log(annotation);
  } else {
    console.log(clientX, clientY);
  }
});

EventBus.emit(Events.SET_CONTENTS_BY_URI, { ... });
  • Events.SET_CONTENTS_BY_URI (emmitable): Check out Render Contents section for more details
    • params:
      • data(Object)
        • contentFormat(ContentFormat)
        • bindingType(BindingType)
        • uris(Array): Array of uri to fetch content
  • Events.SET_CONTENTS_BY_VALUE (emmitable): Check out Render Contents section for more details
    • params:
      • data(Object)
        • contentFormat(ContentFormat)
        • bindingType(BindingType)
        • contents(Array): Array of HTML document(contentFormat === ContentFormat.HTML) or base64 encoded image source(contentFormat === ContentFormat.IMAGE)
  • Events.SCROLL(listenable): Screen is scrolled
    • params:
      • event(ScrollEvent)
  • Events.TOUCH(listenable): Screen is touched (or annotation is touched)
    • params:
      • event(TouchEvent)
        • type(TouchEvent): TouchEvent.Touch or TouchEvent.AnnotationTouch
        • detail
          • screenX
          • screenY
          • clientX
          • clientY
          • pageX
          • pageY
          • type: original event type
          • target: original event target
          • annotation: annotation info
  • Events.CHANGE_SELECTION(listenable): Current selection is changed
    • params:
      • event(Object)
        • selection: selection info
        • selectionMode(SelectionMode)
  • Events.MOUNTED(listenable): <Reader> has been mounted
  • Events.UNMOUNTED(listenable): <Reader> has been unmounted

Hooks

You would use hooks when you want to intercept some point of reader's lifecycle. Hook implementations can return value in any forms compatible with RxJS's ObservableInput.

  • beforeContentCalculated: executed just right before per content calculation is completed

    • params:
      • contentIndex(number): index number of current calculating content
      • readerJsHelper(ReaderJsHelper): ReaderJsHelper instance mounted on this current calculating content
  • afterContentCalculated: executed just right after per content calculation is completed

    • params:
      • calculations(Array): current status of calculations

Render Contents

Events.SET_CONTENTS_BY_URI or Events.SET_CONTENTS_BY_VALUE

Whole contents with metadata must set in a time. Emit Events.SET_CONTENTS_BY_(URI/VALUE) event with URIs of contents or contents loaded already.

import {
  ContentFormat,
  BindingType,
  EventBus,
  Events,
} from '@ridi/react-viewer';

EventBus.emit(Events.SET_CONTENTS_BY_URI, {
  contentFormat: ContentFormat.HTML,
  bindingType: BindingType.LEFT,
  uris: [
    './uri1.json',
    './uri2.json',
    ...,
  ],
});

EventBus.emit(Events.SET_CONTENTS_BY_VALUE, {
  contentFormat: ContentFormat.HTML,
  bindingType: BindingType.LEFT,
  contents: [
    '<p>...</p>',
    '<p>...</p>',
    ...,
  ],
});
  • contentFormat: content format (HTML: 0, IMAGE: 1)
  • bindingType: binding type (LEFT: 0, RIGHT: 1)

How to Run Demo

$ npm install
$ npm run install:demo
$ npm run watch

Browse http://localhost:8000.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].