From a8736b0edb99ad433c8a7795ea1f31a8751c2f41 Mon Sep 17 00:00:00 2001 From: pacien Date: Mon, 31 Oct 2022 00:20:38 +0100 Subject: viewer/epub: add EPUB item handler This adds a paginated ePub viewer using epub.js. --- viewer/src/assets/scss/theme.scss | 2 + viewer/src/locales/en.yml | 3 + viewer/src/views/GalleryNavigation.vue | 2 + .../views/item_handlers/async/AsyncEpubViewer.vue | 149 +++++++++++++++++++++ viewer/src/views/item_handlers/async/index.ts | 23 ++++ 5 files changed, 179 insertions(+) create mode 100644 viewer/src/views/item_handlers/async/AsyncEpubViewer.vue create mode 100644 viewer/src/views/item_handlers/async/index.ts diff --git a/viewer/src/assets/scss/theme.scss b/viewer/src/assets/scss/theme.scss index 63febbf..fe70f17 100644 --- a/viewer/src/assets/scss/theme.scss +++ b/viewer/src/assets/scss/theme.scss @@ -41,6 +41,8 @@ $dropdown-item-color: $palette-600; $dropdown-item-hover-color: $palette-500; $panel-top-bgcolor: $palette-800; $panel-top-txtcolor: $primary; +$panel-bottom-bgcolor: $palette-800; +$panel-bottom-txtcolor: $primary; $panel-left-bgcolor: $palette-800; $panel-left-txtcolor: $primary; $command-buttons-bgcolor: $palette-700; diff --git a/viewer/src/locales/en.yml b/viewer/src/locales/en.yml index 86ecd49..280f18b 100644 --- a/viewer/src/locales/en.yml +++ b/viewer/src/locales/en.yml @@ -15,6 +15,9 @@ directory: no-results: Empty directory download: download-file-fmt: Download {0} +epubViewer: + previousSection: Previous section + nextSection: Next section gallery: resource-loading-error: Error loading resource unknown-resource: Resource not found diff --git a/viewer/src/views/GalleryNavigation.vue b/viewer/src/views/GalleryNavigation.vue index 0869aaf..b342c52 100644 --- a/viewer/src/views/GalleryNavigation.vue +++ b/viewer/src/views/GalleryNavigation.vue @@ -44,6 +44,7 @@ import { computedEager } from '@vueuse/shared'; import { computed, watchEffect } from 'vue'; import { useI18n } from 'vue-i18n'; import GallerySearch from './GallerySearch.vue'; +import { EpubViewer } from './item_handlers/async'; import AudioViewer from './item_handlers/AudioViewer.vue'; import DirectoryViewer from './item_handlers/DirectoryViewer.vue'; import DownloadViewer from './item_handlers/DownloadViewer.vue'; @@ -67,6 +68,7 @@ const COMPONENT_BY_TYPE: Record = { plaintext: PlainTextViewer, markdown: MarkdownViewer, pdf: PdfViewer, + epub: EpubViewer, video: VideoViewer, audio: AudioViewer, other: DownloadViewer, diff --git a/viewer/src/views/item_handlers/async/AsyncEpubViewer.vue b/viewer/src/views/item_handlers/async/AsyncEpubViewer.vue new file mode 100644 index 0000000..712a844 --- /dev/null +++ b/viewer/src/views/item_handlers/async/AsyncEpubViewer.vue @@ -0,0 +1,149 @@ + + + + + + + diff --git a/viewer/src/views/item_handlers/async/index.ts b/viewer/src/views/item_handlers/async/index.ts new file mode 100644 index 0000000..d4ca996 --- /dev/null +++ b/viewer/src/views/item_handlers/async/index.ts @@ -0,0 +1,23 @@ +/* ldgallery - A static generator which turns a collection of tagged +-- pictures into a searchable web gallery. +-- +-- Copyright (C) 2022 Pacien TRAN-GIRARD +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +*/ + +import { defineAsyncComponent } from 'vue'; + +export const EpubViewer = defineAsyncComponent(() => + import(/* webpackChunkName: "epub-viewer" */ './AsyncEpubViewer.vue')); -- cgit v1.2.3