-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to reset state of code editor? #42
Comments
hmmm... I changed by reset button to increment counter linked to import streamlit as st
from streamlit_ace import st_ace
LANGUAGE = "yaml"
THEME = "twilight"
if 'state' not in st.session_state:
st.session_state.state = 0
reset = st.button("Reset!")
if reset:
st.session_state.state += 1
print(st.session_state.state)
content = st_ace(
placeholder="# Paste your manifest here",
language=LANGUAGE,
theme=THEME,
font_size=14,
tab_size=4,
min_lines=45,
auto_update=True,
key=f"ace-{st.session_state.state}",
)
if content:
st.subheader("Content")
st.code(content, language=LANGUAGE) |
I would also like to see a built-in fix for this problem, since i also tried to solve how to update the content of the editor. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am wondering how I could reset state of the editor. I found that I could set initial text with
value
key but updating it later does not seem to change anything. Here is my attemptThe text was updated successfully, but these errors were encountered: