ng2-pdfjs-viewer 25.0.6 → 25.0.7

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.
@@ -15,6 +15,9 @@ class ActionQueueManager {
15
15
  constructor(diagnosticLogs = false) {
16
16
  this.diagnosticLogs = diagnosticLogs;
17
17
  }
18
+ setDiagnosticLogs(enabled) {
19
+ this.diagnosticLogs = enabled;
20
+ }
18
21
  setPostMessageReady(ready, readiness = 0) {
19
22
  this.isPostMessageReady = ready;
20
23
  this.postMessageReadiness = readiness;
@@ -280,6 +283,8 @@ class ComponentUtils {
280
283
  textColor: "set-text-color",
281
284
  borderRadius: "set-border-radius",
282
285
  customCSS: "set-custom-css",
286
+ // Configuration
287
+ diagnosticLogs: "set-diagnostic-logs",
283
288
  };
284
289
  // Toolbar/Sidebar group visibility
285
290
  const groupVisibilityMap = {
@@ -379,7 +384,19 @@ class PdfJsViewerComponent {
379
384
  downloadFileName;
380
385
  locale;
381
386
  useOnlyCssZoom = false;
382
- diagnosticLogs = false;
387
+ set diagnosticLogs(value) {
388
+ this._diagnosticLogs = value;
389
+ // Update action queue manager
390
+ if (this.actionQueueManager) {
391
+ this.actionQueueManager.setDiagnosticLogs(value);
392
+ }
393
+ // Send to wrapper
394
+ this.dispatchAction("set-diagnostic-logs", value, "property-change");
395
+ }
396
+ get diagnosticLogs() {
397
+ return this._diagnosticLogs;
398
+ }
399
+ _diagnosticLogs = false;
383
400
  // #endregion
384
401
  // #region Control Visibility Properties
385
402
  showOpenFile = true;
@@ -565,7 +582,9 @@ class PdfJsViewerComponent {
565
582
  // #endregion
566
583
  // #region Helper function for deprecated properties
567
584
  setDeprecatedProperty(oldName, newProperty, value) {
568
- console.warn(`⚠️ DEPRECATED: Property "${oldName}" is deprecated. Use "${newProperty}" instead.`);
585
+ if (this.diagnosticLogs) {
586
+ console.warn(`⚠️ DEPRECATED: Property "${oldName}" is deprecated. Use "${newProperty}" instead.`);
587
+ }
569
588
  this[newProperty] = value;
570
589
  }
571
590
  // #endregion
@@ -800,11 +819,15 @@ class PdfJsViewerComponent {
800
819
  // #region Lifecycle Methods
801
820
  ngOnInit() {
802
821
  // 🟢 TEST LOG - Build verification (BUILD_ID from separate file)
803
- console.log("🟢 ng2-pdfjs-viewer.component.ts: TEST LOG - BUILD_ID:", window.NG2_PDF_VIEWER_BUILD_ID || "BUILD_ID_NOT_LOADED");
822
+ if (this.diagnosticLogs) {
823
+ console.log("🟢 ng2-pdfjs-viewer.component.ts: TEST LOG - BUILD_ID:", window.NG2_PDF_VIEWER_BUILD_ID || "BUILD_ID_NOT_LOADED");
824
+ }
804
825
  // Configure action queue manager with diagnostic logs
805
- this.actionQueueManager = new ActionQueueManager(this.diagnosticLogs);
826
+ this.actionQueueManager = new ActionQueueManager(this._diagnosticLogs);
806
827
  // Connect action queue manager to PostMessage system
807
828
  this.actionQueueManager.setPostMessageExecutor((action, payload) => this.sendControlMessage(action, payload));
829
+ // Send diagnostic logs setting to wrapper
830
+ this.dispatchAction("set-diagnostic-logs", this._diagnosticLogs, "initial-load");
808
831
  // Set up PostMessage listener
809
832
  this.setupMessageListener();
810
833
  // Load PDF for embedded views.
@@ -1538,7 +1561,9 @@ class PdfJsViewerComponent {
1538
1561
  if (typeof this.viewerTab === "undefined" || this.viewerTab.closed) {
1539
1562
  this.viewerTab = window.open("", this.target, this.externalWindowOptions || "");
1540
1563
  if (this.viewerTab == null) {
1541
- console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled.");
1564
+ if (this.diagnosticLogs) {
1565
+ console.error("ng2-pdfjs-viewer: For 'externalWindow = true'. i.e opening in new tab to work, pop-ups should be enabled.");
1566
+ }
1542
1567
  return;
1543
1568
  }
1544
1569
  if (this.showSpinner) {