If detection of pressing a button is critical in your application, we can use a session variable to detect the first time the app started or the first time the session started.
import streamlit as st
from streamlit_ace import st_ace
if 'cnt' not in st.session_state:
st.session_state.cnt = 0
content = st_ace(language='sql', keybinding="vscode", value='initial value')
st.session_state.cnt += 1
if content:
if st.session_state.cnt > 1:
st.write('button is pressed')
else:
st.write('button is not pressed')
st.subheader('Content')
st.write(content)