From 76f0f3d98c7f4b7f9a4f7a6a758cd9db8c10e5ad Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 20 Mar 2024 12:01:43 +0100 Subject: [PATCH] wip #6800 @0.5 --- app/Fluidbook/Compiler/Compiler.php | 13 +++++++++++-- app/Fluidbook/Compiler/Images.php | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index f29d26144..d6517176c 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -85,7 +85,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError 'js/libs/jquery/jquery.scrollto.min.js', ], 'aria' => ['js/libs/aria/radio.js',], - 'bluebird' => ['js/libs/bluebird.min.js'], + //'bluebird' => ['js/libs/bluebird.min.js'], 'noaccents' => ['js/libs/noaccents.js'], 'screenfull' => ['js/libs/screenfull.min.js'], 'storage' => ['js/libs/storage.js',], @@ -184,6 +184,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError 'android' => array('webintent')); public $pluginCSS = []; public $pluginJs = []; + protected $customJs = []; public $htmlmultimedia = []; public $cssX = []; public $cssY = []; @@ -974,6 +975,9 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError } $script = '' . "\n"; + foreach ($this->customJs as $c) { + $script .= "\t" . '' . "\n"; + } foreach ($this->jsLibs as $jsLib => $files) { $script .= "\t" . '' . "\n"; } @@ -1498,6 +1502,12 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError $this->config->content_lock = $this->content_lock; } + public function addPDFJSPageRenderer() + { + $this->vdir->copyDirectory(resource_path('pdfjs/dist-min'), 'pdfjs'); + $this->customJs[] = 'pdfjs/build/pdf.js'; + } + public function addPDFJS($force = false) { if ($this->_addedPDFJS) { @@ -1514,7 +1524,6 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError $this->_addedPDFJS = true; - if ($renderer === 'pdfjs') { $resource = resource_path('pdfjs/dist-min'); } else if ($renderer === 'pdfjs-legacy') { diff --git a/app/Fluidbook/Compiler/Images.php b/app/Fluidbook/Compiler/Images.php index 83ddb1532..5eab88a79 100644 --- a/app/Fluidbook/Compiler/Images.php +++ b/app/Fluidbook/Compiler/Images.php @@ -37,7 +37,7 @@ trait Images $compositionCached = $this->compositionCached(); if ($this->fluidbookSettings->svgToCanvas == 2) { - $this->addPDFJS(); + $this->addPDFJSPageRenderer(); } set_time_limit(0); -- 2.39.5