|
40 | 40 | originalBodyPosition: null, |
41 | 41 | originalBodyWidth: null, |
42 | 42 | originalBodyHeight: null, |
| 43 | + originalCardStyle: null, |
| 44 | + originalCardBodyStyle: null, |
| 45 | + originalRowStyle: null, |
| 46 | + originalColStyle: null, |
| 47 | + originalParent: null, |
| 48 | + originalNextSibling: null, |
43 | 49 | scrollPosition: 0, |
44 | 50 | isFullScreen: false |
45 | 51 | }; |
|
50 | 56 |
|
51 | 57 | if (!container || state.isFullScreen) return; |
52 | 58 |
|
| 59 | + // Store original styles and DOM position |
53 | 60 | state.originalContainerStyle = container.getAttribute('style') || ''; |
| 61 | + state.originalParent = container.parentNode; |
| 62 | + state.originalNextSibling = container.nextSibling; |
54 | 63 | state.originalBodyOverflow = document.body.style.overflow; |
55 | 64 | state.originalBodyPosition = document.body.style.position; |
56 | 65 | state.originalBodyWidth = document.body.style.width; |
|
59 | 68 |
|
60 | 69 | const backgroundColor = isDarkTheme ? '#36363e' : '#ffffff'; |
61 | 70 |
|
| 71 | + // Move container to body to escape parent constraints |
| 72 | + document.body.appendChild(container); |
| 73 | +
|
| 74 | + // Apply fullscreen styles |
62 | 75 | container.classList.add('fullscreen-active'); |
63 | 76 | container.style.backgroundColor = backgroundColor; |
64 | | -
|
| 77 | + container.style.position = 'fixed'; |
| 78 | + container.style.top = '0'; |
| 79 | + container.style.left = '0'; |
| 80 | + container.style.width = '100vw'; |
| 81 | + container.style.height = '100vh'; |
| 82 | + container.style.zIndex = '9999'; |
| 83 | + container.style.margin = '0'; |
| 84 | + container.style.padding = '0'; |
| 85 | + container.style.border = 'none'; |
| 86 | + container.style.borderRadius = '0'; |
| 87 | + container.style.boxShadow = 'none'; |
| 88 | +
|
| 89 | + // Lock body scroll |
65 | 90 | document.body.style.overflow = 'hidden'; |
66 | 91 | document.body.style.position = 'fixed'; |
67 | 92 | document.body.style.width = '100%'; |
68 | 93 | document.body.style.height = '100%'; |
| 94 | + document.body.style.top = '0'; |
| 95 | + document.body.style.left = '0'; |
69 | 96 | document.body.classList.add('fullscreen-mode'); |
70 | 97 | document.documentElement.classList.add('fullscreen-active'); |
71 | 98 |
|
| 99 | + // Move JsonPathDisplay modal to body if it exists |
| 100 | + const pathModal = document.querySelector('.path-modal-overlay'); |
| 101 | + if (pathModal && pathModal.parentNode !== document.body) { |
| 102 | + if (!pathModal._originalParent) { |
| 103 | + pathModal._originalParent = pathModal.parentNode; |
| 104 | + pathModal._originalNextSibling = pathModal.nextSibling; |
| 105 | + } |
| 106 | + document.body.appendChild(pathModal); |
| 107 | + console.log('✅ Moved existing JsonPathDisplay modal to body for fullscreen compatibility'); |
| 108 | + } |
| 109 | +
|
| 110 | + // Move JsonStatistics modal to body if it exists |
| 111 | + const statsModal = document.querySelector('.stats-modal-overlay'); |
| 112 | + if (statsModal && statsModal.parentNode !== document.body) { |
| 113 | + if (!statsModal._originalParent) { |
| 114 | + statsModal._originalParent = statsModal.parentNode; |
| 115 | + statsModal._originalNextSibling = statsModal.nextSibling; |
| 116 | + } |
| 117 | + document.body.appendChild(statsModal); |
| 118 | + console.log('✅ Moved existing JsonStatistics modal to body for fullscreen compatibility'); |
| 119 | + } |
| 120 | +
|
72 | 121 | state.isFullScreen = true; |
73 | 122 | console.log('✅ Entered FullScreen Mode'); |
74 | 123 | }; |
|
79 | 128 |
|
80 | 129 | if (!container || !state.isFullScreen) return; |
81 | 130 |
|
| 131 | + // Remove fullscreen class |
82 | 132 | container.classList.remove('fullscreen-active'); |
83 | 133 |
|
84 | | - if (state.originalContainerStyle !== null) { |
| 134 | + // Restore container styles |
| 135 | + if (state.originalContainerStyle !== null && state.originalContainerStyle !== '') { |
85 | 136 | container.setAttribute('style', state.originalContainerStyle); |
| 137 | + } else { |
| 138 | + container.removeAttribute('style'); |
86 | 139 | } |
87 | 140 |
|
| 141 | + // Move container back to original position |
| 142 | + if (state.originalParent) { |
| 143 | + if (state.originalNextSibling) { |
| 144 | + state.originalParent.insertBefore(container, state.originalNextSibling); |
| 145 | + } else { |
| 146 | + state.originalParent.appendChild(container); |
| 147 | + } |
| 148 | + } |
| 149 | +
|
| 150 | + // Restore body styles |
88 | 151 | if (state.originalBodyOverflow !== null) { |
89 | 152 | document.body.style.overflow = state.originalBodyOverflow; |
| 153 | + } else { |
| 154 | + document.body.style.overflow = ''; |
90 | 155 | } |
91 | 156 | if (state.originalBodyPosition !== null) { |
92 | 157 | document.body.style.position = state.originalBodyPosition; |
| 158 | + } else { |
| 159 | + document.body.style.position = ''; |
93 | 160 | } |
94 | 161 | if (state.originalBodyWidth !== null) { |
95 | 162 | document.body.style.width = state.originalBodyWidth; |
| 163 | + } else { |
| 164 | + document.body.style.width = ''; |
96 | 165 | } |
97 | 166 | if (state.originalBodyHeight !== null) { |
98 | 167 | document.body.style.height = state.originalBodyHeight; |
| 168 | + } else { |
| 169 | + document.body.style.height = ''; |
99 | 170 | } |
| 171 | + document.body.style.top = ''; |
| 172 | + document.body.style.left = ''; |
100 | 173 |
|
101 | 174 | document.body.classList.remove('fullscreen-mode'); |
102 | 175 | document.documentElement.classList.remove('fullscreen-active'); |
103 | 176 |
|
| 177 | + // Restore JsonPathDisplay modal to original position if it was moved to body |
| 178 | + const pathModal = document.querySelector('.path-modal-overlay'); |
| 179 | + if (pathModal && pathModal._originalParent) { |
| 180 | + if (pathModal._originalNextSibling) { |
| 181 | + pathModal._originalParent.insertBefore(pathModal, pathModal._originalNextSibling); |
| 182 | + } else { |
| 183 | + pathModal._originalParent.appendChild(pathModal); |
| 184 | + } |
| 185 | + pathModal._originalParent = null; |
| 186 | + pathModal._originalNextSibling = null; |
| 187 | + console.log('✅ Restored JsonPathDisplay modal to original position after exiting fullscreen'); |
| 188 | + } |
| 189 | +
|
| 190 | + // Restore JsonStatistics modal to original position if it was moved to body |
| 191 | + const statsModal = document.querySelector('.stats-modal-overlay'); |
| 192 | + if (statsModal && statsModal._originalParent) { |
| 193 | + if (statsModal._originalNextSibling) { |
| 194 | + statsModal._originalParent.insertBefore(statsModal, statsModal._originalNextSibling); |
| 195 | + } else { |
| 196 | + statsModal._originalParent.appendChild(statsModal); |
| 197 | + } |
| 198 | + statsModal._originalParent = null; |
| 199 | + statsModal._originalNextSibling = null; |
| 200 | + console.log('✅ Restored JsonStatistics modal to original position after exiting fullscreen'); |
| 201 | + } |
| 202 | +
|
104 | 203 | window.scrollTo(0, state.scrollPosition); |
105 | 204 |
|
| 205 | + // Reset state |
106 | 206 | state.originalContainerStyle = null; |
107 | 207 | state.originalBodyOverflow = null; |
108 | 208 | state.originalBodyPosition = null; |
109 | 209 | state.originalBodyWidth = null; |
110 | 210 | state.originalBodyHeight = null; |
| 211 | + state.originalParent = null; |
| 212 | + state.originalNextSibling = null; |
111 | 213 | state.scrollPosition = 0; |
112 | 214 | state.isFullScreen = false; |
113 | 215 |
|
|
0 commit comments