mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
[GeckoView] Reduce the size of the *built* viewer
Given that the GV-viewer isn't using most of the UI-related components of the default-viewer, we can avoid including them in the *built* viewer to save space.[1] The least "invasive" way of implementing this, at least that I could come up with, is to leverage import maps with suitable stubs for the GV-viewer. The one slightly annoying thing is that we now have larger import maps across multiple html-files, and you'll need to remember to update all of them when making future changes. --- [1] With this patch, the built `viewer.js` size is 391 kB and `viewer-geckoview.js` is 285 kB.
This commit is contained in:
parent
05d821e680
commit
a98e80c4ff
10 changed files with 150 additions and 34 deletions
32
web/app.js
32
web/app.js
|
@ -18,6 +18,7 @@ import {
|
|||
apiPageLayoutToViewerModes,
|
||||
apiPageModeToSidebarView,
|
||||
AutoPrintRegExp,
|
||||
CursorTool,
|
||||
DEFAULT_SCALE_VALUE,
|
||||
getActiveOrFocusedElement,
|
||||
isValidRotation,
|
||||
|
@ -54,27 +55,27 @@ import {
|
|||
} from "pdfjs-lib";
|
||||
import { AppOptions, OptionKind } from "./app_options.js";
|
||||
import { AutomationEventBus, EventBus } from "./event_utils.js";
|
||||
import { CursorTool, PDFCursorTools } from "./pdf_cursor_tools.js";
|
||||
import { LinkTarget, PDFLinkService } from "./pdf_link_service.js";
|
||||
import { AnnotationEditorParams } from "./annotation_editor_params.js";
|
||||
import { AnnotationEditorParams } from "web-annotation_editor_params";
|
||||
import { OverlayManager } from "./overlay_manager.js";
|
||||
import { PasswordPrompt } from "./password_prompt.js";
|
||||
import { PDFAttachmentViewer } from "./pdf_attachment_viewer.js";
|
||||
import { PDFDocumentProperties } from "./pdf_document_properties.js";
|
||||
import { PDFFindBar } from "./pdf_find_bar.js";
|
||||
import { PDFAttachmentViewer } from "web-pdf_attachment_viewer";
|
||||
import { PDFCursorTools } from "web-pdf_cursor_tools";
|
||||
import { PDFDocumentProperties } from "web-pdf_document_properties";
|
||||
import { PDFFindBar } from "web-pdf_find_bar";
|
||||
import { PDFFindController } from "./pdf_find_controller.js";
|
||||
import { PDFHistory } from "./pdf_history.js";
|
||||
import { PDFLayerViewer } from "./pdf_layer_viewer.js";
|
||||
import { PDFOutlineViewer } from "./pdf_outline_viewer.js";
|
||||
import { PDFPresentationMode } from "./pdf_presentation_mode.js";
|
||||
import { PDFLayerViewer } from "web-pdf_layer_viewer";
|
||||
import { PDFOutlineViewer } from "web-pdf_outline_viewer";
|
||||
import { PDFPresentationMode } from "web-pdf_presentation_mode";
|
||||
import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
|
||||
import { PDFScriptingManager } from "./pdf_scripting_manager.js";
|
||||
import { PDFSidebar } from "./pdf_sidebar.js";
|
||||
import { PDFSidebarResizer } from "./pdf_sidebar_resizer.js";
|
||||
import { PDFThumbnailViewer } from "./pdf_thumbnail_viewer.js";
|
||||
import { PDFSidebar } from "web-pdf_sidebar";
|
||||
import { PDFSidebarResizer } from "web-pdf_sidebar_resizer";
|
||||
import { PDFThumbnailViewer } from "web-pdf_thumbnail_viewer";
|
||||
import { PDFViewer } from "./pdf_viewer.js";
|
||||
import { SecondaryToolbar } from "./secondary_toolbar.js";
|
||||
import { Toolbar } from "./toolbar.js";
|
||||
import { SecondaryToolbar } from "web-secondary_toolbar";
|
||||
import { Toolbar } from "web-toolbar";
|
||||
import { ViewHistory } from "./view_history.js";
|
||||
|
||||
const FORCE_PAGES_LOADED_TIMEOUT = 10000; // ms
|
||||
|
@ -598,7 +599,10 @@ const PDFViewerApplication = {
|
|||
);
|
||||
}
|
||||
|
||||
if (this.supportsFullscreen) {
|
||||
if (
|
||||
this.supportsFullscreen &&
|
||||
appConfig.secondaryToolbar?.presentationModeButton
|
||||
) {
|
||||
this.pdfPresentationMode = new PDFPresentationMode({
|
||||
container,
|
||||
pdfViewer: this.pdfViewer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue