carriera-intern 1.1.120 → 1.1.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -177,7 +177,7 @@ const INPUT_CHARACTER_SETS = {
|
|
|
177
177
|
|
|
178
178
|
const PDFJS_ASSET_BASE = new InjectionToken('PDFJS_ASSET_BASE', {
|
|
179
179
|
providedIn: 'root',
|
|
180
|
-
factory: () => '/pdfjs/',
|
|
180
|
+
factory: () => '/assets/pdfjs/',
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
class DocumentThumbnailHelper {
|
|
@@ -4735,25 +4735,30 @@ class DocumentService {
|
|
|
4735
4735
|
}
|
|
4736
4736
|
async configureWorkerSrc() {
|
|
4737
4737
|
const remoteWorkerUrl = `${this.assetBase}pdf.worker.min.mjs`;
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
await this.workerSrcAsJavascriptModule(remoteWorkerUrl);
|
|
4741
|
-
}
|
|
4742
|
-
catch {
|
|
4743
|
-
pdfjsLib.GlobalWorkerOptions.workerSrc = remoteWorkerUrl;
|
|
4744
|
-
}
|
|
4738
|
+
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
|
4739
|
+
await this.workerSrcAsJavascriptModule(remoteWorkerUrl);
|
|
4745
4740
|
}
|
|
4746
4741
|
async workerSrcAsJavascriptModule(url) {
|
|
4747
4742
|
const response = await fetch(url);
|
|
4748
4743
|
if (!response.ok) {
|
|
4749
4744
|
throw new Error(`Failed to load PDF worker (${response.status})`);
|
|
4750
4745
|
}
|
|
4751
|
-
const
|
|
4746
|
+
const source = await response.text();
|
|
4747
|
+
if (!this.isPdfWorkerSource(source)) {
|
|
4748
|
+
throw new Error(`PDF worker at ${url} was not JavaScript`);
|
|
4749
|
+
}
|
|
4750
|
+
const javascriptBlob = new Blob([source], {
|
|
4752
4751
|
type: 'application/javascript',
|
|
4753
4752
|
});
|
|
4754
4753
|
this.workerSrcBlobUrl = URL.createObjectURL(javascriptBlob);
|
|
4755
4754
|
return this.workerSrcBlobUrl;
|
|
4756
4755
|
}
|
|
4756
|
+
isPdfWorkerSource(source) {
|
|
4757
|
+
const start = source.trimStart().slice(0, 80);
|
|
4758
|
+
return (start.startsWith('/*') ||
|
|
4759
|
+
start.startsWith('import ') ||
|
|
4760
|
+
start.startsWith('('));
|
|
4761
|
+
}
|
|
4757
4762
|
destroyWorkers() {
|
|
4758
4763
|
for (const worker of this.workerPool) {
|
|
4759
4764
|
if (!worker.destroyed) {
|