TagSpaces is an offline, open source, document manager with tagging support
chore: optimizations in the entry description
Ilian Sapundshiev8fb4c2594581
diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsxindex d3d318ac9..1316e4b0a 100644--- a/app/components/EditDescription.tsx+++ b/app/components/EditDescription.tsx@@ -12,21 +12,16 @@ import EditDescriptionButtons from '-/components/EditDescriptionButtons';const PREFIX = 'EditDescription';const classes = {- mdHelpers: `${PREFIX}-mdHelpers`,- formControl: `${PREFIX}-formControl`+ mdHelpers: `${PREFIX}-mdHelpers`};-const Root = styled('div')(({ theme }) => ({+const EditDescriptionRoot = styled('div')(({ theme }) => ({height: '90%',[`& .${classes.mdHelpers}`]: {borderRadius: '0.25rem',paddingLeft: '0.25rem',paddingRight: '0.25rem',backgroundColor: '#bcc0c561'- },- [`& .${classes.formControl}`]: {- marginLeft: theme.spacing(0),- width: '100%'}}));@@ -71,26 +66,7 @@ function EditDescription() {const noDescription = !description || description.length < 1;return (- <Root>- <span style={{ verticalAlign: 'sub', paddingLeft: 5 }}>- <Typography- variant="caption"- style={{- color: theme.palette.text.primary- }}- >- Markdown help: <i className={classes.mdHelpers}>_italic_</i>{' '}- <b className={classes.mdHelpers}>**bold**</b>{' '}- <span className={classes.mdHelpers}>* list item</span>{' '}- <span className={classes.mdHelpers}>[Link text](http://...)</span>- </Typography>- {/*<Typography- style={{ color: theme.palette.text.primary }}- variant="caption"- >- {t('core:filePropertiesDescription')}- </Typography>*/}- </span>+ <EditDescriptionRoot>{!openedFile.editMode && (<EditDescriptionButtonsbuttonsRef={descriptionButtonsRef}@@ -108,10 +84,7 @@ function EditDescription() {style={{border: '1px solid lightgray',borderRadius: 5,- //minHeight: 150,- //maxHeight: 200,- // maxHeight: noDescription && !editMode ? 100 : 250,- height: '100%',+ height: 'calc(100% - 40px)',width: 'calc(100% - 8px)',overflowY: 'auto'}}@@ -135,13 +108,13 @@ function EditDescription() {<><style>{`- .prose a {- color: ${theme.palette.primary.main};- }- .prose img {- max-width: 99%;- }- `}+ .prose a {+ color: ${theme.palette.primary.main};+ }+ .prose img {+ max-width: 99%;+ }+ `}</style><MilkdownEditorref={fileDescriptionRef}@@ -156,7 +129,20 @@ function EditDescription() {</>)}</div>- </Root>+ <span style={{ verticalAlign: 'sub', paddingLeft: 5 }}>+ <Typography+ variant="caption"+ style={{+ color: theme.palette.text.primary+ }}+ >+ Markdown help: <i className={classes.mdHelpers}>_italic_</i>{' '}+ <b className={classes.mdHelpers}>**bold**</b>{' '}+ <span className={classes.mdHelpers}>* list item</span>{' '}+ <span className={classes.mdHelpers}>[Link text](http://...)</span>+ </Typography>+ </span>+ </EditDescriptionRoot>);}diff --git a/app/components/EditDescriptionButtons.tsx b/app/components/EditDescriptionButtons.tsxindex c3022dcfa..549024f42 100644--- a/app/components/EditDescriptionButtons.tsx+++ b/app/components/EditDescriptionButtons.tsx@@ -20,7 +20,7 @@ const Root = styled('span')(({ theme }) => ({float: 'right',[`& .${classes.button}`]: {position: 'relative',- padding: '8px 12px 6px 8px',+ padding: '4px 10px 4px 10px',margin: '0'}}));diff --git a/app/components/EntryContainerTabs.tsx b/app/components/EntryContainerTabs.tsxindex 0928e4688..d4bd53380 100644--- a/app/components/EntryContainerTabs.tsx+++ b/app/components/EntryContainerTabs.tsx@@ -87,13 +87,6 @@ const StyledTab = styled((props: StyledTabProps) => (fontSize: theme.typography.pxToRem(15),marginRight: theme.spacing(1),minHeight: 45- // color: 'rgba(255, 255, 255, 0.7)',- /*'&.Mui-selected': {- color: '#fff',- },*/- /*'&.Mui-focusVisible': {- backgroundColor: 'rgba(100, 95, 228, 0.32)',- },*/}));function a11yProps(index: number) {@@ -148,8 +141,9 @@ function EntryContainerTabs(props: EntryContainerTabsProps) {height: '100%',overflowY: 'auto',overflowX: 'hidden',- padding: 10- // ...(openedFile.isFile && { maxHeight: 400 })+ paddingTop: 5,+ paddingLeft: 10,+ paddingRight: 10}}>{value === index && children}@@ -176,52 +170,6 @@ function EntryContainerTabs(props: EntryContainerTabsProps) {}};- /*const toggleEditDescriptionField = () => {- if (readOnlyMode) {- editDescription.current = undefined;- return;- }- if (!Pro) {- dispatch(- AppActions.showNotification(t('core:thisFunctionalityIsAvailableInPro'))- );- return;- }- if (!Pro.MetaOperations) {- dispatch(- AppActions.showNotification(t('Saving description not supported'))- );- return;- }- if (editDescription.current !== undefined) {- dispatch(AppActions.switchLocationTypeByID(openedFile.locationId)).then(- currentLocationId => {- Pro.MetaOperations.saveFsEntryMeta(openedFile.path, {- description: editDescription.current- })- .then(entryMeta => {- editDescription.current = undefined;- dispatch(AppActions.updateOpenedFile(openedFile.path, entryMeta));- dispatch(AppActions.switchCurrentLocationType(currentLocationId));- return true;- })- .catch(error => {- console.warn('Error saving description ' + error);- editDescription.current = undefined;- dispatch(AppActions.switchCurrentLocationType(currentLocationId));- dispatch(- AppActions.showNotification(t('Error saving description'))- );- });- }- );- } else if (openedFile.description) {- editDescription.current = openedFile.description;- } else {- editDescription.current = '';- }- };*/-// directories must be always openedconst selectedTabIndex =!openedFile.isFile && tabIndex === undefined ? 0 : tabIndex;