Update app.py
Browse files
app.py
CHANGED
|
@@ -115,14 +115,23 @@ if generate_scenario_button:
|
|
| 115 |
|
| 116 |
if scenario_result:
|
| 117 |
st.subheader("시나리오 결과")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
scenario_output_area.markdown(scenario_result, unsafe_allow_html=True) # markdown 형식으로 출력
|
| 119 |
|
| 120 |
-
# JavaScript를 사용한 복사 기능 구현 (선택 및 복사는 사용자가 직접 해야 함)
|
| 121 |
copy_button = f"""
|
| 122 |
-
<button onclick="copy_to_clipboard(
|
| 123 |
<script>
|
| 124 |
-
function copy_to_clipboard(
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
alert("시나리오가 복사되었습니다!");
|
| 127 |
}}
|
| 128 |
</script>
|
|
|
|
| 115 |
|
| 116 |
if scenario_result:
|
| 117 |
st.subheader("시나리오 결과")
|
| 118 |
+
temp_div = f"""
|
| 119 |
+
<div id="temp_copy_div" style="display:none;">{scenario_result}</div>
|
| 120 |
+
"""
|
| 121 |
+
st.markdown(temp_div, unsafe_allow_html=True) # hidden div for copy
|
| 122 |
scenario_output_area.markdown(scenario_result, unsafe_allow_html=True) # markdown 형식으로 출력
|
| 123 |
|
|
|
|
| 124 |
copy_button = f"""
|
| 125 |
+
<button onclick="copy_to_clipboard()">📄 시나리오 복사</button>
|
| 126 |
<script>
|
| 127 |
+
function copy_to_clipboard() {{
|
| 128 |
+
var text = document.getElementById('temp_copy_div').innerText;
|
| 129 |
+
var elem = document.createElement('textarea');
|
| 130 |
+
elem.value = text;
|
| 131 |
+
document.body.appendChild(elem);
|
| 132 |
+
elem.select();
|
| 133 |
+
document.execCommand('copy');
|
| 134 |
+
document.body.removeChild(elem);
|
| 135 |
alert("시나리오가 복사되었습니다!");
|
| 136 |
}}
|
| 137 |
</script>
|