fix(27): restore stylesheet copying to popup windows

The stylesheet copying code was accidentally removed in aa731c96d,
causing popup windows (metronome, backing track) to render without
CSS styles. This restores the code that copies all <link> and <style>
elements from the parent window to the popup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nuwan 2026-03-02 19:17:26 +05:30
parent 3da5f8938e
commit eb65785e3d
1 changed files with 15 additions and 0 deletions

View File

@ -68,6 +68,21 @@ const WindowPortal = ({
newWindow.document.body.style.backgroundColor = '#f8f9fa';
newWindow.document.body.style.overflow = 'hidden';
// Copy all stylesheets from parent window to popup
const stylesheets = Array.from(document.querySelectorAll('link[rel="stylesheet"], style'));
stylesheets.forEach(sheet => {
if (sheet.tagName === 'LINK') {
const newLink = newWindow.document.createElement('link');
newLink.rel = 'stylesheet';
newLink.href = sheet.href;
newWindow.document.head.appendChild(newLink);
} else if (sheet.tagName === 'STYLE') {
const newStyle = newWindow.document.createElement('style');
newStyle.textContent = sheet.textContent;
newWindow.document.head.appendChild(newStyle);
}
});
// Add window ID for identification
if (windowId) {
newWindow.windowId = windowId;