diff --git a/litmus/features/dropdown/IFramePortal.js b/litmus/features/dropdown/IFramePortal.js new file mode 100644 index 000000000..d732c1c14 --- /dev/null +++ b/litmus/features/dropdown/IFramePortal.js @@ -0,0 +1,57 @@ +import { createPortal } from "react-dom"; +import { useEffect, useRef, useState } from "react"; + +function copyStyles(sourceDoc, targetDoc) { + Array.from(sourceDoc.styleSheets).forEach((styleSheet) => { + try { + if (styleSheet.href) { + let link = targetDoc.createElement("link"); + link.rel = "stylesheet"; + link.href = styleSheet.href; + targetDoc.head.appendChild(link); + } else if (styleSheet.ownerNode && styleSheet.ownerNode.textContent) { + // dev builds inject theme/widget CSS as inline