Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix Pro

sytolka772f354f38d
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 52f5b5dce..787998c46 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -83,10 +83,6 @@ import useEventListener from '-/utils/useEventListener';
import { TS } from '-/tagspaces.namespace';
import FileView from '-/components/FileView';
import { Pro } from '-/pro';
-import {
- historyKeys,
- saveHistory
-} from '../../extensions/tagspacespro/modules/history';
const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
@@ -180,6 +176,8 @@ interface Props {
currentLocationId: string;
}
+const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
+
function EntryContainer(props: Props) {
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
@@ -499,7 +497,7 @@ function EntryContainer(props: Props) {
NotificationTypes.default
);
if (Pro) {
- saveHistory(
+ Pro.histroy.saveHistory(
historyKeys.fileEditKey,
openedFile.path,
openedFile.url,
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index ce511d7cb..528c240d8 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -49,12 +49,6 @@ import { actions as SearchActions, getSearches } from '-/reducers/searches';
import { TS } from '-/tagspaces.namespace';
import SearchMenu from '-/components/menus/SearchMenu';
import { actions as AppActions, getCurrentLocationId } from '-/reducers/app';
-import {
- delAllHistory,
- delHistory,
- getHistory,
- historyKeys
-} from '../../extensions/tagspacespro/modules/history';
import { getAllPropertiesPromise } from '-/services/utils-io';
import { Tooltip } from '@mui/material';
import {
@@ -83,6 +77,7 @@ interface Props {
}
const SaveSearchDialog = Pro && Pro.UI ? Pro.UI.SaveSearchDialog : false;
+const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
function StoredSearches(props: Props) {
const [saveSearchDialogOpened, setSaveSearchDialogOpened] = useState<
@@ -172,15 +167,15 @@ function StoredSearches(props: Props) {
const { reduceHeightBy, classes } = props;
- const fileOpenHistoryItems: Array<TS.HistoryItem> = getHistory(
- historyKeys.fileOpenKey
- );
- const fileEditHistoryItems: Array<TS.HistoryItem> = getHistory(
- historyKeys.fileEditKey
- );
- const folderOpenHistoryItems: Array<TS.HistoryItem> = getHistory(
- historyKeys.folderOpenKey
- );
+ const fileOpenHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.fileOpenKey)
+ : undefined;
+ const fileEditHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.fileEditKey)
+ : undefined;
+ const folderOpenHistoryItems: Array<TS.HistoryItem> = Pro
+ ? Pro.history.getHistory(historyKeys.folderOpenKey)
+ : undefined;
const renderHistory = (historyKey, items: Array<TS.HistoryItem>) => (
<Grid container direction="row">
@@ -250,9 +245,14 @@ function StoredSearches(props: Props) {
</Grid>
<Grid item xs={2} style={{ display: 'flex' }}>
<IconButton
- aria-label={i18n.t('core:searchEditBtn')}
+ aria-label={i18n.t('core:deleteHistory')}
onClick={() => {
- delHistory(historyKey, history.creationTimeStamp);
+ if (Pro) {
+ Pro.history.delHistory(
+ historyKey,
+ history.creationTimeStamp
+ );
+ }
forceUpdate();
}}
data-tid="editSearchTID"
@@ -476,7 +476,9 @@ function StoredSearches(props: Props) {
onClose={() => setHistoryMenuAnchorEl(null)}
refreshHistory={() => forceUpdate()}
clearAll={() => {
- delAllHistory(menuHistoryKey.current); //historyKeys.fileOpenKey);
+ if (Pro) {
+ Pro.history.delAllHistory(menuHistoryKey.current);
+ } //historyKeys.fileOpenKey);
forceUpdate();
}}
/>
diff --git a/app/components/dialogs/settings/SettingsAdvanced.tsx b/app/components/dialogs/settings/SettingsAdvanced.tsx
index 24d725c82..12f79e22e 100644
--- a/app/components/dialogs/settings/SettingsAdvanced.tsx
+++ b/app/components/dialogs/settings/SettingsAdvanced.tsx
@@ -46,7 +46,6 @@ import MapTileServerDialog from '-/components/dialogs/settings/MapTileServerDial
import { Pro } from '-/pro';
import { ProLabel } from '-/components/HelperComponents';
import InfoIcon from '-/components/InfoIcon';
-import { historyKeys } from '../../../../extensions/tagspacespro/modules/history';
const styles: any = {
root: {
@@ -80,6 +79,8 @@ interface Props {
setHistory: (key: string, value: number) => void;
}
+const historyKeys = Pro && Pro.history ? Pro.history.historyKeys : {};
+
function SettingsAdvanced(props: Props) {
const [tileServerDialog, setTileServerDialog] = useState<any>(undefined);
@@ -148,57 +149,65 @@ function SettingsAdvanced(props: Props) {
checked={props.settings.warningOpeningFilesExternally}
/>
</ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:fileOpenHistory')} />
- <Select
- data-tid="fileOpenTID"
- title={i18n.t('core:fileOpenHistoryTitle')}
- value={props.settings[historyKeys.fileOpenKey]}
- onChange={(event: any) =>
- props.setHistory(historyKeys.fileOpenKey, event.target.value)
- }
- input={<Input id="fileOpenSelector" />}
- >
- <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
- <MenuItem value={10}>10</MenuItem>
- <MenuItem value={50}>50</MenuItem>
- <MenuItem value={100}>100</MenuItem>
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:folderOpenHistory')} />
- <Select
- data-tid="folderOpenTID"
- title={i18n.t('core:folderOpenHistoryTitle')}
- value={props.settings[historyKeys.folderOpenKey]}
- onChange={(event: any) =>
- props.setHistory(historyKeys.folderOpenKey, event.target.value)
- }
- input={<Input id="folderOpenSelector" />}
- >
- <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
- <MenuItem value={10}>10</MenuItem>
- <MenuItem value={50}>50</MenuItem>
- <MenuItem value={100}>100</MenuItem>
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:fileEditHistory')} />
- <Select
- data-tid="fileEditTID"
- title={i18n.t('core:fileEditHistoryTitle')}
- value={props.settings[historyKeys.fileEditKey]}
- onChange={(event: any) =>
- props.setHistory(historyKeys.fileEditKey, event.target.value)
- }
- input={<Input id="fileEditSelector" />}
- >
- <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
- <MenuItem value={10}>10</MenuItem>
- <MenuItem value={50}>50</MenuItem>
- <MenuItem value={100}>100</MenuItem>
- </Select>
- </ListItem>
+ {Pro && (
+ <>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:fileOpenHistory')} />
+ <Select
+ data-tid="fileOpenTID"
+ title={i18n.t('core:fileOpenHistoryTitle')}
+ value={props.settings[historyKeys.fileOpenKey]}
+ onChange={(event: any) =>
+ props.setHistory(historyKeys.fileOpenKey, event.target.value)
+ }
+ input={<Input id="fileOpenSelector" />}
+ >
+ <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
+ <MenuItem value={10}>10</MenuItem>
+ <MenuItem value={50}>50</MenuItem>
+ <MenuItem value={100}>100</MenuItem>
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:folderOpenHistory')} />
+ <Select
+ data-tid="folderOpenTID"
+ title={i18n.t('core:folderOpenHistoryTitle')}
+ value={props.settings[historyKeys.folderOpenKey]}
+ onChange={(event: any) =>
+ props.setHistory(
+ historyKeys.folderOpenKey,
+ event.target.value
+ )
+ }
+ input={<Input id="folderOpenSelector" />}
+ >
+ <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
+ <MenuItem value={10}>10</MenuItem>
+ <MenuItem value={50}>50</MenuItem>
+ <MenuItem value={100}>100</MenuItem>
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:fileEditHistory')} />
+ <Select
+ data-tid="fileEditTID"
+ title={i18n.t('core:fileEditHistoryTitle')}
+ value={props.settings[historyKeys.fileEditKey]}
+ onChange={(event: any) =>
+ props.setHistory(historyKeys.fileEditKey, event.target.value)
+ }
+ input={<Input id="fileEditSelector" />}
+ >
+ <MenuItem value={0}>{i18n.t('core:disabled')}</MenuItem>
+ <MenuItem value={10}>10</MenuItem>
+ <MenuItem value={50}>50</MenuItem>
+ <MenuItem value={100}>100</MenuItem>
+ </Select>
+ </ListItem>
+ </>
+ )}
+
<ListItem className={classes.listItem}>
<ListItemText
primary={
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 338d63907..c0a394109 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -64,10 +64,6 @@ import {
} from '-/reducers/settings';
import { TS } from '-/tagspaces.namespace';
import { PerspectiveIDs } from '-/perspectives';
-import {
- historyKeys,
- saveHistory
-} from '../../extensions/tagspacespro/modules/history';
export const types = {
DEVICE_ONLINE: 'APP/DEVICE_ONLINE',
@@ -1875,8 +1871,9 @@ export const actions = {
* save in history
*/
if (Pro) {
+ const historyKeys = Pro.history.historyKeys;
if (fsEntry.isFile) {
- saveHistory(
+ Pro.history.saveHistory(
historyKeys.fileOpenKey,
fsEntry.path,
entryForOpening.url
@@ -1886,7 +1883,7 @@ export const actions = {
getState().settings[historyKeys.fileOpenKey]
);
} else {
- saveHistory(
+ Pro.history.saveHistory(
historyKeys.folderOpenKey,
fsEntry.path,
entryForOpening.url