TagSpaces is an offline, open source, document manager with tagging support
Fix: ui glitches in the file type settings
Ilian Sapundshiev2957353099e8
diff --git a/app/components/dialogs/settings/SettingsFileTypes.tsx b/app/components/dialogs/settings/SettingsFileTypes.tsxindex 35365d478..28c240fac 100644--- a/app/components/dialogs/settings/SettingsFileTypes.tsx+++ b/app/components/dialogs/settings/SettingsFileTypes.tsx@@ -29,7 +29,6 @@ import Button from '@mui/material/Button';import Select from '@mui/material/Select';import ColorPickerDialog from '../ColorPickerDialog';import { findAvailableExtensions } from '-/reducers/settings-default';-// import { sortBy } from '@tagspaces/tagspaces-platforms/misc';import i18n from '-/services/i18n';import TransparentBackground from '../../TransparentBackground';@@ -105,20 +104,20 @@ function SettingsFileTypes(props: Props) {} = props;return (- <div className={classes.root}>+ <div><ColorPickerDialogopen={isColorPickerVisible}setColor={handleChangeColor}onClose={closeColorPicker}color={selectedItem.color}/>-{items.map(item => (<ListItemdata-id={item.id}key={item.id}style={{- padding: 0,+ paddingLeft: 0,+ paddingRight: 0,paddingBottom: 15,alignItems: 'flex-end'}}@@ -131,7 +130,7 @@ function SettingsFileTypes(props: Props) {1}>- <InputLabel htmlFor="name-disabled" data-shrink={false}>+ <InputLabel style={{ marginLeft: -15 }} htmlFor="">{i18n.t('core:fileExtension')}</InputLabel><Input@@ -141,18 +140,6 @@ function SettingsFileTypes(props: Props) {items.filter(targetItem => targetItem.type === item.type).length > 1}- /* onChange={event => {- event.persist();- const nextValue = event.target.value;- const withoutSpecialChars = sanitizeFileTypeInput(nextValue);- updateItems(- 'type',- item.type,- 'type',- withoutSpecialChars,- true- );- }} */onBlur={event => {const nextValue = event.target.value;const withoutSpecialChars = sanitizeFileTypeInput(nextValue);@@ -164,7 +151,9 @@ function SettingsFileTypes(props: Props) {className={classes.fileOpener}error={isValidationInProgress && item.viewer === ''}>- <InputLabel htmlFor="">{i18n.t('core:fileOpener')}</InputLabel>+ <InputLabel style={{ marginLeft: -15 }} htmlFor="">+ {i18n.t('core:fileOpener')}+ </InputLabel><Selecterror={isValidationInProgress && item.viewer === ''}value={item.viewer}@@ -189,7 +178,9 @@ function SettingsFileTypes(props: Props) {</Select></FormControl><FormControl className={classes.fileOpener}>- <InputLabel htmlFor="">{i18n.t('core:fileEditor')}</InputLabel>+ <InputLabel style={{ marginLeft: -15 }} htmlFor="">+ {i18n.t('core:fileEditor')}+ </InputLabel><Selectvalue={item.editor}input={<Input id="" />}@@ -197,7 +188,7 @@ function SettingsFileTypes(props: Props) {updateItems('id', item.id, 'editor', event.target.value)}>- <MenuItem value="" />+ <MenuItem value="">{i18n.t('clearEditor')}</MenuItem>{availableExtensions.filter(extension => extension.extensionType === 'editor').map(extension => (diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 1ab196fc1..f60426a83 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -296,11 +296,11 @@"chooseLocation": "Open Location","colorPickerDialogTitle": "Choose color","themeSelector": "Color scheme",- "themeRegularSelector": "Preferred regular theme",+ "themeRegularSelector": "Preferred light theme","themeDarkSelector": "Preferred dark theme","darkScheme": "dark",- "regularScheme": "regular",- "systemScheme": "match OS",+ "regularScheme": "light",+ "systemScheme": "match operating system","moveUp": "Move Up","moveDown": "Move Down","chooseSearchQuery": "Choose a search query",@@ -695,5 +695,6 @@"userAccount": "User Account","save": "Save","importKanbanBoard": "Import Kanban Board",+ "clearEditor": "Clear editor","-": "-"}diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.tsindex 42c191fa2..8472acb12 100644--- a/app/reducers/io-actions.ts+++ b/app/reducers/io-actions.ts@@ -354,61 +354,64 @@ const actions = {// TODO try to replace this with <input type="file"if (AppConfig.isElectron) {// for AWS location getFileContentPromise cannot load with io-objectore- return PlatformIO.getLocalFileContentPromise(job[0]).then(fileContent =>- PlatformIO.getPropertiesPromise(filePath)- .then(entryProps => {- if (entryProps) {- dispatch(- AppActions.showNotification(- 'File with the same name already exist, importing skipped!',- 'warning',- true+ return PlatformIO.getLocalFileContentPromise(job[0]).then(+ fileContent =>+ PlatformIO.getPropertiesPromise(filePath)+ .then(entryProps => {+ if (entryProps) {+ dispatch(+ AppActions.showNotification(+ 'File with the same name already exist, importing skipped!',+ 'warning',+ true+ )+ );+ dispatch(AppActions.setProgress(filePath, -1, undefined));+ } else {+ // dispatch(AppActions.setProgress(filePath, progress));+ return PlatformIO.saveBinaryFilePromise(+ filePath,+ fileContent,+ true,+ onUploadProgress)- );- dispatch(AppActions.setProgress(filePath, -1, undefined));- } else {- // dispatch(AppActions.setProgress(filePath, progress));- return PlatformIO.saveBinaryFilePromise(- filePath,- fileContent,- true,- onUploadProgress- )- .then((fsEntry: TS.FileSystemEntry) => {- // handle meta files- if (fileType === 'meta') {- try {+ .then((fsEntry: TS.FileSystemEntry) => {+ // handle meta files+ if (fileType === 'meta') {+ try {+ // eslint-disable-next-line no-param-reassign+ fsEntry.meta = loadJSONString(+ fileContent.toString()+ );+ } catch (e) {+ console.debug('cannot parse entry meta');+ }+ } else if (fileType === 'thumb') {// eslint-disable-next-line no-param-reassign- fsEntry.meta = loadJSONString(fileContent.toString());- } catch (e) {- console.debug('cannot parse entry meta');+ fsEntry.thumbPath = fsEntry.path;}- } else if (fileType === 'thumb') {- // eslint-disable-next-line no-param-reassign- fsEntry.thumbPath = fsEntry.path;- }- return fsEntry;- })- .catch(err => {- console.error(- 'Importing file ' + filePath + ' failed ' + err- );- dispatch(- AppActions.showNotification(- 'Importing file ' + filePath + ' failed.',- 'error',- true- )- );- return undefined;- });- }- return undefined;- })- .catch(err => {- console.log('Error getting properties ' + err);- })+ return fsEntry;+ })+ .catch(err => {+ console.error(+ 'Importing file ' + filePath + ' failed ' + err+ );+ dispatch(+ AppActions.showNotification(+ 'Importing file ' + filePath + ' failed.',+ 'error',+ true+ )+ );+ return undefined;+ });+ }+ return undefined;+ })+ .catch(err => {+ console.log('Error getting properties ' + err);+ }));}