mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 16:36:00 +00:00
unsaved file marker
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { openedTabs } from '../stores';
|
||||
import { getOpenedTabs, openedTabs } from '../stores';
|
||||
import _ from 'lodash';
|
||||
import getElectron from './getElectron';
|
||||
|
||||
@@ -18,6 +18,16 @@ export function changeTab(tabid, changeFunc) {
|
||||
openedTabs.update(files => files.map(tab => (tab.tabid == tabid ? changeFunc(tab) : tab)));
|
||||
}
|
||||
|
||||
export function markTabUnsaved(tabid) {
|
||||
const tab = getOpenedTabs().find(x => x.tabid == tabid);
|
||||
if (tab.unsaved) return;
|
||||
openedTabs.update(files => files.map(tab => (tab.tabid == tabid ? { ...tab, unsaved: true } : tab)));
|
||||
}
|
||||
|
||||
export function markTabSaved(tabid) {
|
||||
openedTabs.update(files => files.map(tab => (tab.tabid == tabid ? { ...tab, unsaved: false } : tab)));
|
||||
}
|
||||
|
||||
export function setSelectedTabFunc(files, tabid) {
|
||||
return [
|
||||
...(files || []).filter(x => x.tabid != tabid).map(x => ({ ...x, selected: false })),
|
||||
|
||||
Reference in New Issue
Block a user