releasebird-javascript-sdk 1.0.67 → 1.0.69

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.
@@ -194,21 +194,38 @@ app.post('/render', async (req, res) => {
194
194
 
195
195
  console.log(`[Screenshot] Viewport set to ${viewportWidth}x${viewportHeight}`);
196
196
 
197
- // Inject emoji font CSS into HTML
198
- const emojiCSS = `
197
+ // Inject icon fonts and emoji font CSS into HTML
198
+ const iconFontsAndEmojiCSS = `
199
+ <!-- FontAwesome Icons -->
200
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
201
+ <!-- Bootstrap Icons -->
202
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" crossorigin="anonymous" />
203
+ <!-- Material Icons -->
204
+ <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />
205
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" />
206
+ <!-- Feather Icons -->
207
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.css" crossorigin="anonymous" />
208
+ <!-- Ionicons -->
209
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ionicons@5.5.4/dist/css/ionicons.min.css" crossorigin="anonymous" />
210
+ <!-- Simple Line Icons -->
211
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.5.5/css/simple-line-icons.min.css" crossorigin="anonymous" />
212
+ <!-- Themify Icons -->
213
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/themify-icons@0.1.2/css/themify-icons.css" crossorigin="anonymous" />
214
+ <!-- Emoji and Font Support -->
199
215
  <style>
200
- * {
201
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif !important;
216
+ /* Preserve icon fonts - only apply to non-icon elements */
217
+ body, p, span, div, h1, h2, h3, h4, h5, h6, a, li, td, th, label, input, textarea, button {
218
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
202
219
  }
203
220
  </style>
204
221
  `;
205
222
 
206
- // Insert emoji CSS into HTML
223
+ // Insert icon fonts and emoji CSS into HTML
207
224
  let enhancedHTML = htmlContent;
208
225
  if (htmlContent.includes('<head>')) {
209
- enhancedHTML = htmlContent.replace('<head>', '<head>' + emojiCSS);
226
+ enhancedHTML = htmlContent.replace('<head>', '<head>' + iconFontsAndEmojiCSS);
210
227
  } else if (htmlContent.includes('<html>')) {
211
- enhancedHTML = htmlContent.replace('<html>', '<html><head>' + emojiCSS + '</head>');
228
+ enhancedHTML = htmlContent.replace('<html>', '<html><head>' + iconFontsAndEmojiCSS + '</head>');
212
229
  }
213
230
 
214
231
  // Set content (using enhanced htmlContent with emoji fonts)
@@ -219,7 +236,49 @@ app.post('/render', async (req, res) => {
219
236
 
220
237
  console.log('[Screenshot] HTML content loaded with emoji font support');
221
238
 
222
- // Wait a bit for any animations/transitions
239
+ // Restore scroll positions from data attributes
240
+ const scrollRestored = await page.evaluate(() => {
241
+ let restoredCount = 0;
242
+
243
+ // Find all elements with scroll position data attributes
244
+ const scrollableElements = document.querySelectorAll('[data-rbird-scroll-left], [data-rbird-scroll-top]');
245
+
246
+ scrollableElements.forEach(el => {
247
+ const scrollLeft = el.getAttribute('data-rbird-scroll-left');
248
+ const scrollTop = el.getAttribute('data-rbird-scroll-top');
249
+
250
+ if (scrollLeft) {
251
+ el.scrollLeft = parseInt(scrollLeft, 10);
252
+ }
253
+ if (scrollTop) {
254
+ el.scrollTop = parseInt(scrollTop, 10);
255
+ }
256
+
257
+ restoredCount++;
258
+ });
259
+
260
+ // Also restore body/document scroll if present
261
+ const body = document.body;
262
+ if (body) {
263
+ const bodyScrollLeft = body.getAttribute('data-rbird-scroll-left');
264
+ const bodyScrollTop = body.getAttribute('data-rbird-scroll-top');
265
+
266
+ if (bodyScrollLeft) {
267
+ document.documentElement.scrollLeft = parseInt(bodyScrollLeft, 10);
268
+ document.body.scrollLeft = parseInt(bodyScrollLeft, 10);
269
+ }
270
+ if (bodyScrollTop) {
271
+ document.documentElement.scrollTop = parseInt(bodyScrollTop, 10);
272
+ document.body.scrollTop = parseInt(bodyScrollTop, 10);
273
+ }
274
+ }
275
+
276
+ return restoredCount;
277
+ });
278
+
279
+ console.log(`[Screenshot] Restored scroll positions for ${scrollRestored} elements`);
280
+
281
+ // Wait a bit for any animations/transitions and scroll to take effect
223
282
  await new Promise(resolve => setTimeout(resolve, 500));
224
283
 
225
284
  // Take screenshot (PNG for better emoji support)