@file-viewer/renderer-pdf 2.1.13 → 2.1.14

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.
Files changed (2) hide show
  1. package/dist/pdf.js +232 -38
  2. package/package.json +2 -2
package/dist/pdf.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getDocument, GlobalWorkerOptions, PDFWorker as PdfJsWorker, PixelsPerInch, } from 'pdfjs-dist/legacy/build/pdf.mjs';
2
2
  import { EventBus, GenericL10n, PDFFindController, PDFLinkService, PDFViewer, } from 'pdfjs-dist/legacy/web/pdf_viewer.mjs';
3
- import { registerFileViewerSearchProvider, registerFileViewerZoomProvider, unregisterFileViewerSearchProvider, unregisterFileViewerZoomProvider, createFileViewerZoomChangeEmitter, createFileViewerTranslator, buildPrintPageStyle, formatCssPixels, DEFAULT_PDF_RANGE_CHUNK_SIZE, resolveFileViewerLocale, } from '@file-viewer/core';
3
+ import { registerFileViewerSearchProvider, registerFileViewerZoomProvider, unregisterFileViewerSearchProvider, unregisterFileViewerZoomProvider, registerFileViewerViewStateProvider, unregisterFileViewerViewStateProvider, createFileViewerZoomChangeEmitter, createFileViewerViewStateChange, createFileViewerViewStateChangeEmitter, createFileViewerTranslator, buildPrintPageStyle, formatCssPixels, DEFAULT_PDF_RANGE_CHUNK_SIZE, resolveFileViewerLocale, } from '@file-viewer/core';
4
4
  import { DEFAULT_FILE_VIEWER_PDF_WORKER_PATH, resolveFileViewerPdfAssetUrls, } from '@file-viewer/core/assets';
5
5
  import { pdfViewerStyle } from './pdfStyles.js';
6
6
  export const DEFAULT_FILE_VIEWER_PDF_WORKER_URL = DEFAULT_FILE_VIEWER_PDF_WORKER_PATH;
@@ -200,7 +200,7 @@ const buildOutlineItems = (items, prefix = 'outline', getFallbackTitle = index =
200
200
  };
201
201
  });
202
202
  export default async function renderPdf(buffer, target, context) {
203
- var _a, _b;
203
+ var _a, _b, _c;
204
204
  const documentRef = target.ownerDocument || document;
205
205
  const targetWindow = documentRef.defaultView || (typeof window !== 'undefined' ? window : null);
206
206
  const t = createFileViewerTranslator(context === null || context === void 0 ? void 0 : context.options);
@@ -209,10 +209,12 @@ export default async function renderPdf(buffer, target, context) {
209
209
  throw new Error(t('pdf.error.browserWindow'));
210
210
  }
211
211
  const options = (_a = context === null || context === void 0 ? void 0 : context.options) === null || _a === void 0 ? void 0 : _a.pdf;
212
+ const initialViewState = (options === null || options === void 0 ? void 0 : options.initialViewState) || ((_b = context === null || context === void 0 ? void 0 : context.options) === null || _b === void 0 ? void 0 : _b.initialViewState) || null;
212
213
  const navigationEnabled = (options === null || options === void 0 ? void 0 : options.navigation) !== false;
213
214
  const toolbarVisible = (options === null || options === void 0 ? void 0 : options.toolbar) !== false;
214
215
  const thumbnailsEnabled = (options === null || options === void 0 ? void 0 : options.thumbnails) === true;
215
216
  const zoomEmitter = createFileViewerZoomChangeEmitter();
217
+ const viewStateEmitter = createFileViewerViewStateChangeEmitter();
216
218
  const isCompactViewport = () => {
217
219
  const width = target.clientWidth || targetWindow.innerWidth || 0;
218
220
  return width > 0 && width <= 720;
@@ -229,7 +231,7 @@ export default async function renderPdf(buffer, target, context) {
229
231
  let pageCount = 0;
230
232
  let currentScale = 1;
231
233
  let autoFitWidth = true;
232
- let currentRotation = normalizeRotation((_b = options === null || options === void 0 ? void 0 : options.rotation) !== null && _b !== void 0 ? _b : 0);
234
+ let currentRotation = normalizeRotation((_c = options === null || options === void 0 ? void 0 : options.rotation) !== null && _c !== void 0 ? _c : 0);
233
235
  let outlineItems = [];
234
236
  let resizeObserver = null;
235
237
  let thumbnailObserver = null;
@@ -237,6 +239,11 @@ export default async function renderPdf(buffer, target, context) {
237
239
  let pageDimensionFrame = 0;
238
240
  let destroyed = false;
239
241
  let loadVersion = 0;
242
+ let viewStateApplyVersion = 0;
243
+ let activeViewStateApplyVersion = 0;
244
+ let pendingInitialViewState = initialViewState;
245
+ let suppressScrollEventUntil = 0;
246
+ let scrollStateFrame = 0;
240
247
  let pdfSearchState = createPdfSearchState();
241
248
  let pdfMatchesCount = { current: 0, total: 0 };
242
249
  let pdfSearchOptions;
@@ -357,7 +364,7 @@ export default async function renderPdf(buffer, target, context) {
357
364
  thumb.textContent = String(page);
358
365
  }
359
366
  button.append(thumb, createElement(documentRef, 'span', 'pdf-page-label', t('pdf.nav.pageLabel', { page })));
360
- button.addEventListener('click', () => goToPage(page));
367
+ button.addEventListener('click', () => goToPage(page, 'page-click', 'user'));
361
368
  navList.append(button);
362
369
  }
363
370
  return;
@@ -735,13 +742,153 @@ export default async function renderPdf(buffer, target, context) {
735
742
  const getPdfZoomState = () => ({
736
743
  scale: currentScale,
737
744
  label: scaleText(),
738
- canZoomIn: !!pdfContext.viewer && canZoomIn(),
739
- canZoomOut: !!pdfContext.viewer && canZoomOut(),
740
- canReset: !!pdfContext.viewer,
745
+ canZoomIn: loadStatus === 'ready' && !!pdfContext.viewer && canZoomIn(),
746
+ canZoomOut: loadStatus === 'ready' && !!pdfContext.viewer && canZoomOut(),
747
+ canReset: loadStatus === 'ready' && !!pdfContext.viewer && !autoFitWidth,
741
748
  minScale: MIN_SCALE,
742
749
  maxScale: MAX_SCALE,
743
750
  });
744
- const setScale = (scale) => {
751
+ const readScrollState = () => {
752
+ const maxTop = Math.max(0, container.scrollHeight - container.clientHeight);
753
+ const maxLeft = Math.max(0, container.scrollWidth - container.clientWidth);
754
+ return {
755
+ top: container.scrollTop || 0,
756
+ left: container.scrollLeft || 0,
757
+ width: container.scrollWidth || 0,
758
+ height: container.scrollHeight || 0,
759
+ clientWidth: container.clientWidth || 0,
760
+ clientHeight: container.clientHeight || 0,
761
+ topRatio: maxTop > 0 ? (container.scrollTop || 0) / maxTop : 0,
762
+ leftRatio: maxLeft > 0 ? (container.scrollLeft || 0) / maxLeft : 0,
763
+ };
764
+ };
765
+ const getPdfViewState = () => {
766
+ const zoom = getPdfZoomState();
767
+ return {
768
+ renderer: 'pdf',
769
+ page: currentPage,
770
+ pageCount,
771
+ scale: zoom.scale,
772
+ zoom,
773
+ rotation: currentRotation,
774
+ scroll: readScrollState(),
775
+ navigation: {
776
+ visible: navigationEnabled ? navVisible : false,
777
+ mode: navMode,
778
+ },
779
+ };
780
+ };
781
+ const emitViewStateChange = (action, source = 'viewer') => {
782
+ const state = getPdfViewState();
783
+ if (!destroyed) {
784
+ viewStateEmitter.emit(createFileViewerViewStateChange(state, {
785
+ action,
786
+ source,
787
+ }));
788
+ }
789
+ return state;
790
+ };
791
+ const resolveScrollValue = (value, ratio, maxValue) => {
792
+ if (Number.isFinite(value)) {
793
+ return Number(value);
794
+ }
795
+ if (Number.isFinite(ratio)) {
796
+ return Number(ratio) * maxValue;
797
+ }
798
+ return undefined;
799
+ };
800
+ const suppressProgrammaticScrollEvents = () => {
801
+ suppressScrollEventUntil = Math.max(suppressScrollEventUntil, Date.now() + 180);
802
+ };
803
+ const restoreScrollState = (scroll, notify = true) => {
804
+ if (!scroll) {
805
+ return;
806
+ }
807
+ const maxTop = Math.max(0, container.scrollHeight - container.clientHeight);
808
+ const maxLeft = Math.max(0, container.scrollWidth - container.clientWidth);
809
+ const top = resolveScrollValue(scroll.top, scroll.topRatio, maxTop);
810
+ const left = resolveScrollValue(scroll.left, scroll.leftRatio, maxLeft);
811
+ if (!notify) {
812
+ suppressProgrammaticScrollEvents();
813
+ }
814
+ if (top !== undefined) {
815
+ container.scrollTop = Math.min(Math.max(0, top), maxTop);
816
+ }
817
+ if (left !== undefined) {
818
+ container.scrollLeft = Math.min(Math.max(0, left), maxLeft);
819
+ }
820
+ };
821
+ const applyPdfViewState = async (state, applyOptions = {}) => {
822
+ var _a, _b;
823
+ if (!pdfContext.viewer || loadStatus !== 'ready') {
824
+ pendingInitialViewState = state;
825
+ return getPdfViewState();
826
+ }
827
+ const source = applyOptions.source || 'api';
828
+ const action = applyOptions.action || 'restore';
829
+ const notify = applyOptions.notify !== false;
830
+ const applyVersion = ++viewStateApplyVersion;
831
+ activeViewStateApplyVersion = applyVersion;
832
+ suppressProgrammaticScrollEvents();
833
+ const nextRotation = Number(state.rotation);
834
+ const nextScale = Number((_a = state.scale) !== null && _a !== void 0 ? _a : (_b = state.zoom) === null || _b === void 0 ? void 0 : _b.scale);
835
+ const nextPage = Number(state.page);
836
+ try {
837
+ if (state.navigation) {
838
+ if (navigationEnabled && typeof state.navigation.visible === 'boolean') {
839
+ navVisible = state.navigation.visible;
840
+ }
841
+ if (state.navigation.mode === 'pages' || state.navigation.mode === 'outline') {
842
+ navMode = state.navigation.mode;
843
+ }
844
+ syncUi();
845
+ }
846
+ if (Number.isFinite(nextRotation)) {
847
+ applyRotation(nextRotation, 'rotation-change', source, false);
848
+ }
849
+ if (Number.isFinite(nextScale)) {
850
+ autoFitWidth = false;
851
+ setScale(nextScale, 'zoom-change', source, false);
852
+ }
853
+ if (Number.isFinite(nextPage)) {
854
+ goToPage(nextPage, 'page-change', source, false);
855
+ }
856
+ await waitForPaint(targetWindow);
857
+ if (applyVersion !== viewStateApplyVersion) {
858
+ return getPdfViewState();
859
+ }
860
+ restoreScrollState(state.scroll, false);
861
+ await waitForPaint(targetWindow);
862
+ if (applyVersion !== viewStateApplyVersion) {
863
+ return getPdfViewState();
864
+ }
865
+ restoreScrollState(state.scroll, false);
866
+ syncUi();
867
+ if (notify && applyVersion === viewStateApplyVersion) {
868
+ emitViewStateChange(action, source);
869
+ }
870
+ return getPdfViewState();
871
+ }
872
+ finally {
873
+ suppressProgrammaticScrollEvents();
874
+ if (activeViewStateApplyVersion === applyVersion) {
875
+ activeViewStateApplyVersion = 0;
876
+ }
877
+ }
878
+ };
879
+ const scheduleScrollViewStateChange = () => {
880
+ if (activeViewStateApplyVersion || Date.now() < suppressScrollEventUntil || destroyed) {
881
+ return;
882
+ }
883
+ if (scrollStateFrame) {
884
+ return;
885
+ }
886
+ scrollStateFrame = targetWindow.requestAnimationFrame(() => {
887
+ scrollStateFrame = 0;
888
+ emitViewStateChange('scroll', 'user');
889
+ });
890
+ };
891
+ const setScale = (scale, action = 'zoom-change', source = 'viewer', notifyViewState = true) => {
745
892
  if (!pdfContext.viewer) {
746
893
  return;
747
894
  }
@@ -751,6 +898,9 @@ export default async function renderPdf(buffer, target, context) {
751
898
  scheduleLegacyPageDimensionPatch();
752
899
  zoomEmitter.emit();
753
900
  syncUi();
901
+ if (notifyViewState) {
902
+ emitViewStateChange(action, source);
903
+ }
754
904
  };
755
905
  const getPageWidthAtScaleOne = (pdfViewer) => {
756
906
  var _a;
@@ -774,12 +924,12 @@ export default async function renderPdf(buffer, target, context) {
774
924
  const availableWidth = Math.max(containerWidth - FIT_HORIZONTAL_PADDING - PAGE_BORDER_WIDTH, 96);
775
925
  return pageWidth ? clampScale(availableWidth / pageWidth) : 1;
776
926
  };
777
- const fitToWidth = () => {
927
+ const fitToWidth = (source = 'user', notifyViewState = true) => {
778
928
  if (!pdfContext.viewer) {
779
929
  return;
780
930
  }
781
931
  autoFitWidth = true;
782
- setScale(getFitWidthScale(pdfContext.viewer));
932
+ setScale(getFitWidthScale(pdfContext.viewer), 'zoom-reset', source, notifyViewState);
783
933
  void waitForPaint(targetWindow).then(() => {
784
934
  var _a;
785
935
  (_a = pdfContext.viewer) === null || _a === void 0 ? void 0 : _a.update();
@@ -790,17 +940,17 @@ export default async function renderPdf(buffer, target, context) {
790
940
  return;
791
941
  }
792
942
  targetWindow.cancelAnimationFrame(fitFrame);
793
- fitFrame = targetWindow.requestAnimationFrame(() => fitToWidth());
943
+ fitFrame = targetWindow.requestAnimationFrame(() => fitToWidth('viewer'));
794
944
  };
795
- const zoomIn = () => {
945
+ const zoomIn = (source = 'user') => {
796
946
  autoFitWidth = false;
797
- setScale(currentScale + SCALE_STEP);
947
+ setScale(currentScale + SCALE_STEP, 'zoom-in', source);
798
948
  };
799
- const zoomOut = () => {
949
+ const zoomOut = (source = 'user') => {
800
950
  autoFitWidth = false;
801
- setScale(currentScale - SCALE_STEP);
951
+ setScale(currentScale - SCALE_STEP, 'zoom-out', source);
802
952
  };
803
- const applyRotation = (rotation) => {
953
+ const applyRotation = (rotation, action = 'rotation-change', source = 'viewer', notifyViewState = true) => {
804
954
  const normalized = normalizeRotation(rotation);
805
955
  currentRotation = normalized;
806
956
  pdfThumbnails.clear();
@@ -813,12 +963,18 @@ export default async function renderPdf(buffer, target, context) {
813
963
  void waitForPaint(targetWindow).then(() => {
814
964
  var _a;
815
965
  if (autoFitWidth) {
816
- fitToWidth();
966
+ fitToWidth(source, notifyViewState);
967
+ if (notifyViewState) {
968
+ emitViewStateChange(action, source);
969
+ }
817
970
  return;
818
971
  }
819
972
  (_a = pdfContext.viewer) === null || _a === void 0 ? void 0 : _a.update();
820
973
  scheduleLegacyPageDimensionPatch();
821
974
  syncUi();
975
+ if (notifyViewState) {
976
+ emitViewStateChange(action, source);
977
+ }
822
978
  });
823
979
  };
824
980
  const runWithStableHorizontalScroll = (action) => {
@@ -829,7 +985,7 @@ export default async function renderPdf(buffer, target, context) {
829
985
  void Promise.resolve(result).finally(() => stabilizeHorizontalScroll(previousScrollLeft));
830
986
  }
831
987
  };
832
- function goToPage(pageNumber) {
988
+ function goToPage(pageNumber, action = 'page-change', source = 'viewer', notifyViewState = true) {
833
989
  if (!pdfContext.viewer || !pageCount) {
834
990
  return;
835
991
  }
@@ -838,9 +994,12 @@ export default async function renderPdf(buffer, target, context) {
838
994
  pdfContext.viewer.currentPageNumber = nextPage;
839
995
  currentPage = nextPage;
840
996
  syncUi();
997
+ if (notifyViewState) {
998
+ emitViewStateChange(action, source);
999
+ }
841
1000
  });
842
1001
  }
843
- const toggleNav = () => {
1002
+ const toggleNav = (source = 'user', notifyViewState = true) => {
844
1003
  if (!navigationEnabled) {
845
1004
  return;
846
1005
  }
@@ -849,15 +1008,21 @@ export default async function renderPdf(buffer, target, context) {
849
1008
  void waitForPaint(targetWindow).then(() => {
850
1009
  var _a;
851
1010
  if (autoFitWidth) {
852
- fitToWidth();
1011
+ fitToWidth(source, notifyViewState);
853
1012
  return;
854
1013
  }
855
1014
  (_a = pdfContext.viewer) === null || _a === void 0 ? void 0 : _a.update();
856
1015
  });
1016
+ if (notifyViewState) {
1017
+ emitViewStateChange('navigation-toggle', source);
1018
+ }
857
1019
  };
858
- const setNavMode = (mode) => {
1020
+ const setNavMode = (mode, source = 'user', notifyViewState = true) => {
859
1021
  navMode = mode;
860
1022
  syncUi();
1023
+ if (notifyViewState) {
1024
+ emitViewStateChange('navigation-mode-change', source);
1025
+ }
861
1026
  };
862
1027
  const toggleOutlineItem = (item) => {
863
1028
  if (!item.items.length) {
@@ -871,6 +1036,7 @@ export default async function renderPdf(buffer, target, context) {
871
1036
  return;
872
1037
  }
873
1038
  runWithStableHorizontalScroll(() => pdfContext.linkService.goToDestination(item.dest));
1039
+ void waitForPaint(targetWindow).then(() => emitViewStateChange('outline-click', 'user'));
874
1040
  };
875
1041
  const destroyPdfResource = async (resource) => {
876
1042
  var _a;
@@ -1026,25 +1192,44 @@ export default async function renderPdf(buffer, target, context) {
1026
1192
  eventBus.on('updatefindcontrolstate', handlePdfFindControlState);
1027
1193
  eventBus.on('pagesinit', () => {
1028
1194
  var _a;
1029
- applyRotation(currentRotation);
1030
- fitToWidth();
1031
- scheduleLegacyPageDimensionPatch();
1195
+ applyRotation(currentRotation, 'rotation-change', 'viewer', false);
1032
1196
  loadStatus = 'ready';
1197
+ fitToWidth('viewer', false);
1198
+ scheduleLegacyPageDimensionPatch();
1033
1199
  syncUi();
1034
1200
  (_a = context === null || context === void 0 ? void 0 : context.onProgressiveRender) === null || _a === void 0 ? void 0 : _a.call(context);
1201
+ const viewStateToRestore = pendingInitialViewState;
1202
+ pendingInitialViewState = null;
1203
+ if (viewStateToRestore) {
1204
+ void applyPdfViewState(viewStateToRestore, {
1205
+ action: 'restore',
1206
+ source: 'initial',
1207
+ });
1208
+ }
1209
+ else {
1210
+ emitViewStateChange('init', 'viewer');
1211
+ }
1035
1212
  if (pdfContext.search) {
1036
1213
  eventBus.dispatch('find', { type: '', query: pdfContext.search });
1037
1214
  }
1038
1215
  });
1039
1216
  eventBus.on('pagechanging', ({ pageNumber }) => {
1217
+ const previousPage = currentPage;
1040
1218
  currentPage = pageNumber;
1041
1219
  syncUi();
1220
+ if (previousPage !== currentPage && !activeViewStateApplyVersion) {
1221
+ emitViewStateChange('page-change', 'viewer');
1222
+ }
1042
1223
  });
1043
1224
  eventBus.on('scalechanging', ({ scale }) => {
1225
+ const previousScale = currentScale;
1044
1226
  currentScale = clampScale(scale);
1045
1227
  scheduleLegacyPageDimensionPatch();
1046
1228
  zoomEmitter.emit();
1047
1229
  syncUi();
1230
+ if (previousScale !== currentScale && !activeViewStateApplyVersion) {
1231
+ emitViewStateChange('zoom-change', 'viewer');
1232
+ }
1048
1233
  });
1049
1234
  eventBus.on('pagerendered', scheduleLegacyPageDimensionPatch);
1050
1235
  if (!(context === null || context === void 0 ? void 0 : context.streamUrl) && !buffer.byteLength) {
@@ -1120,35 +1305,41 @@ export default async function renderPdf(buffer, target, context) {
1120
1305
  });
1121
1306
  registerFileViewerZoomProvider(root, {
1122
1307
  zoomIn: () => {
1123
- zoomIn();
1308
+ zoomIn('api');
1124
1309
  return getPdfZoomState();
1125
1310
  },
1126
1311
  zoomOut: () => {
1127
- zoomOut();
1312
+ zoomOut('api');
1128
1313
  return getPdfZoomState();
1129
1314
  },
1130
1315
  resetZoom: () => {
1131
- fitToWidth();
1316
+ fitToWidth('api');
1132
1317
  return getPdfZoomState();
1133
1318
  },
1134
1319
  setZoom: scale => {
1135
1320
  autoFitWidth = false;
1136
- setScale(scale);
1321
+ setScale(scale, 'zoom-change', 'api');
1137
1322
  return getPdfZoomState();
1138
1323
  },
1139
1324
  getState: getPdfZoomState,
1140
1325
  subscribe: zoomEmitter.subscribe,
1141
1326
  });
1142
- navToggleButton.addEventListener('click', toggleNav);
1143
- previousPageButton.addEventListener('click', () => goToPage(currentPage - 1));
1144
- nextPageButton.addEventListener('click', () => goToPage(currentPage + 1));
1145
- zoomOutButton.addEventListener('click', zoomOut);
1146
- zoomInButton.addEventListener('click', zoomIn);
1147
- scaleButton.addEventListener('click', fitToWidth);
1148
- rotateLeftButton.addEventListener('click', () => applyRotation(currentRotation - 90));
1149
- rotateRightButton.addEventListener('click', () => applyRotation(currentRotation + 90));
1150
- pagesTab.addEventListener('click', () => setNavMode('pages'));
1151
- outlineTab.addEventListener('click', () => setNavMode('outline'));
1327
+ registerFileViewerViewStateProvider(root, {
1328
+ getState: getPdfViewState,
1329
+ applyState: applyPdfViewState,
1330
+ subscribe: viewStateEmitter.subscribe,
1331
+ });
1332
+ navToggleButton.addEventListener('click', () => toggleNav('user'));
1333
+ previousPageButton.addEventListener('click', () => goToPage(currentPage - 1, 'page-step', 'user'));
1334
+ nextPageButton.addEventListener('click', () => goToPage(currentPage + 1, 'page-step', 'user'));
1335
+ zoomOutButton.addEventListener('click', () => zoomOut('user'));
1336
+ zoomInButton.addEventListener('click', () => zoomIn('user'));
1337
+ scaleButton.addEventListener('click', () => fitToWidth('user'));
1338
+ rotateLeftButton.addEventListener('click', () => applyRotation(currentRotation - 90, 'rotate-left', 'user'));
1339
+ rotateRightButton.addEventListener('click', () => applyRotation(currentRotation + 90, 'rotate-right', 'user'));
1340
+ pagesTab.addEventListener('click', () => setNavMode('pages', 'user'));
1341
+ outlineTab.addEventListener('click', () => setNavMode('outline', 'user'));
1342
+ container.addEventListener('scroll', scheduleScrollViewStateChange, { passive: true });
1152
1343
  if (targetWindow.ResizeObserver) {
1153
1344
  resizeObserver = new targetWindow.ResizeObserver(() => scheduleFitToWidth());
1154
1345
  resizeObserver.observe(container);
@@ -1163,12 +1354,15 @@ export default async function renderPdf(buffer, target, context) {
1163
1354
  loadVersion += 1;
1164
1355
  targetWindow.cancelAnimationFrame(fitFrame);
1165
1356
  targetWindow.cancelAnimationFrame(pageDimensionFrame);
1357
+ targetWindow.cancelAnimationFrame(scrollStateFrame);
1166
1358
  thumbnailObserver === null || thumbnailObserver === void 0 ? void 0 : thumbnailObserver.disconnect();
1167
1359
  thumbnailObserver = null;
1168
1360
  resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
1169
1361
  resizeObserver = null;
1362
+ container.removeEventListener('scroll', scheduleScrollViewStateChange);
1170
1363
  unregisterFileViewerSearchProvider(root);
1171
1364
  unregisterFileViewerZoomProvider(root);
1365
+ unregisterFileViewerViewStateProvider(root);
1172
1366
  outlineItems = [];
1173
1367
  (_a = context === null || context === void 0 ? void 0 : context.registerExportAdapter) === null || _a === void 0 ? void 0 : _a.call(context, null);
1174
1368
  const resource = pdfContext.resource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-pdf",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone PDF renderer plugin for Flyfish File Viewer powered by PDF.js.",
@@ -54,7 +54,7 @@
54
54
  "LICENSE"
55
55
  ],
56
56
  "dependencies": {
57
- "@file-viewer/core": "^2.1.13",
57
+ "@file-viewer/core": "^2.1.14",
58
58
  "pdfjs-dist": "^6.0.227"
59
59
  },
60
60
  "devDependencies": {