openfree commited on
Commit
4a672db
ยท
verified ยท
1 Parent(s): 8830269

Update app.css

Browse files
Files changed (1) hide show
  1. app.css +86 -61
app.css CHANGED
@@ -62,7 +62,6 @@ body {
62
  color: var(--text-primary);
63
  }
64
 
65
- /* ์šฐ์ธก ํŒจ๋„ ํฌ๊ธฐ ์กฐ์ ˆ */
66
  .right_panel {
67
  position: relative;
68
  height: 600px;
@@ -73,24 +72,29 @@ body {
73
  margin: 20px;
74
  border-radius: 12px;
75
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
 
 
76
  }
77
 
78
- /* iframe์ด ์šฐ์ธก ํŒจ๋„์„ ๊ฝ‰ ์ฑ„์šฐ๋„๋ก ์ˆ˜์ • */
79
  .html_content {
80
- height: calc(100% - 30px);
81
- width: 100%;
 
82
  background: var(--surface);
83
  overflow: hidden;
84
  }
85
 
 
86
  .html_content iframe {
 
87
  width: 100%;
88
- height: 100%;
89
  border: none;
90
  display: block;
91
  }
92
 
93
- /* ๋ Œ๋”๋ง๋œ ์ฝ˜ํ…์ธ ๊ฐ€ iframe ๋‚ด์—์„œ ์ „์ฒด ์˜์—ญ์„ ์‚ฌ์šฉํ•˜๋„๋ก */
 
94
  .html_content iframe html,
95
  .html_content iframe body {
96
  margin: 0;
@@ -100,7 +104,7 @@ body {
100
  overflow: auto;
101
  }
102
 
103
- /* ๋ Œ๋”๋ง ํ—ค๋” */
104
  .render_header {
105
  height: 30px;
106
  background: var(--neutral-100);
@@ -109,9 +113,7 @@ body {
109
  align-items: center;
110
  padding: 0 12px;
111
  gap: 6px;
112
- position: sticky;
113
- top: 0;
114
- z-index: 10;
115
  }
116
 
117
  .header_btn {
@@ -140,25 +142,41 @@ body {
140
  align-items: center;
141
  background: var(--surface);
142
  }
143
-
144
- /* ํƒญ ์ปจํ…์ธ ๊ฐ€ ์ „์ฒด ๋†’์ด๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก */
145
  .ant-tabs-content {
146
  height: 100%;
 
 
147
  }
148
 
149
  .ant-tabs-tabpane {
150
- height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
151
  }
152
 
153
- /* ๋กœ๋”ฉ ์ƒํƒœ์™€ ๋นˆ ์ƒํƒœ์˜ ์ปจํ…Œ์ด๋„ˆ */
154
  .ant-empty,
155
  .ant-spin-container {
156
- height: 100%;
157
  display: flex;
158
  justify-content: center;
159
  align-items: center;
160
  }
161
 
 
 
 
162
  .history_chatbot button {
163
  background: none;
164
  border: none;
@@ -378,26 +396,53 @@ function adjustIframeContent() {
378
  iframes.forEach(iframe => {
379
  try {
380
  iframe.onload = function() {
 
381
  const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
 
 
382
  const style = iframeDoc.createElement('style');
383
  style.textContent = `
384
  html, body {
385
  margin: 0;
386
  padding: 0;
387
- height: 100%;
388
  width: 100%;
389
  overflow: auto;
390
  }
 
 
 
 
391
  body > * {
392
- max-width: 100%;
393
  }
394
  `;
395
- iframeDoc.head.appendChild(style);
396
 
397
- const resizeObserver = new ResizeObserver(() => {
398
- iframe.style.height = '100%';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
399
  });
400
- resizeObserver.observe(iframe);
401
  };
402
  } catch (e) {
403
  console.error('iframe ์กฐ์ • ์ค‘ ์˜ค๋ฅ˜:', e);
@@ -405,49 +450,29 @@ function adjustIframeContent() {
405
  });
406
  }
407
 
408
- // ๋ฆฌ์‚ฌ์ด์ฆˆ ๊ธฐ๋Šฅ
409
  document.addEventListener('DOMContentLoaded', function() {
410
- const panel = document.querySelector('.right_panel');
411
- let isResizing = false;
412
- let startY;
413
- let startHeight;
414
-
415
- panel.addEventListener('mousedown', function(e) {
416
- if (e.offsetY > panel.offsetHeight - 6) {
417
- isResizing = true;
418
- startY = e.pageY;
419
- startHeight = panel.offsetHeight;
420
- document.body.style.cursor = 'ns-resize';
421
- }
422
- });
423
-
424
- document.addEventListener('mousemove', function(e) {
425
- if (!isResizing) return;
426
-
427
- const diff = e.pageY - startY;
428
- const newHeight = Math.max(400, Math.min(800, startHeight + diff));
429
- panel.style.height = `${newHeight}px`;
430
- });
431
-
432
- document.addEventListener('mouseup', function() {
433
- isResizing = false;
434
- document.body.style.cursor = '';
435
- });
436
-
437
- // ๋”๋ธ”ํด๋ฆญ์œผ๋กœ ํฌ๊ธฐ ํ† ๊ธ€
438
- panel.addEventListener('dblclick', function(e) {
439
- if (e.offsetY > panel.offsetHeight - 6) {
440
- if (panel.offsetHeight === 600) {
441
- panel.style.height = '800px';
442
- } else {
443
- panel.style.height = '600px';
444
  }
445
- }
 
 
 
 
 
446
  });
447
  });
448
 
449
- // ํŽ˜์ด์ง€ ๋กœ๋“œ ๋ฐ ๋™์  ์ฝ˜ํ…์ธ  ๋ณ€๊ฒฝ ์‹œ ์‹คํ–‰
450
- document.addEventListener('DOMContentLoaded', adjustIframeContent);
451
- const observer = new MutationObserver(adjustIframeContent);
452
- observer.observe(document.body, { childList: true, subtree: true });
 
 
453
  </script>
 
62
  color: var(--text-primary);
63
  }
64
 
 
65
  .right_panel {
66
  position: relative;
67
  height: 600px;
 
72
  margin: 20px;
73
  border-radius: 12px;
74
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
75
+ display: flex;
76
+ flex-direction: column;
77
  }
78
 
79
+ /* ์ˆ˜์ •๋œ HTML ์ฝ˜ํ…์ธ  ์˜์—ญ */
80
  .html_content {
81
+ flex: 1;
82
+ display: flex;
83
+ flex-direction: column;
84
  background: var(--surface);
85
  overflow: hidden;
86
  }
87
 
88
+ /* ์ˆ˜์ •๋œ iframe ์Šคํƒ€์ผ */
89
  .html_content iframe {
90
+ flex: 1;
91
  width: 100%;
 
92
  border: none;
93
  display: block;
94
  }
95
 
96
+
97
+ /* iframe ๋‚ด๋ถ€ ์Šคํƒ€์ผ์„ ์œ„ํ•œ ์ถ”๊ฐ€ */
98
  .html_content iframe html,
99
  .html_content iframe body {
100
  margin: 0;
 
104
  overflow: auto;
105
  }
106
 
107
+ /* ์ˆ˜์ •๋œ ๋ Œ๋”๋ง ํ—ค๋” */
108
  .render_header {
109
  height: 30px;
110
  background: var(--neutral-100);
 
113
  align-items: center;
114
  padding: 0 12px;
115
  gap: 6px;
116
+ flex-shrink: 0;
 
 
117
  }
118
 
119
  .header_btn {
 
142
  align-items: center;
143
  background: var(--surface);
144
  }
145
+ /* ์ˆ˜์ •๋œ ํƒญ ์ฝ˜ํ…์ธ  ์Šคํƒ€์ผ */
 
146
  .ant-tabs-content {
147
  height: 100%;
148
+ display: flex;
149
+ flex-direction: column;
150
  }
151
 
152
  .ant-tabs-tabpane {
153
+ flex: 1;
154
+ display: flex;
155
+ flex-direction: column;
156
+ }
157
+
158
+ /* ์ˆ˜์ •๋œ ์šฐ์ธก ์ฝ˜ํ…์ธ  ์Šคํƒ€์ผ */
159
+ .right_content {
160
+ flex: 1;
161
+ display: flex;
162
+ flex-direction: column;
163
+ justify-content: center;
164
+ align-items: center;
165
+ background: var(--surface);
166
  }
167
 
168
+ /* Empty์™€ Spin ์ปจํ…Œ์ด๋„ˆ ์ˆ˜์ • */
169
  .ant-empty,
170
  .ant-spin-container {
171
+ flex: 1;
172
  display: flex;
173
  justify-content: center;
174
  align-items: center;
175
  }
176
 
177
+
178
+
179
+
180
  .history_chatbot button {
181
  background: none;
182
  border: none;
 
396
  iframes.forEach(iframe => {
397
  try {
398
  iframe.onload = function() {
399
+ // iframe ๋‚ด๋ถ€ document ์ ‘๊ทผ
400
  const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
401
+
402
+ // ์Šคํƒ€์ผ ์š”์†Œ ์ƒ์„ฑ
403
  const style = iframeDoc.createElement('style');
404
  style.textContent = `
405
  html, body {
406
  margin: 0;
407
  padding: 0;
408
+ height: 100vh;
409
  width: 100%;
410
  overflow: auto;
411
  }
412
+ body {
413
+ display: flex;
414
+ flex-direction: column;
415
+ }
416
  body > * {
417
+ width: 100%;
418
  }
419
  `;
 
420
 
421
+ // ์Šคํƒ€์ผ ์ ์šฉ
422
+ if (iframeDoc.head) {
423
+ iframeDoc.head.appendChild(style);
424
+ }
425
+
426
+ // iframe ํฌ๊ธฐ ์กฐ์ •
427
+ function updateIframeSize() {
428
+ const content = iframeDoc.body;
429
+ if (content) {
430
+ iframe.style.height = '100%';
431
+ content.style.minHeight = '100%';
432
+ }
433
+ }
434
+
435
+ // ์ดˆ๊ธฐ ํฌ๊ธฐ ์„ค์ •
436
+ updateIframeSize();
437
+
438
+ // ResizeObserver๋กœ ํฌ๊ธฐ ๋ณ€ํ™” ๊ฐ์ง€
439
+ const resizeObserver = new ResizeObserver(updateIframeSize);
440
+ resizeObserver.observe(iframeDoc.body);
441
+
442
+ // iframe ๋‚ด๋ถ€ ์Šคํฌ๋กค ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ
443
+ iframeDoc.addEventListener('scroll', function(e) {
444
+ e.stopPropagation();
445
  });
 
446
  };
447
  } catch (e) {
448
  console.error('iframe ์กฐ์ • ์ค‘ ์˜ค๋ฅ˜:', e);
 
450
  });
451
  }
452
 
453
+ // ํŽ˜์ด์ง€ ๋กœ๋“œ ์‹œ ์‹คํ–‰
454
  document.addEventListener('DOMContentLoaded', function() {
455
+ adjustIframeContent();
456
+
457
+ // DOM ๋ณ€ํ™” ๊ฐ์ง€ํ•˜์—ฌ ์ƒˆ๋กœ์šด iframe์—๋„ ์ ์šฉ
458
+ const observer = new MutationObserver(function(mutations) {
459
+ mutations.forEach(function(mutation) {
460
+ if (mutation.addedNodes.length) {
461
+ adjustIframeContent();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
  }
463
+ });
464
+ });
465
+
466
+ observer.observe(document.body, {
467
+ childList: true,
468
+ subtree: true
469
  });
470
  });
471
 
472
+ // send_to_sandbox ํ•จ์ˆ˜ ์ˆ˜์ •
473
+ function send_to_sandbox(code) {
474
+ const encoded_html = btoa(unescape(encodeURIComponent(code)));
475
+ const data_uri = `data:text/html;base64,${encoded_html}`;
476
+ return `<div class="render_content"><iframe src="${data_uri}" style="width:100%;height:100%;border:none;"></iframe></div>`;
477
+ }
478
  </script>