@teipublisher/pb-components 1.42.3 → 1.42.5

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/pb-elements.json CHANGED
@@ -8407,7 +8407,7 @@
8407
8407
  },
8408
8408
  {
8409
8409
  "name": "url",
8410
- "description": "The generated API URL from which the HTML content will be loaded.\nReadonly.",
8410
+ "description": "The generated API URL from which the HTML content will be loaded.\nReadonly. This excludes the paged.js styles and scripts, so you can\nuse the URL with other tools.",
8411
8411
  "type": "string",
8412
8412
  "default": "\"about:blank\""
8413
8413
  },
@@ -8465,7 +8465,7 @@
8465
8465
  {
8466
8466
  "name": "url",
8467
8467
  "attribute": "url",
8468
- "description": "The generated API URL from which the HTML content will be loaded.\nReadonly.",
8468
+ "description": "The generated API URL from which the HTML content will be loaded.\nReadonly. This excludes the paged.js styles and scripts, so you can\nuse the URL with other tools.",
8469
8469
  "type": "string",
8470
8470
  "default": "\"about:blank\""
8471
8471
  },
@@ -28,7 +28,8 @@ export class PbPrintPreview extends pbMixin(LitElement) {
28
28
  },
29
29
  /**
30
30
  * The generated API URL from which the HTML content will be loaded.
31
- * Readonly.
31
+ * Readonly. This excludes the paged.js styles and scripts, so you can
32
+ * use the URL with other tools.
32
33
  */
33
34
  url: {
34
35
  type: String,
@@ -86,18 +87,21 @@ export class PbPrintPreview extends pbMixin(LitElement) {
86
87
 
87
88
  const doc = this.getDocument();
88
89
  const params = new URLSearchParams();
89
- params.set('wc', 'false');
90
90
  if (doc.odd) {
91
91
  params.set('odd', `${doc.odd}.odd`);
92
92
  }
93
93
  params.set('base', `${this.getEndpoint()}/${doc.getCollection()}/`);
94
+ this._getCustomStyles().forEach((href) => params.append('style', href));
95
+ const urlParams = params.toString();
96
+ this.url = `${this.getEndpoint()}/api/document/${encodeURIComponent(doc.path)}/print?${urlParams}`;
97
+
98
+ const iParams = new URLSearchParams(urlParams);
99
+ iParams.set('wc', 'true');
94
100
  if (!this.raw) {
95
- params.set('script', resolveURL('../lib/paged.polyfill.js'));
101
+ iParams.set('script', resolveURL('../lib/paged.polyfill.js'));
102
+ iParams.append('style', resolveURL('../css/pagedjs/interface.css'));
96
103
  }
97
- this._getCustomStyles().forEach((href) => params.append('style', href));
98
- this.url = `${this.getEndpoint()}/api/document/${encodeURIComponent(doc.path)}/print?${params.toString()}`;
99
-
100
- this._iframe.src = this.url;
104
+ this._iframe.src = `${this.getEndpoint()}/api/document/${encodeURIComponent(doc.path)}/print?${iParams.toString()}`;
101
105
  }
102
106
 
103
107
  render() {
@@ -111,10 +115,6 @@ export class PbPrintPreview extends pbMixin(LitElement) {
111
115
  if (this.styles) {
112
116
  customStyles = this.styles.split(/\s*,\s*/);
113
117
  }
114
-
115
- if (!this.raw) {
116
- customStyles.push(resolveURL('../css/pagedjs/interface.css'));
117
- }
118
118
  return customStyles;
119
119
  }
120
120