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:
parent
3da5f8938e
commit
eb65785e3d
|
|
@ -68,6 +68,21 @@ const WindowPortal = ({
|
||||||
newWindow.document.body.style.backgroundColor = '#f8f9fa';
|
newWindow.document.body.style.backgroundColor = '#f8f9fa';
|
||||||
newWindow.document.body.style.overflow = 'hidden';
|
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
|
// Add window ID for identification
|
||||||
if (windowId) {
|
if (windowId) {
|
||||||
newWindow.windowId = windowId;
|
newWindow.windowId = windowId;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue