Merge pull request #223 from Dejan-Port/fix-web-edit-loss

fix: Save toolbar button and saveChanges dialog discard an in-progress cell edit
This commit is contained in:
Brandon Thomas 2026-10-11 11:23:30 -04:00
commit 96af804cb5
2 changed files with 6 additions and 2 deletions

View File

@ -810,7 +810,8 @@ pub fn show(app: &mut SheetApp, ctx: &egui::Context) {
if ui.button("Cancel").clicked() {
open = false;
}
if ui.button("Save").clicked() {
// File operations must include the cell the user is still editing (as the File > Save menu item already does).
if ui.button("Save").clicked() && app.commit_edit(0, 0, false, false) {
app.run_or_alert("file.save", json!({}));
if app.session.active().is_some_and(|x| !x.is_dirty()) {
app.run_or_alert("file.close", json!({"force": true}));

View File

@ -44,7 +44,10 @@ pub fn title_bar(app: &mut SheetApp, ui: &mut Ui) {
if icon_button(ui, Icon::Home, t.text_dim, "Home", vec2(26.0, 26.0)).clicked() {
app.open_dialog("start", json!({}));
}
if icon_button(ui, Icon::Save, t.text_dim, "Save (⌘S)", vec2(26.0, 26.0)).clicked() {
if icon_button(ui, Icon::Save, t.text_dim, "Save (⌘S)", vec2(26.0, 26.0)).clicked()
// File operations must include the cell the user is still editing (as the File > Save menu item already does).
&& app.commit_edit(0, 0, false, false)
{
app.run_or_alert("file.save", json!({}));
}
let can_undo = app.session.active().is_some_and(|d| !d.undo.is_empty());