Comments (8)
Hello @niyue,
Using Command + Enter
is indeed not supported currently due to how the component was implemented.
For your specific use case, you may try to create a streamlit button to manually apply/run your SQL query once you've finished inputting it.
from streamlit-ace.
Hi @Ghasel, thanks for the reply. I wonder how I can prevent the streamlit-ace component from automatically submit the query? I am not sure if this a question for streamlit in general or it is a specific streamlit-ace question, but currently it seems any typing in the ace component will trigger the refresh of the page, and I have no idea how to avoid this after checking out the options of the ace component.
from streamlit-ace.
Yes, for now there is no way to avoid the app to refresh when you input data with ace.
And from what you've said, I suppose each time the app refreshes, it runs your SQL query. As I said in my previous reply, instead of running your query each time the app reruns, you can run it only when you press a streamlit button, like so:
query = st_ace(language="sql")
if st.button("Run query"):
# Here is your logic to apply your SQL query
execute_query(query)
from streamlit-ace.
Thank you. I will give it a try.
from streamlit-ace.
Hello @niyue,
I've released a new version with an auto_update
parameter. By setting it to False
, you can use Command + Enter
to manually update Streamlit.
from streamlit-ace.
@Ghasel thanks for the update.
I gave it a try today, and found some issues, not really sure if I used it incorrect.
st_ace(
...
min_lines=st.sidebar.slider("Min lines", value=10),
# max_lines=st.sidebar.slider("Max lines", value=20),
key="ace-editor",
auto_update=False,
)
I added the auto_update
parameter and set it to False
, but I found:
- the prompt under the editor is
Press Ctrl+Enter to apply
while I use Safari under macOS, which I expect it to bePress Cmd+Enter to apply
like regular text box - When I use
vim
oremacs
keybindings, it works when I pressCmd + Enter
, and the change is applied as expected - When I use
vscode
orsublime
keybindings, and pressCmd + Enter
, the change is not applied, instead, it works likeEnter
is pressed and a new line is inserted into the editor - Whatever keybinding I use,
Ctrl + Enter
doesn't work (and I assume it is not expected to work but the prompt is not correct as I said in issue no. 1)
from streamlit-ace.
@niyue Thanks for those details! Everything should work now with the version 0.0.3.
from streamlit-ace.
i have try to use auto_update parameters, but it still not work, do you have method to hide the submit button?
from streamlit-ace.
Related Issues (20)
- Require either `streamlit` OR `streamlit-nightly` to avoid conflicts HOT 1
- Customise width and height HOT 2
- trouble loading the streamlit_ace.ace component HOT 10
- Default Text? HOT 1
- Is there a way to print the output of the code defined in value? HOT 1
- Loading a file into the Editor HOT 1
- Missing on_change parameter, key doesn't work as expected HOT 2
- Can't input code properly into st.ace editor. HOT 1
- demo is broken HOT 1
- scroll bar to be added
- Can it support to keep displaying the information from a file which keeps changing? HOT 1
- Getting inputs and output the result of the code. HOT 2
- Missing documentation on assigning markers (and annotations) HOT 1
- How to reset state of code editor? HOT 2
- what does the apply button do? HOT 3
- Expose autocompletion settings
- Add more examples to understand it.
- Component does not render on iOS devices HOT 3
- Component should not have a submit button HOT 2
- Can it run/compiled when it run? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from streamlit-ace.