ensure html structure exists before injecting fullscreen toggle button
Hunter
Wednesday, July 16th, 2025 at 6:54 PM
230 // Write HTML directly to iframe document
231 const doc = preview.contentDocument || preview.contentWindow.document;
232 doc.open();
- doc.write(code);
233 +
234 + // Ensure we have a proper HTML document structure for the button
235 + const htmlContent = code.trim() || '<!DOCTYPE html><html><head></head><body></body></html>';
236 + doc.write(htmlContent);
237
238 // Inject CSS to disable overscroll and add fullscreen toggle styles
239 const style = doc.createElement('style');