From 587cb2be1433d5e0e34adaa331d6b524722f26e3 Mon Sep 17 00:00:00 2001 From: cardosofede Date: Thu, 3 Aug 2023 18:24:57 +0200 Subject: [PATCH] (feat) move hotkey to editor --- pages/bot_orchestration/app.py | 1 - ui_components/editor.py | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/bot_orchestration/app.py b/pages/bot_orchestration/app.py index 65f7944..1c97f15 100644 --- a/pages/bot_orchestration/app.py +++ b/pages/bot_orchestration/app.py @@ -208,7 +208,6 @@ with manage: with elements("bot_config"): with mui.Paper(elevation=3, style={"padding": "2rem"}, spacing=[2, 2], container=True): mui.Typography("đź—‚Files Management", variant="h3", sx={"margin-bottom": "2rem"}) - event.Hotkey("ctrl+s", sync(), bindInputs=True, overrideDefault=True) with w.dashboard(): w.file_explorer() w.editor() diff --git a/ui_components/editor.py b/ui_components/editor.py index be24976..5e825ed 100644 --- a/ui_components/editor.py +++ b/ui_components/editor.py @@ -1,6 +1,6 @@ from functools import partial import streamlit as st -from streamlit_elements import mui, editor, sync, lazy +from streamlit_elements import mui, editor, sync, lazy, event from utils.os_utils import save_file from .dashboard import Dashboard @@ -87,4 +87,5 @@ class Editor(Dashboard.Item): with mui.Stack(direction="row", spacing=2, alignItems="center", sx={"padding": "10px"}): mui.Button("Apply", variant="contained", onClick=sync()) + event.Hotkey("ctrl+s", sync(), bindInputs=True, overrideDefault=True) mui.Typography("Or press ctrl+s", sx={"flex": 1})