Skip to content

on_change callback as seen in st.text_area #27

@Krastanov

Description

@Krastanov

Currently, if one needs to get the content of code editor as set by the user, modify it with some internal logic, and then return it in the same code editor, one has to rely on st.rerun() and manual state tracking.

However, many streamlit elements, like text_area provide on_change callbacks. Instead of checking the code_editor_dict and issuing a rerun, one simply registers a callback that is executed on a submit press.

Is such a feature possible for streamlit-code-editor?

This issue is superficially related to #12 but the solution shown there is not providing a callback, only an automated rerun.

Note: text_area's on_change is a misnomer -- it is more of an on_submit. It follows these semantics: https://docs.streamlit.io/develop/api-reference/caching-and-state/st.session_state#use-callbacks-to-update-session-state

The reason I am asking for this is that it will make it possible to change the session state after a submit but before a new render of the code editor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions