feat: Ctrl+S saves current tab (piano roll, section, audio) or project + all dirty tabs
This commit is contained in:
+37
-1
@@ -7383,7 +7383,43 @@ const App = () => {
|
||||
}
|
||||
if (ctrl && !alt && e.key === 's') {
|
||||
e.preventDefault();
|
||||
handleSaveProject();
|
||||
const curTab = activeTabRef.current;
|
||||
if (curTab === 'main') {
|
||||
// Main session: save project + save all dirty sub-tabs
|
||||
handleSaveProject();
|
||||
subTabsRef.current.filter(s => s.isDirty).forEach(st => {
|
||||
if (st.type === 'PIANO_ROLL') {
|
||||
handleSaveMidiNotes(st.id, st.trackId, st.target_id, st.notes || []);
|
||||
} else if (st.type === 'SECTION') {
|
||||
handleSaveSectionTab(st.id);
|
||||
} else if (st.buffer) {
|
||||
// Audio clip sub-tab: save buffer to track
|
||||
const subTrack = activeTracksRef.current.find(t => t.id === st.trackId);
|
||||
if (subTrack) {
|
||||
updateActiveTracks(prev => prev.map(t => t.id === st.trackId ? { ...t, buffer: st.buffer } : t));
|
||||
}
|
||||
}
|
||||
showToast('Đã lưu', 'success');
|
||||
});
|
||||
} else {
|
||||
// Sub-tab: save current tab
|
||||
const st = subTabsRef.current.find(s => s.id === curTab);
|
||||
if (st) {
|
||||
if (st.type === 'PIANO_ROLL') {
|
||||
handleSaveMidiNotes(st.id, st.trackId, st.target_id, st.notes || []);
|
||||
showToast('Đã lưu Piano Roll', 'success');
|
||||
} else if (st.type === 'SECTION') {
|
||||
handleSaveSectionTab(st.id);
|
||||
showToast('Đã lưu Section Tab', 'success');
|
||||
} else if (st.buffer) {
|
||||
const subTrack = activeTracksRef.current.find(t => t.id === st.trackId);
|
||||
if (subTrack) {
|
||||
updateActiveTracks(prev => prev.map(t => t.id === st.trackId ? { ...t, buffer: st.buffer } : t));
|
||||
}
|
||||
showToast('Đã lưu Audio Tab', 'success');
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!ctrl && !alt && e.key === 's') {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user