@progress/kendo-pdfviewer-common 0.4.1 → 0.4.2-develop.1

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.
package/dist/es/search.js CHANGED
@@ -53,6 +53,7 @@ export class SearchService {
53
53
  }
54
54
  destroy() {
55
55
  this.clearSearch();
56
+ this.resetState();
56
57
  }
57
58
  extendOptions(options) {
58
59
  this.options = Object.assign({}, this.options, options);
@@ -96,6 +96,9 @@ export class Page extends Component {
96
96
  }
97
97
  destroy() {
98
98
  this.destroyTextLayer();
99
+ this.div = null;
100
+ this.pdfViewer = null;
101
+ this.pdfPage = null;
99
102
  }
100
103
  get isEditing() {
101
104
  return __classPrivateFieldGet(this, _Page_isEditing, "f");
@@ -126,6 +129,7 @@ export class Page extends Component {
126
129
  }
127
130
  destroyTextLayer() {
128
131
  this.removeTextLayer();
132
+ this.textLayer = null;
129
133
  }
130
134
  removeTextLayer() {
131
135
  var _a, _b;
@@ -519,6 +519,11 @@ export class PdfViewer extends Component {
519
519
  const readOptions = Object.assign({ dom: this.getPagesContainer(), zoom: this.options.zoomLevel }, loadFileOptions);
520
520
  this.disableDocumentScrollEventsTracking();
521
521
  this.clearDocument();
522
+ this.initEventBus();
523
+ __classPrivateFieldSet(this, _PdfViewer_eventAbortController, new AbortController(), "f");
524
+ this.bindEvents();
525
+ this.initLinkService();
526
+ this.initDocumentContainer();
522
527
  this.loadDocument(readOptions);
523
528
  this.setScaleFactor(this.options.zoomLevel);
524
529
  }
@@ -554,6 +559,10 @@ export class PdfViewer extends Component {
554
559
  })
555
560
  .catch((e) => {
556
561
  this.triggerError(e);
562
+ })
563
+ .finally(() => {
564
+ var _a;
565
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(this.pdfDocument);
557
566
  });
558
567
  }
559
568
  initDocumentAnnotationStorage(pdfDocument) {
@@ -804,15 +813,22 @@ export class PdfViewer extends Component {
804
813
  this.trigger(ANNOTATION_EDITOR_TOOLBAR_HIDE, e);
805
814
  }
806
815
  clearDocument() {
807
- var _a;
808
- this.clearPagesElements();
816
+ this.destroyEventBus();
817
+ this.unbindEvents();
818
+ this.destroySearchService();
819
+ this.destroyAnnotationEditorUIManager();
809
820
  this.clearDocumentState();
810
- (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
811
821
  }
812
822
  clearDocumentState() {
823
+ var _a;
824
+ this.clearPagesState();
813
825
  this.state.pdfDocument = null;
814
826
  this.state.pdfPages = [];
827
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
828
+ }
829
+ clearPagesState() {
815
830
  this.pages.forEach(x => x.destroy());
831
+ this.clearPagesElements();
816
832
  this.pages = [];
817
833
  }
818
834
  initPageComponents(pdfPages) {
@@ -53,6 +53,7 @@ export class SearchService {
53
53
  }
54
54
  destroy() {
55
55
  this.clearSearch();
56
+ this.resetState();
56
57
  }
57
58
  extendOptions(options) {
58
59
  this.options = Object.assign({}, this.options, options);
@@ -96,6 +96,9 @@ export class Page extends Component {
96
96
  }
97
97
  destroy() {
98
98
  this.destroyTextLayer();
99
+ this.div = null;
100
+ this.pdfViewer = null;
101
+ this.pdfPage = null;
99
102
  }
100
103
  get isEditing() {
101
104
  return __classPrivateFieldGet(this, _Page_isEditing, "f");
@@ -126,6 +129,7 @@ export class Page extends Component {
126
129
  }
127
130
  destroyTextLayer() {
128
131
  this.removeTextLayer();
132
+ this.textLayer = null;
129
133
  }
130
134
  removeTextLayer() {
131
135
  var _a, _b;
@@ -519,6 +519,11 @@ export class PdfViewer extends Component {
519
519
  const readOptions = Object.assign({ dom: this.getPagesContainer(), zoom: this.options.zoomLevel }, loadFileOptions);
520
520
  this.disableDocumentScrollEventsTracking();
521
521
  this.clearDocument();
522
+ this.initEventBus();
523
+ __classPrivateFieldSet(this, _PdfViewer_eventAbortController, new AbortController(), "f");
524
+ this.bindEvents();
525
+ this.initLinkService();
526
+ this.initDocumentContainer();
522
527
  this.loadDocument(readOptions);
523
528
  this.setScaleFactor(this.options.zoomLevel);
524
529
  }
@@ -554,6 +559,10 @@ export class PdfViewer extends Component {
554
559
  })
555
560
  .catch((e) => {
556
561
  this.triggerError(e);
562
+ })
563
+ .finally(() => {
564
+ var _a;
565
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(this.pdfDocument);
557
566
  });
558
567
  }
559
568
  initDocumentAnnotationStorage(pdfDocument) {
@@ -804,15 +813,22 @@ export class PdfViewer extends Component {
804
813
  this.trigger(ANNOTATION_EDITOR_TOOLBAR_HIDE, e);
805
814
  }
806
815
  clearDocument() {
807
- var _a;
808
- this.clearPagesElements();
816
+ this.destroyEventBus();
817
+ this.unbindEvents();
818
+ this.destroySearchService();
819
+ this.destroyAnnotationEditorUIManager();
809
820
  this.clearDocumentState();
810
- (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
811
821
  }
812
822
  clearDocumentState() {
823
+ var _a;
824
+ this.clearPagesState();
813
825
  this.state.pdfDocument = null;
814
826
  this.state.pdfPages = [];
827
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
828
+ }
829
+ clearPagesState() {
815
830
  this.pages.forEach(x => x.destroy());
831
+ this.clearPagesElements();
816
832
  this.pages = [];
817
833
  }
818
834
  initPageComponents(pdfPages) {
@@ -56,6 +56,7 @@ class SearchService {
56
56
  }
57
57
  destroy() {
58
58
  this.clearSearch();
59
+ this.resetState();
59
60
  }
60
61
  extendOptions(options) {
61
62
  this.options = Object.assign({}, this.options, options);
@@ -96,6 +96,9 @@ class Page extends component_1.Component {
96
96
  }
97
97
  destroy() {
98
98
  this.destroyTextLayer();
99
+ this.div = null;
100
+ this.pdfViewer = null;
101
+ this.pdfPage = null;
99
102
  }
100
103
  get isEditing() {
101
104
  return tslib_1.__classPrivateFieldGet(this, _Page_isEditing, "f");
@@ -126,6 +129,7 @@ class Page extends component_1.Component {
126
129
  }
127
130
  destroyTextLayer() {
128
131
  this.removeTextLayer();
132
+ this.textLayer = null;
129
133
  }
130
134
  removeTextLayer() {
131
135
  var _a, _b;
@@ -111,6 +111,7 @@ export declare class PdfViewer extends Component {
111
111
  onPagesLoad: (args: any) => void;
112
112
  clearDocument(): void;
113
113
  clearDocumentState(): void;
114
+ clearPagesState(): void;
114
115
  initPageComponents(pdfPages: any): void;
115
116
  destroyPageComponents(): void;
116
117
  clearPagesElements(): void;
@@ -522,6 +522,11 @@ class PdfViewer extends main_1.Component {
522
522
  const readOptions = Object.assign({ dom: this.getPagesContainer(), zoom: this.options.zoomLevel }, loadFileOptions);
523
523
  this.disableDocumentScrollEventsTracking();
524
524
  this.clearDocument();
525
+ this.initEventBus();
526
+ tslib_1.__classPrivateFieldSet(this, _PdfViewer_eventAbortController, new AbortController(), "f");
527
+ this.bindEvents();
528
+ this.initLinkService();
529
+ this.initDocumentContainer();
525
530
  this.loadDocument(readOptions);
526
531
  this.setScaleFactor(this.options.zoomLevel);
527
532
  }
@@ -557,6 +562,10 @@ class PdfViewer extends main_1.Component {
557
562
  })
558
563
  .catch((e) => {
559
564
  this.triggerError(e);
565
+ })
566
+ .finally(() => {
567
+ var _a;
568
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(this.pdfDocument);
560
569
  });
561
570
  }
562
571
  initDocumentAnnotationStorage(pdfDocument) {
@@ -807,15 +816,22 @@ class PdfViewer extends main_1.Component {
807
816
  this.trigger(ANNOTATION_EDITOR_TOOLBAR_HIDE, e);
808
817
  }
809
818
  clearDocument() {
810
- var _a;
811
- this.clearPagesElements();
819
+ this.destroyEventBus();
820
+ this.unbindEvents();
821
+ this.destroySearchService();
822
+ this.destroyAnnotationEditorUIManager();
812
823
  this.clearDocumentState();
813
- (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
814
824
  }
815
825
  clearDocumentState() {
826
+ var _a;
827
+ this.clearPagesState();
816
828
  this.state.pdfDocument = null;
817
829
  this.state.pdfPages = [];
830
+ (_a = this.linkService) === null || _a === void 0 ? void 0 : _a.setDocument(null);
831
+ }
832
+ clearPagesState() {
818
833
  this.pages.forEach(x => x.destroy());
834
+ this.clearPagesElements();
819
835
  this.pages = [];
820
836
  }
821
837
  initPageComponents(pdfPages) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@progress/kendo-pdfviewer-common",
3
3
  "description": "Kendo UI TypeScript package exporting functions for PDFViewer component",
4
- "version": "0.4.1",
4
+ "version": "0.4.2-develop.1",
5
5
  "keywords": [
6
6
  "Kendo UI"
7
7
  ],