refactor: move presets into function

add-more-languages
Meng Zhang 2023-04-03 23:35:03 +08:00
parent 59bbe0391b
commit c358859e28
1 changed files with 3 additions and 3 deletions

View File

@ -39,14 +39,14 @@ class User:
}
def code_editor():
def code_presets():
code = ""
cols = st.columns(len(SNIPPETS))
for col, (k, v) in zip(cols, SNIPPETS.items()):
with col:
if st.button(k):
code = v
monaco.st_monaco(key="default", code=code)
return code
code_editor()
monaco.st_monaco(key="default", code=code_presets())