Skip to content

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

chore: integration of the text field component with copy and paste context menu (#2188)

Ilianafea47987c05
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsx
index 8068f3029..53fa24c66 100644
--- a/src/renderer/components/EntryProperties.tsx
+++ b/src/renderer/components/EntryProperties.tsx
@@ -82,6 +82,7 @@ import { TS } from '-/tagspaces.namespace';
import NoTileServer from '-/components/NoTileServer';
import { ProTooltip } from '-/components/HelperComponents';
import PerspectiveSelector from '-/components/PerspectiveSelector';
+import TsTextField from '-/components/TsTextField';
import FormHelperText from '@mui/material/FormHelperText';
import LinkGeneratorDialog from '-/components/dialogs/LinkGeneratorDialog';
import { useTranslation } from 'react-i18next';
@@ -568,12 +569,11 @@ function EntryProperties(props: Props) {
<Root>
<Grid container>
<Grid item xs={12}>
- <TextField
+ <TsTextField
error={fileNameError.current}
label={
openedEntry.isFile ? t('core:fileName') : t('core:folderName')
}
- variant="filled"
InputProps={{
readOnly: editName === undefined,
endAdornment: (
@@ -614,13 +614,12 @@ function EntryProperties(props: Props) {
</InputAdornment>
),
}}
- margin="dense"
name="name"
size={desktopMode ? 'small' : 'medium'}
- fullWidth={true}
data-tid="fileNameProperties"
defaultValue={entryName} // openedEntry.current.name}
inputRef={fileNameRef}
+ retrieveValue={() => fileNameRef.current.value}
onClick={() => {
if (!isEditMode && editName === undefined) {
activateEditNameField();
@@ -761,13 +760,11 @@ function EntryProperties(props: Props) {
<Grid container item xs={12} spacing={1}>
<Grid item xs={12}>
- <TextField
- margin="dense"
- variant="filled"
- fullWidth={true}
+ <TsTextField
size={desktopMode ? 'small' : 'medium'}
value={ldtm}
label={t('core:fileLDTM')}
+ retrieveValue={() => ldtm}
InputProps={{
readOnly: true,
}}
@@ -790,11 +787,9 @@ function EntryProperties(props: Props) {
t('core:files')
}
>
- <TextField
- margin="dense"
- fullWidth={true}
+ <TsTextField
value={fileSize()}
- variant="filled"
+ retrieveValue={() => fileSize()}
size={desktopMode ? 'small' : 'medium'}
label={t('core:fileSize')}
InputProps={{
@@ -822,16 +817,14 @@ function EntryProperties(props: Props) {
<Grid item xs={12}>
<FormControl fullWidth={true} className={classes.formControl}>
- <TextField
- margin="dense"
+ <TsTextField
name="path"
- variant="filled"
title={openedEntry.url || openedEntry.path}
- fullWidth={true}
label={isCloudLocation ? t('cloudPath') : t('core:filePath')}
size={desktopMode ? 'small' : 'medium'}
data-tid="filePathProperties"
value={openedEntry.path || ''}
+ retrieveValue={() => openedEntry.path}
InputProps={{
readOnly: true,
// startAdornment: (
@@ -874,14 +867,11 @@ function EntryProperties(props: Props) {
justifyContent="center"
>
<Grid item xs={12}>
- <TextField
+ <TsTextField
data-tid="sharingLinkTID"
- margin="dense"
- variant="filled"
name="sharinglink"
size={desktopMode ? 'small' : 'medium'}
label={<>{t('core:sharingLink')}</>}
- fullWidth={true}
value={sharingLink}
inputRef={sharingLinkRef}
InputProps={{
@@ -924,13 +914,10 @@ function EntryProperties(props: Props) {
</Grid>
{showLinkForDownloading && (
<Grid item xs={12}>
- <TextField
- margin="dense"
+ <TsTextField
name="downloadLink"
- variant="filled"
size={desktopMode ? 'small' : 'medium'}
label={<>{t('core:downloadLink')}</>}
- fullWidth
value={' '}
InputProps={{
readOnly: true,
@@ -971,12 +958,9 @@ function EntryProperties(props: Props) {
{!openedEntry.isFile && (
<Grid item xs={12} style={{ marginTop: 5 }}>
- <TextField
- margin="dense"
+ <TsTextField
name="path"
- variant="filled"
label={<>{t('core:backgroundColor')}</>}
- fullWidth
InputProps={{
readOnly: true,
startAdornment: (
@@ -1192,15 +1176,13 @@ function EntryProperties(props: Props) {
justifyContent="center"
>
<Grid item xs={12}>
- <TextField
+ <TsTextField
data-tid="entryIDTID"
- margin="dense"
name="entryid"
- variant="filled"
size={desktopMode ? 'small' : 'medium'}
label={t('core:entryId')}
- fullWidth={true}
value={openedEntry?.meta?.id}
+ retrieveValue={() => openedEntry?.meta?.id}
InputProps={{
readOnly: true,
// startAdornment: (
diff --git a/src/renderer/components/PerspectiveSelector.tsx b/src/renderer/components/PerspectiveSelector.tsx
index a46a23b13..fea202c92 100644
--- a/src/renderer/components/PerspectiveSelector.tsx
+++ b/src/renderer/components/PerspectiveSelector.tsx
@@ -21,7 +21,7 @@ import { useSelector } from 'react-redux';
import ListItemIcon from '@mui/material/ListItemIcon';
import LayersClearIcon from '@mui/icons-material/LayersClear';
import ListItemText from '@mui/material/ListItemText';
-import TextField from '@mui/material/TextField';
+import TsTextField from '-/components/TsTextField';
import MenuItem from '@mui/material/MenuItem';
import { AvailablePerspectives, PerspectiveIDs } from '-/perspectives';
import { Pro } from '-/pro';
@@ -80,18 +80,16 @@ function PerspectiveSelector(props: Props) {
});
return (
- <TextField
+ <TsTextField
data-tid={testId}
defaultValue={defaultValue}
- variant="filled"
onChange={onChange}
select
label={label}
- fullWidth
size={desktopMode ? 'small' : 'medium'}
>
{perspectiveSelectorMenuItems}
- </TextField>
+ </TsTextField>
);
}
diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsx
index ce40709d5..070ff265a 100644
--- a/src/renderer/components/SearchAutocomplete.tsx
+++ b/src/renderer/components/SearchAutocomplete.tsx
@@ -44,7 +44,7 @@ import { TS } from '-/tagspaces.namespace';
import { Pro } from '-/pro';
import SavedSearchesMenu from '-/components/menus/SavedSearchesMenu';
import AppConfig from '-/AppConfig';
-import { Autocomplete, Box, TextField } from '@mui/material';
+import { Autocomplete, Box } from '@mui/material';
import {
accuracy,
ActionType,
@@ -62,6 +62,7 @@ import {
import CloseIcon from '@mui/icons-material/Close';
import { getTagLibrary } from '-/services/taglibrary-utils';
import { getSearchOptions } from '-/components/SearchOptionsMenu';
+import TsTextField from '-/components/TsTextField';
import { dataTidFormat } from '-/services/test';
import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
@@ -1455,7 +1456,7 @@ function SearchAutocomplete(props: Props) {
params.InputProps.endAdornment = [endAdornment];
}
return (
- <TextField
+ <TsTextField
{...params}
style={{ overflow: 'auto', maxHeight: 40 }}
onBlur={() => {
@@ -1466,12 +1467,10 @@ function SearchAutocomplete(props: Props) {
isOpen.current = true;
forceUpdate();
}}
- fullWidth
autoFocus
placeholder={t('core:searchTitle')}
size="small"
- margin="dense"
- variant="outlined"
+ // variant="outlined"
/>
);
}}
diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
index 23d914f8a..9af737cbb 100644
--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
@@ -35,7 +35,7 @@ import List from '@mui/material/List';
import ListItem from '@mui/material/ListItem';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
-import TextField from '@mui/material/TextField';
+import TsTextField from '-/components/TsTextField';
import Input from '@mui/material/Input';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import ToggleButton from '@mui/material/ToggleButton';
@@ -631,9 +631,9 @@ function CreateEditLocationDialog(props: Props) {
<AccordionDetails style={{ paddingTop: 16 }}>
<FormGroup>
<FormControl disabled={disableLocationTypeSwitch} fullWidth>
- <InputLabel id="locationLabelID">
+ {/* <InputLabel id="locationLabelID">
{t('core:locationType')}
- </InputLabel>
+ </InputLabel> */}
<Select
labelId="locationLabelID"
data-tid="locationTypeTID"
@@ -642,6 +642,7 @@ function CreateEditLocationDialog(props: Props) {
onChange={(event: ChangeEvent<HTMLInputElement>) =>
setType(event.target.value)
}
+ variant="filled"
>
{!AppConfig.isWeb && (
<MenuItem
@@ -977,10 +978,8 @@ function CreateEditLocationDialog(props: Props) {
/>
)}
<FormControl fullWidth={true}>
- <TextField
- margin="dense"
+ <TsTextField
name="autoOpenedFilename"
- fullWidth={true}
data-tid="autoOpenedFilenameTID"
placeholder={
t('core:forExample') + ': index.md, index.html or readme.md'
@@ -988,6 +987,10 @@ function CreateEditLocationDialog(props: Props) {
onChange={(event) =>
setAutoOpenedFilename(event.target.value)
}
+ updateValue={(value) => {
+ setAutoOpenedFilename(value);
+ }}
+ retrieveValue={() => autoOpenedFilename}
value={autoOpenedFilename}
label={t('core:autoOpenedFilename')}
/>
@@ -1060,16 +1063,17 @@ function CreateEditLocationDialog(props: Props) {
)}
</>
<FormControl fullWidth={true} style={{ marginTop: 10 }}>
- <TextField
+ <TsTextField
required
- margin="dense"
name="newuuid"
- fullWidth={true}
data-tid="newuuid"
placeholder="Unique location identifier"
onChange={(event) => setNewLocationID(event.target.value)}
value={newuuid}
label={t('core:locationId')}
+ updateValue={(value) => {
+ setNewLocationID(value);
+ }}
InputProps={{
endAdornment: (
<InputAdornment position="end" style={{ height: 32 }}>
@@ -1112,16 +1116,18 @@ function CreateEditLocationDialog(props: Props) {
<AccordionDetails>
<FormControl fullWidth={true}>
<FormLabel>{t('encryptionExplanation')}</FormLabel>
- <TextField
- margin="dense"
+ <TsTextField
name="encryptionKey"
type={showEncryptionKey ? 'text' : 'password'}
- fullWidth={true}
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
data-tid="encryptionKeyTID"
placeholder={t('encryptionKeyExplanation')}
onChange={(event) => setEncryptionKey(event.target.value)}
value={encryptionKey}
+ updateValue={(value) => {
+ setEncryptionKey(value);
+ }}
+ retrieveValue={() => encryptionKey}
label={t('core:encryptionKey')}
InputProps={{
endAdornment: (
diff --git a/src/renderer/components/dialogs/CreateTagGroupDialog.tsx b/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
index 11691a544..54f650598 100644
--- a/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
+++ b/src/renderer/components/dialogs/CreateTagGroupDialog.tsx
@@ -19,7 +19,6 @@
import React, { ChangeEvent, useReducer, useRef, useState } from 'react';
import { useSelector } from 'react-redux';
import Button from '@mui/material/Button';
-import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
@@ -33,6 +32,7 @@ import TransparentBackground from '../TransparentBackground';
import { TS } from '-/tagspaces.namespace';
import { getSaveTagInLocation } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import TsTextField from '-/components/TsTextField';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { useTranslation } from 'react-i18next';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
@@ -193,8 +193,7 @@ function CreateTagGroupDialog(props: Props) {
</DialogTitle>
<DialogContent style={{ paddingTop: 10 }}>
<FormControl fullWidth={true} error={inputError}>
- <TextField
- fullWidth={true}
+ <TsTextField
error={inputError}
autoFocus
name="title"
diff --git a/src/renderer/components/dialogs/CreateTagsDialog.tsx b/src/renderer/components/dialogs/CreateTagsDialog.tsx
index c5fe219e0..11d1756bd 100644
--- a/src/renderer/components/dialogs/CreateTagsDialog.tsx
+++ b/src/renderer/components/dialogs/CreateTagsDialog.tsx
@@ -18,13 +18,13 @@
import React, { useEffect, useState } from 'react';
import Button from '@mui/material/Button';
-import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import Dialog from '@mui/material/Dialog';
+import TsTextField from '-/components/TsTextField';
import useFirstRender from '-/utils/useFirstRender';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -103,7 +103,7 @@ function CreateTagsDialog(props: Props) {
</DialogTitle>
<DialogContent style={{ minWidth: 350, paddingTop: 10 }}>
<FormControl fullWidth={true} error={inputError}>
- <TextField
+ <TsTextField
error={inputError}
name="tagTitle"
autoFocus
@@ -111,7 +111,6 @@ function CreateTagsDialog(props: Props) {
onChange={handleTagTitleChange}
value={tagTitle}
data-tid="addTagsInput"
- fullWidth={true}
/>
{inputError && (
<FormHelperText>{t('core:tagTitleHelper')}</FormHelperText>
diff --git a/src/renderer/components/dialogs/DownloadUrlDialog.tsx b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
index 9da812310..90f0ddc19 100644
--- a/src/renderer/components/dialogs/DownloadUrlDialog.tsx
+++ b/src/renderer/components/dialogs/DownloadUrlDialog.tsx
@@ -29,11 +29,11 @@ import useMediaQuery from '@mui/material/useMediaQuery';
import TargetPath from '-/components/dialogs/components/TargetPath';
import { TargetPathContextProvider } from '-/components/dialogs/hooks/TargetPathContextProvider';
import { useTranslation } from 'react-i18next';
-import TextField from '@mui/material/TextField';
import Button from '@mui/material/Button';
import DialogActions from '@mui/material/DialogActions';
import AppConfig from '-/AppConfig';
import { actions as AppActions, AppDispatch } from '-/reducers/app';
+import TsTextField from '-/components/TsTextField';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
import { useNotificationContext } from '-/hooks/useNotificationContext';
@@ -170,7 +170,7 @@ function DownloadUrlDialog(props: Props) {
scroll="paper"
>
<DialogTitle style={{ cursor: 'move' }} id="draggable-dialog-title">
- {t('core:downloadFile')}
+ {t('core:downloadLink')}
<DialogCloseButton
testId="closeCreateDialogTID"
onClose={() => onClose()}
@@ -185,13 +185,11 @@ function DownloadUrlDialog(props: Props) {
}}
data-tid="downloadUrlDialogTID"
>
- <TextField
+ <TsTextField
error={invalidURL}
label={t('core:url')}
autoFocus
- margin="dense"
name="name"
- fullWidth={true}
data-tid="newUrlTID"
onKeyDown={(event) => {
if (event.key === 'Enter') {
diff --git a/src/renderer/components/dialogs/EditTagDialog.tsx b/src/renderer/components/dialogs/EditTagDialog.tsx
index dfc307096..3120c8ad6 100644
--- a/src/renderer/components/dialogs/EditTagDialog.tsx
+++ b/src/renderer/components/dialogs/EditTagDialog.tsx
@@ -18,7 +18,6 @@
import React, { useEffect, useState } from 'react';
import Button from '@mui/material/Button';
-import TextField from '@mui/material/TextField';
import format from 'date-fns/format';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
@@ -28,6 +27,7 @@ import FormHelperText from '@mui/material/FormHelperText';
import Dialog from '@mui/material/Dialog';
import ColorPickerDialog from './ColorPickerDialog';
import TransparentBackground from '../TransparentBackground';
+import TsTextField from '-/components/TsTextField';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import { useTranslation } from 'react-i18next';
@@ -170,16 +170,14 @@ function EditTagDialog(props: Props) {
</time>
</div>
)}
- <TextField
+ <TsTextField
error={inputError}
- margin="dense"
name="title"
autoFocus
label={t('core:editTag')}
onChange={handleTagTitleChange}
value={title}
data-tid="editTagInput"
- fullWidth={true}
/>
{inputError && (
<FormHelperText style={styles.helpText}>
diff --git a/src/renderer/components/dialogs/EditTagGroupDialog.tsx b/src/renderer/components/dialogs/EditTagGroupDialog.tsx
index 4de9ace1e..2a82de802 100644
--- a/src/renderer/components/dialogs/EditTagGroupDialog.tsx
+++ b/src/renderer/components/dialogs/EditTagGroupDialog.tsx
@@ -18,7 +18,6 @@
import React, { ChangeEvent, useEffect, useState } from 'react';
import Button from '@mui/material/Button';
-import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
@@ -34,6 +33,7 @@ import TransparentBackground from '../TransparentBackground';
import { TS } from '-/tagspaces.namespace';
import { Pro } from '-/pro';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import TsTextField from '-/components/TsTextField';
import { getSaveTagInLocation } from '-/reducers/settings';
import { useTranslation } from 'react-i18next';
import { useTaggingActionsContext } from '-/hooks/useTaggingActionsContext';
@@ -173,16 +173,14 @@ function EditTagGroupDialog(props: Props) {
style={{ overflow: 'visible' }}
>
<FormHelperText>{t('core:editTagGroupNewName')}</FormHelperText>
- <TextField
+ <TsTextField
error={inputError}
- margin="dense"
name="title"
autoFocus
// label={t('core:editTagGroupNewName')}
onChange={handleTagGroupTitleChange}
value={title}
data-tid="editTagGroupInput"
- fullWidth={true}
/>
{inputError && (
<FormHelperText>{t('core:taggroupTitleHelper')}</FormHelperText>
diff --git a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx b/src/renderer/components/dialogs/LinkGeneratorDialog.tsx
index 8ba60ce85..e36b3cffd 100644
--- a/src/renderer/components/dialogs/LinkGeneratorDialog.tsx
+++ b/src/renderer/components/dialogs/LinkGeneratorDialog.tsx
@@ -28,9 +28,9 @@ import useMediaQuery from '@mui/material/useMediaQuery';
import { QRCode } from 'react-qrcode-logo';
import InfoIcon from '-/components/InfoIcon';
import InputAdornment from '@mui/material/InputAdornment';
-import TextField from '@mui/material/TextField';
import MenuItem from '@mui/material/MenuItem';
import Links from 'assets/links';
+import TsTextField from '-/components/TsTextField';
import { extractTitle } from '@tagspaces/tagspaces-common/paths';
import { useTranslation } from 'react-i18next';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
@@ -86,14 +86,13 @@ function LinkGeneratorDialog(props: Props) {
style={{ marginTop: 12 }}
>
<DialogTitle>
- {t('core:generateDownloadLink')}{' '}
+ {t('core:downloadLink')}{' '}
<DialogCloseButton testId="closeLinkGeneratorTID" onClose={onClose} />
</DialogTitle>
<DialogContent style={{ overflow: 'auto', height: 450 }}>
- <TextField
+ <TsTextField
style={{ marginTop: 8 }}
select
- fullWidth={true}
label={
<>
{t('core:linkValidity')}
@@ -111,9 +110,8 @@ function LinkGeneratorDialog(props: Props) {
<MenuItem value={60 * 60 * 24}>1 {t('core:day')}</MenuItem>
<MenuItem value={60 * 60 * 24 * 3}>3 {t('core:days')}</MenuItem>
<MenuItem value={60 * 60 * 24 * 7}>7 {t('core:days')}</MenuItem>
- </TextField>
- <TextField
- margin="dense"
+ </TsTextField>
+ <TsTextField
name="path"
style={{ marginTop: 15 }}
InputProps={{
@@ -143,20 +141,18 @@ function LinkGeneratorDialog(props: Props) {
</InputAdornment>
),
}}
- label={<>{t('core:downloadLink')}</>}
- fullWidth={true}
+ // label={t('core:downloadLink')}
value={signedLink.current}
/>
- <TextField
- margin="dense"
+ <TsTextField
name="path"
- label={t('core:qrCode')}
+ // label={t('core:qrCode')}
value={' '}
InputProps={{
readOnly: true,
style: { height: 380 },
startAdornment: (
- <InputAdornment position="start">
+ <InputAdornment title={t('core:qrCode')} position="start">
<QRCode
id="qr-code-link"
value={signedLink.current}
diff --git a/src/renderer/components/dialogs/LocalForm.tsx b/src/renderer/components/dialogs/LocalForm.tsx
index 5b8ad34a5..f2292f5c0 100644
--- a/src/renderer/components/dialogs/LocalForm.tsx
+++ b/src/renderer/components/dialogs/LocalForm.tsx
@@ -19,18 +19,17 @@
import React from 'react';
import FormControl from '@mui/material/FormControl';
-import TextField from '@mui/material/TextField';
import InputAdornment from '@mui/material/InputAdornment';
import IconButton from '@mui/material/IconButton';
import FolderIcon from '@mui/icons-material/Folder';
import FormHelperText from '@mui/material/FormHelperText';
import Grid from '@mui/material/Grid';
import { extractDirectoryName } from '@tagspaces/tagspaces-common/paths';
+import TsTextField from '-/components/TsTextField';
import AppConfig from '-/AppConfig';
import { useTranslation } from 'react-i18next';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { selectDirectoryDialog } from '-/services/utils-io';
-import { CommonLocation } from '-/utils/CommonLocation';
interface Props {
errorTextPath: boolean;
@@ -69,16 +68,14 @@ function LocalForm(props: Props) {
<Grid container>
<Grid item xs={12}>
<FormControl fullWidth={true} error={errorTextName}>
- <TextField
+ <TsTextField
required
autoFocus
- margin="dense"
name="name"
inputProps={{ autoCorrect: 'off' }}
onChange={(event) => setName(event.target.value)}
value={name}
data-tid="locationName"
- fullWidth={true}
// helperText="Please enter location name"
label={t('core:createLocationName')}
/>
@@ -86,11 +83,9 @@ function LocalForm(props: Props) {
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true} error={errorTextPath}>
- <TextField
+ <TsTextField
required
- margin="dense"
name="path"
- fullWidth={true}
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
data-tid="locationPath"
onChange={(event) => setPath(event.target.value)}
diff --git a/src/renderer/components/dialogs/ObjectStoreForm.tsx b/src/renderer/components/dialogs/ObjectStoreForm.tsx
index c585502db..430ccb4bb 100644
--- a/src/renderer/components/dialogs/ObjectStoreForm.tsx
+++ b/src/renderer/components/dialogs/ObjectStoreForm.tsx
@@ -21,7 +21,7 @@ import Autocomplete from '@mui/material/Autocomplete';
import Grid from '@mui/material/Grid';
import FormControl from '@mui/material/FormControl';
import IconButton from '@mui/material/IconButton';
-import TextField from '@mui/material/TextField';
+import TsTextField from '-/components/TsTextField';
import InputAdornment from '@mui/material/InputAdornment';
import Visibility from '@mui/icons-material/Visibility';
import VisibilityOff from '@mui/icons-material/VisibilityOff';
@@ -148,13 +148,11 @@ function ObjectStoreForm(props: Props) {
<Grid container>
<Grid item xs={12}>
<FormControl fullWidth={true} error={cloudErrorTextName}>
- <TextField
+ <TsTextField
required
autoFocus
- margin="dense"
name="storeName"
inputProps={{ autoCorrect: 'off' }}
- fullWidth={true}
data-tid="locationName"
onChange={(event) => setStoreName(event.target.value)}
value={storeName}
@@ -167,10 +165,8 @@ function ObjectStoreForm(props: Props) {
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true} error={cloudErrorTextPath}>
- <TextField
- margin="dense"
+ <TsTextField
name="storePath"
- fullWidth={true}
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
data-tid="locationPath"
onChange={(event) => setStorePath(event.target.value)}
@@ -184,11 +180,9 @@ function ObjectStoreForm(props: Props) {
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true} error={cloudErrorAccessKey}>
- <TextField
- margin="dense"
+ <TsTextField
required
name="accessKeyId"
- fullWidth={true}
data-tid="accessKeyId"
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
onChange={(event) => setAccessKeyId(event.target.value)}
@@ -202,12 +196,10 @@ function ObjectStoreForm(props: Props) {
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true} error={cloudErrorSecretAccessKey}>
- <TextField
- margin="dense"
+ <TsTextField
required
name="secretAccessKey"
type={showSecretAccessKey ? 'text' : 'password'}
- fullWidth={true}
data-tid="secretAccessKey"
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
onChange={(event) => setSecretAccessKey(event.target.value)}
@@ -231,19 +223,12 @@ function ObjectStoreForm(props: Props) {
),
}}
/>
- {/* {state.cloudErrorSecretAccessKey && (
- <FormHelperText>
- {t('core:invalidSecretAccessKey')}
- </FormHelperText>
- )} */}
</FormControl>
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true}>
- <TextField
- margin="dense"
+ <TsTextField
name="sessionToken"
- fullWidth={true}
data-tid="sessionTokenTID"
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
onChange={(event) => setSessionToken(event.target.value)}
@@ -254,38 +239,26 @@ function ObjectStoreForm(props: Props) {
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true} error={cloudErrorBucketName}>
- <TextField
- margin="dense"
+ <TsTextField
name="bucketName"
- fullWidth={true}
data-tid="bucketName"
inputProps={{ autoCorrect: 'off', autoCapitalize: 'none' }}
onChange={(event) => setBucketName(event.target.value)}
value={bucketName}
label={t('core:bucketName')}
/>
- {/* {state.cloudErrorBucketName && (
- <FormHelperText>
- {t('core:invalidBucketName')}
- </FormHelperText>
- )} */}
</FormControl>
</Grid>
<Grid item xs={12}>
<FormControl fullWidth={true}>
- <TextField
- margin="dense"
+ <TsTextField
name="endpointURL"
- fullWidth={true}
data-tid="endpointURL"
placeholder={t('s3serviceURL')}
onChange={(event) => setEndpointURL(event.target.value)}
value={endpointURL}
label={t('core:endpointURL')}
/>
- {/* {state.cloudErrorId && (
- <FormHelperText>{t('core:missingId')}</FormHelperText>
- )} */}
</FormControl>
</Grid>
<Grid item xs={12}>
@@ -297,7 +270,7 @@ function ObjectStoreForm(props: Props) {
onChange={handleRegionChange}
onInputChange={handleRegionChange}
renderInput={(params) => (
- <TextField
+ <TsTextField
{...params}
label={t('core:regionSearch')}
data-tid="regionTID"
diff --git a/src/renderer/components/dialogs/OpenLinkDialog.tsx b/src/renderer/components/dialogs/OpenLinkDialog.tsx
index e635ea5ca..866e1b045 100644
--- a/src/renderer/components/dialogs/OpenLinkDialog.tsx
+++ b/src/renderer/components/dialogs/OpenLinkDialog.tsx
@@ -20,21 +20,15 @@ import React, { useState, useEffect } from 'react';
import useMediaQuery from '@mui/material/useMediaQuery';
import { useTheme } from '@mui/material/styles';
import Button from '@mui/material/Button';
-import TextField from '@mui/material/TextField';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogTitle from '@mui/material/DialogTitle';
-import Menu from '@mui/material/Menu';
-import MenuItem from '@mui/material/MenuItem';
-import MenuList from '@mui/material/MenuList';
-import ListItemText from '@mui/material/ListItemText';
import FormControl from '@mui/material/FormControl';
import InputAdornment from '@mui/material/InputAdornment';
import Dialog from '@mui/material/Dialog';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
-// import useMediaQuery from '@mui/material/useMediaQuery';
-import MenuKeyBinding from '-/components/menus/MenuKeyBinding';
import InfoIcon from '-/components/InfoIcon';
+import TsTextField from '-/components/TsTextField';
import { useTranslation } from 'react-i18next';
import { useOpenedEntryContext } from '-/hooks/useOpenedEntryContext';
@@ -93,44 +87,6 @@ function OpenLinkDialog(props: Props) {
setDisableConfirmButton(true);
}
- const [contextMenu, setContextMenu] = React.useState<{
- mouseX: number;
- mouseY: number;
- } | null>(null);
-
- const handleContextMenu = (event) => {
- event.preventDefault();
- setContextMenu(
- contextMenu === null
- ? {
- mouseX: event.clientX + 2,
- mouseY: event.clientY - 6,
- }
- : null,
- );
- };
-
- const handleClose = () => {
- setContextMenu(null);
- };
-
- async function handleCopy() {
- try {
- await navigator.clipboard.writeText(linkURL);
- handleClose();
- } catch (error) {
- console.error(error.message);
- handleClose();
- }
- }
-
- async function handlePaste() {
- navigator.clipboard.readText().then((clipText) => {
- setLinkURL(clipText);
- handleClose();
- });
- }
-
return (
<Dialog
open={open}
@@ -150,18 +106,18 @@ function OpenLinkDialog(props: Props) {
</DialogTitle>
<DialogContent style={{ minWidth: fullScreen ? 100 : 400 }}>
<FormControl fullWidth={true} error={inputError}>
- <TextField
- fullWidth
- margin="dense"
+ <TsTextField
autoFocus
name="name"
label={t('core:link')}
- onContextMenu={handleContextMenu}
- style={{ cursor: 'context-menu' }}
onChange={(event) => {
const { target } = event;
setLinkURL(target.value);
}}
+ updateValue={(value) => {
+ setLinkURL(value);
+ }}
+ retrieveValue={() => linkURL}
value={linkURL}
data-tid="openLinkTID"
InputProps={{
@@ -172,28 +128,6 @@ function OpenLinkDialog(props: Props) {
),
}}
/>
- <Menu
- open={contextMenu !== null}
- onClose={handleClose}
- anchorReference="anchorPosition"
- anchorPosition={
- contextMenu !== null
- ? { top: contextMenu.mouseY, left: contextMenu.mouseX }
- : undefined
- }
- >
- <MenuList dense style={{ minWidth: 150 }}>
- <MenuItem onClick={handleCopy}>
- <ListItemText primary={t('core:copy')} />
- <MenuKeyBinding keyBinding="command+c" />
- </MenuItem>
- <MenuItem onClick={handlePaste}>
- {' '}
- <ListItemText primary={t('core:paste')} />
- <MenuKeyBinding keyBinding="command+v" />
- </MenuItem>
- </MenuList>
- </Menu>
</FormControl>
</DialogContent>
<DialogActions>
diff --git a/src/renderer/components/dialogs/RenameEntryDialog.tsx b/src/renderer/components/dialogs/RenameEntryDialog.tsx
index 28adfb9d9..ca4ee97e6 100644
--- a/src/renderer/components/dialogs/RenameEntryDialog.tsx
+++ b/src/renderer/components/dialogs/RenameEntryDialog.tsx
@@ -34,6 +34,7 @@ import {
import DraggablePaper from '-/components/DraggablePaper';
import AppConfig from '-/AppConfig';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+import TsTextField from '-/components/TsTextField';
import { dirNameValidation, fileNameValidation } from '-/services/utils-io';
import { useTranslation } from 'react-i18next';
import { useIOActionsContext } from '-/hooks/useIOActionsContext';
@@ -178,11 +179,10 @@ function RenameEntryDialog(props: Props) {
</DialogTitle>
<DialogContent>
<FormControl fullWidth={true} error={inputError}>
- <TextField
+ <TsTextField
autoFocus
required
error={inputError}
- margin="dense"
name="entryName"
label={t(
'core:' +
@@ -190,8 +190,10 @@ function RenameEntryDialog(props: Props) {
)}
onChange={handleInputChange}
onFocus={onInputFocus}
+ // updateValue={(value) => {
+ // name.current = value;
+ // }}
defaultValue={name.current}
- fullWidth={true}
data-tid="renameEntryDialogInput"
/>
<FormHelperText>
diff --git a/src/renderer/components/dialogs/components/CreateFile.tsx b/src/renderer/components/dialogs/components/CreateFile.tsx
index 2b885fc11..4ca9d31aa 100644
--- a/src/renderer/components/dialogs/components/CreateFile.tsx
+++ b/src/renderer/components/dialogs/components/CreateFile.tsx
@@ -23,9 +23,9 @@ import ButtonGroup from '@mui/material/ButtonGroup';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
import Tooltip from '-/components/Tooltip';
-import TextField from '@mui/material/TextField';
import FormHelperText from '@mui/material/FormHelperText';
import { FormControl } from '@mui/material';
+import TsTextField from '-/components/TsTextField';
import { fileNameValidation } from '-/services/utils-io';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
import { useTranslation } from 'react-i18next';
@@ -125,11 +125,9 @@ function CreateFile(props: Props) {
return (
<StyledGrid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>
<FormControl fullWidth={true} error={inputError}>
- <TextField
+ <TsTextField
error={inputError}
- margin="dense"
name="entryName"
- variant="filled"
label={t('core:fileName')}
onChange={handleInputChange}
onFocus={onInputFocus}
@@ -142,7 +140,6 @@ function CreateFile(props: Props) {
}}
defaultValue={fileName}
disabled={noSuitableLocation}
- fullWidth={true}
autoFocus
data-tid={tid('newEntryDialogInputTID')}
/>
@@ -152,16 +149,12 @@ function CreateFile(props: Props) {
</FormControl>
{fileType ? (
<FormControl fullWidth={true}>
- <TextField
+ <TsTextField
autoFocus
id="fileContentID"
label={t('core:fileContent')}
multiline
- fullWidth
- variant="filled"
- // value={fileContent}
rows={5}
- margin="dense"
onChange={handleContentChange}
/>
</FormControl>