Added option to open links in the same tab for apps/bookamrs/search separately
This commit is contained in:
parent
0c3a27febd
commit
c03f302fa6
7 changed files with 50 additions and 13 deletions
|
@ -1 +1 @@
|
|||
REACT_APP_VERSION=1.5.1
|
||||
REACT_APP_VERSION=1.5.2
|
|
@ -16,7 +16,7 @@ const AppCard = (props: ComponentProps): JSX.Element => {
|
|||
return (
|
||||
<a
|
||||
href={redirectUrl}
|
||||
target={searchConfig('openSameTab', false) ? '' : '_blank'}
|
||||
target={searchConfig('appsSameTab', false) ? '' : '_blank'}
|
||||
rel='noreferrer'
|
||||
className={classes.AppCard}
|
||||
>
|
||||
|
|
|
@ -19,7 +19,7 @@ const BookmarkCard = (props: ComponentProps): JSX.Element => {
|
|||
return (
|
||||
<a
|
||||
href={redirectUrl}
|
||||
target={searchConfig('openSameTab', false) ? '' : '_blank'}
|
||||
target={searchConfig('bookmarksSameTab', false) ? '' : '_blank'}
|
||||
rel='noreferrer'
|
||||
key={`bookmark-${bookmark.id}`}>
|
||||
{bookmark.icon && (
|
||||
|
|
|
@ -36,7 +36,9 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
|
|||
hideCategories: 0,
|
||||
hideSearch: 0,
|
||||
useOrdering: 'createdAt',
|
||||
openSameTab: 0
|
||||
appsSameTab: 0,
|
||||
bookmarksSameTab: 0,
|
||||
searchSameTab: 0
|
||||
})
|
||||
|
||||
// Get config
|
||||
|
@ -50,7 +52,9 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
|
|||
hideCategories: searchConfig('hideCategories', 0),
|
||||
hideSearch: searchConfig('hideSearch', 0),
|
||||
useOrdering: searchConfig('useOrdering', 'createdAt'),
|
||||
openSameTab: searchConfig('openSameTab', 0)
|
||||
appsSameTab: searchConfig('appsSameTab', 0),
|
||||
bookmarksSameTab: searchConfig('bookmarksSameTab', 0),
|
||||
searchSameTab: searchConfig('searchSameTab', 0)
|
||||
})
|
||||
}, [props.loading]);
|
||||
|
||||
|
@ -139,18 +143,41 @@ const OtherSettings = (props: ComponentProps): JSX.Element => {
|
|||
</select>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<label htmlFor='openSameTab'>Open all links in the same tab</label>
|
||||
<label htmlFor='searchSameTab'>Open search results in the same tab</label>
|
||||
<select
|
||||
id='openSameTab'
|
||||
name='openSameTab'
|
||||
value={formData.openSameTab}
|
||||
id='searchSameTab'
|
||||
name='searchSameTab'
|
||||
value={formData.searchSameTab}
|
||||
onChange={(e) => inputChangeHandler(e, true)}
|
||||
>
|
||||
<option value={1}>True</option>
|
||||
<option value={0}>False</option>
|
||||
</select>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<label htmlFor='appsSameTab'>Open applications in the same tab</label>
|
||||
<select
|
||||
id='appsSameTab'
|
||||
name='appsSameTab'
|
||||
value={formData.appsSameTab}
|
||||
onChange={(e) => inputChangeHandler(e, true)}
|
||||
>
|
||||
<option value={1}>True</option>
|
||||
<option value={0}>False</option>
|
||||
</select>
|
||||
</InputGroup>
|
||||
<InputGroup>
|
||||
<label htmlFor='bookmarksSameTab'>Open bookmarks in the same tab</label>
|
||||
<select
|
||||
id='bookmarksSameTab'
|
||||
name='bookmarksSameTab'
|
||||
value={formData.bookmarksSameTab}
|
||||
onChange={(e) => inputChangeHandler(e, true)}
|
||||
>
|
||||
<option value={1}>True</option>
|
||||
<option value={0}>False</option>
|
||||
</select>
|
||||
</InputGroup>
|
||||
|
||||
{/* MODULES OPTIONS */}
|
||||
<h2 className={classes.SettingsSection}>Modules</h2>
|
||||
<InputGroup>
|
||||
|
|
|
@ -14,5 +14,7 @@ export interface SettingsForm {
|
|||
hideCategories: number;
|
||||
hideSearch: number;
|
||||
useOrdering: string;
|
||||
openSameTab: number;
|
||||
appsSameTab: number;
|
||||
bookmarksSameTab: number;
|
||||
searchSameTab: number;
|
||||
}
|
|
@ -11,7 +11,7 @@ export const searchParser = (searchQuery: string): boolean => {
|
|||
const query = queries.find((q: Query) => q.prefix === prefix);
|
||||
|
||||
if (query) {
|
||||
const sameTab = searchConfig('openSameTab', false);
|
||||
const sameTab = searchConfig('searchSameTab', false);
|
||||
|
||||
if (sameTab) {
|
||||
document.location.replace(`${query.template}${search}`);
|
||||
|
|
|
@ -37,7 +37,15 @@
|
|||
"value": "createdAt"
|
||||
},
|
||||
{
|
||||
"key": "openSameTab",
|
||||
"key": "appsSameTab",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"key": "bookmarksSameTab",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
"key": "searchSameTab",
|
||||
"value": false
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue