releasebird-javascript-sdk 1.0.67 → 1.0.68

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,30 @@ 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
+ <!-- Emoji and Font Support -->
199
207
  <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;
208
+ /* Preserve icon fonts - only apply to non-icon elements */
209
+ body, p, span, div, h1, h2, h3, h4, h5, h6, a, li, td, th, label, input, textarea, button {
210
+ 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
211
  }
203
212
  </style>
204
213
  `;
205
214
 
206
- // Insert emoji CSS into HTML
215
+ // Insert icon fonts and emoji CSS into HTML
207
216
  let enhancedHTML = htmlContent;
208
217
  if (htmlContent.includes('<head>')) {
209
- enhancedHTML = htmlContent.replace('<head>', '<head>' + emojiCSS);
218
+ enhancedHTML = htmlContent.replace('<head>', '<head>' + iconFontsAndEmojiCSS);
210
219
  } else if (htmlContent.includes('<html>')) {
211
- enhancedHTML = htmlContent.replace('<html>', '<html><head>' + emojiCSS + '</head>');
220
+ enhancedHTML = htmlContent.replace('<html>', '<html><head>' + iconFontsAndEmojiCSS + '</head>');
212
221
  }
213
222
 
214
223
  // Set content (using enhanced htmlContent with emoji fonts)
@@ -219,7 +228,49 @@ app.post('/render', async (req, res) => {
219
228
 
220
229
  console.log('[Screenshot] HTML content loaded with emoji font support');
221
230
 
222
- // Wait a bit for any animations/transitions
231
+ // Restore scroll positions from data attributes
232
+ const scrollRestored = await page.evaluate(() => {
233
+ let restoredCount = 0;
234
+
235
+ // Find all elements with scroll position data attributes
236
+ const scrollableElements = document.querySelectorAll('[data-rbird-scroll-left], [data-rbird-scroll-top]');
237
+
238
+ scrollableElements.forEach(el => {
239
+ const scrollLeft = el.getAttribute('data-rbird-scroll-left');
240
+ const scrollTop = el.getAttribute('data-rbird-scroll-top');
241
+
242
+ if (scrollLeft) {
243
+ el.scrollLeft = parseInt(scrollLeft, 10);
244
+ }
245
+ if (scrollTop) {
246
+ el.scrollTop = parseInt(scrollTop, 10);
247
+ }
248
+
249
+ restoredCount++;
250
+ });
251
+
252
+ // Also restore body/document scroll if present
253
+ const body = document.body;
254
+ if (body) {
255
+ const bodyScrollLeft = body.getAttribute('data-rbird-scroll-left');
256
+ const bodyScrollTop = body.getAttribute('data-rbird-scroll-top');
257
+
258
+ if (bodyScrollLeft) {
259
+ document.documentElement.scrollLeft = parseInt(bodyScrollLeft, 10);
260
+ document.body.scrollLeft = parseInt(bodyScrollLeft, 10);
261
+ }
262
+ if (bodyScrollTop) {
263
+ document.documentElement.scrollTop = parseInt(bodyScrollTop, 10);
264
+ document.body.scrollTop = parseInt(bodyScrollTop, 10);
265
+ }
266
+ }
267
+
268
+ return restoredCount;
269
+ });
270
+
271
+ console.log(`[Screenshot] Restored scroll positions for ${scrollRestored} elements`);
272
+
273
+ // Wait a bit for any animations/transitions and scroll to take effect
223
274
  await new Promise(resolve => setTimeout(resolve, 500));
224
275
 
225
276
  // Take screenshot (PNG for better emoji support)