TagSpaces is an offline, open source, document manager with tagging support
fix: colors in dark mode milkdown, fix loading images with relative path in the milkdown component, using AppConfig.tsProtocol
Ilian Sapundshiev15a7a0cba808
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsxindex 0d06f7949..4b425fd3a 100644--- a/app/components/CommonIcons.tsx+++ b/app/components/CommonIcons.tsx@@ -38,7 +38,7 @@ export const HelpIcon = props => <Help {...props} />;export const InfoIcon = props => <AnnouncementIcon {...props} />;-export const FolderPropertiesIcon = props => <InfoIcon {...props} />;+export const FolderPropertiesIcon = props => <Info {...props} />;export const RemoveIcon = props => <Remove {...props} />;diff --git a/app/components/EditDescription.tsx b/app/components/EditDescription.tsxindex 95c190fed..09fc4777d 100644--- a/app/components/EditDescription.tsx+++ b/app/components/EditDescription.tsx@@ -1,11 +1,13 @@import React, { MutableRefObject, useRef, useState } from 'react';import Button from '@mui/material/Button';+import Typography from '@mui/material/Typography';+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';+import { extractContainingDirectoryPath } from '@tagspaces/tagspaces-platforms/paths';+import PlatformIO from '-/services/platform-facade';+import { MilkdownEditor, MilkdownRef } from '@tagspaces/tagspaces-md';import i18n from '-/services/i18n';import { ProTooltip } from '-/components/HelperComponents';import { Pro } from '-/pro';-import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';-import Typography from '@mui/material/Typography';-import { MilkdownEditor, MilkdownRef } from '@tagspaces/tagspaces-md';interface Props {primaryColor: string;@@ -16,8 +18,20 @@ interface Props {isDarkTheme: boolean;description: string;setEditDescription: (md: string) => void;+ currentFolder: string;}function EditDescription(props: Props) {+ const {+ currentFolder,+ description,+ setEditDescription,+ classes,+ printHTML,+ toggleEditDescriptionField,+ fileDescriptionRef,+ primaryColor,+ isDarkTheme+ } = props;const [editMode, setEditMode] = useState<boolean>(false);const descriptionFocus = useRef<boolean>(false);@@ -26,8 +40,8 @@ function EditDescription(props: Props) {[]);const milkdownListener = React.useCallback((markdown: string) => {- if (descriptionFocus.current && markdown !== props.description) {- props.setEditDescription(markdown);+ if (descriptionFocus.current && markdown !== description) {+ setEditDescription(markdown);}// update codeMirror/*const { current } = codeMirrorRef;@@ -39,7 +53,7 @@ function EditDescription(props: Props) {<span style={{ float: 'right' }}>{editMode && (<Button- className={props.classes.button}+ className={classes.button}onClick={() => {setEditMode(false);}}@@ -48,18 +62,18 @@ function EditDescription(props: Props) {</Button>)}{!editMode && (- <Button className={props.classes.button} onClick={props.printHTML}>+ <Button className={classes.button} onClick={printHTML}>{i18n.t('core:print')}</Button>)}<ProTooltip tooltip={i18n.t('editDescription')}><Buttoncolor="primary"- className={props.classes.button}+ className={classes.button}disabled={!Pro}onClick={() => {setEditMode(!editMode);- props.toggleEditDescriptionField();+ toggleEditDescriptionField();}}>{editMode ? i18n.t('core:confirmSaveButton') : i18n.t('core:edit')}@@ -71,16 +85,16 @@ function EditDescription(props: Props) {return (<><span style={{ verticalAlign: 'sub', paddingLeft: 5 }}>- <Typography style={{ color: props.primaryColor }} variant="caption">+ <Typography style={{ color: primaryColor }} variant="caption">{i18n.t('core:filePropertiesDescription')}</Typography></span>- {props.toggleEditDescriptionField && editSaveActions}+ {toggleEditDescriptionField && editSaveActions}<divonDoubleClick={() => {- if (props.toggleEditDescriptionField) {+ if (toggleEditDescriptionField) {setEditMode(true);- props.toggleEditDescriptionField();+ toggleEditDescriptionField();}}}style={{@@ -95,25 +109,26 @@ function EditDescription(props: Props) {}}><MilkdownEditor- ref={props.fileDescriptionRef}- content={props.description || ''}+ ref={fileDescriptionRef}+ content={description || ''}onChange={milkdownListener}onFocus={milkdownOnFocus}readOnly={!editMode}- dark={props.isDarkTheme}+ dark={isDarkTheme}lightMode={true}+ currentFolder={currentFolder}/></div><Typographyvariant="caption"style={{- color: props.primaryColor+ color: primaryColor}}>- Markdown help: <i className={props.classes.mdHelpers}>_italic_</i>{' '}- <b className={props.classes.mdHelpers}>**bold**</b>{' '}- <span className={props.classes.mdHelpers}>* list item</span>{' '}- <span className={props.classes.mdHelpers}>[Link text](http://...)</span>+ 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></>);diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex e2ccae09d..46b7da42f 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -882,6 +882,7 @@ function EntryProperties(props: Props) {description={currentEntry.description}setEditDescription={md => (editDescription.current = md)}isDarkTheme={theme.palette.mode === 'dark'}+ currentFolder={directoryPath}/></Grid>diff --git a/app/components/SearchInline.tsx b/app/components/SearchInline.tsxindex 3c5295525..c8e9e3926 100644--- a/app/components/SearchInline.tsx+++ b/app/components/SearchInline.tsx@@ -53,6 +53,7 @@ import { Pro } from '../pro';import useFirstRender from '-/utils/useFirstRender';import MainSearchField from '-/components/MainSearchField';import SavedSearchesMenu from '-/components/menus/SavedSearchesMenu';+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';// type PropsClasses = Record<keyof StyleProps, string>;@@ -365,7 +366,10 @@ function SearchInline(props: Props) {const executeSearch = () => {let query = textQuery.current;- if (query.startsWith('ts:?ts')) {+ if (+ query.startsWith('ts:?ts') ||+ query.startsWith(AppConfig.tsProtocol + '?ts')+ ) {props.openLink(query);clearSearch();return;diff --git a/app/package.json b/app/package.jsonindex 0385271c7..f29336d21 100644--- a/app/package.json+++ b/app/package.json@@ -13,11 +13,11 @@"license": "AGPL-3.0","scripts": {},"webDependencies": {- "@tagspaces/extensions": "1.0.42"+ "@tagspaces/extensions": "1.0.43"},"nodeDependencies": {- "@tagspaces/tagspaces-ws": "2.0.45",- "@tagspaces/extensions": "1.0.42",+ "@tagspaces/tagspaces-ws": "2.0.53",+ "@tagspaces/extensions": "1.0.43","sharp": "^0.30.7"}}diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex 24e8a0de5..571b62d2b 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -146,7 +146,10 @@ function GridPagination(props: Props) {currentDirectoryColor,currentDirectoryTags,currentDirectoryDescription,+ currentDirectoryPath,+ lastThumbnailImageChange,openRenameEntryDialog,+ lastBackgroundImageChange,gridPageLimit,currentPage,files@@ -162,16 +165,10 @@ function GridPagination(props: Props) {const page = useRef<number>(currentPage);const metaLoadedLock = useRef<boolean>(false); // TODO move this for all perspectives - not lock if you open folder with diff perspective nowconst folderTmbPath = useRef<string>(- getFolderThumbPath(- props.currentDirectoryPath,- props.lastThumbnailImageChange- )+ getFolderThumbPath(currentDirectoryPath, lastThumbnailImageChange));const folderBgndPath = useRef<string>(- getFolderBgndPath(- props.currentDirectoryPath,- props.lastBackgroundImageChange- )+ getFolderBgndPath(currentDirectoryPath, lastBackgroundImageChange));// const [page, setPage] = useState(currentPage);@@ -547,6 +544,7 @@ function GridPagination(props: Props) {content={currentDirectoryDescription}readOnly={true}dark={theme.palette.mode === 'dark'}+ currentFolder={currentDirectoryPath}/></Grid>)}diff --git a/package-lock.json b/package-lock.jsonindex cdd2c86c4..22b6e09ef 100644--- a/package-lock.json+++ b/package-lock.json@@ -20,8 +20,8 @@"@mui/material": "5.10.15","@mui/styles": "5.10.15","@mui/x-date-pickers": "^5.0.8",- "@tagspaces/tagspaces-md": "2.0.52",- "@tagspaces/tagspaces-platforms": "2.0.45",+ "@tagspaces/tagspaces-md": "2.0.53",+ "@tagspaces/tagspaces-platforms": "2.0.53","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",@@ -13818,9 +13818,9 @@}},"node_modules/@tagspaces/tagspaces-md": {- "version": "2.0.52",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-md/-/tagspaces-md-2.0.52.tgz",- "integrity": "sha512-H4TGMDP6/zoBBlp7gcNaBHdTrgfEjuYHgl9JpSr87UP6RjcbtTFZeknwpuKBs3a5CJXbwBXjJ8PKF395AWqVqQ==",+ "version": "2.0.53",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-md/-/tagspaces-md-2.0.53.tgz",+ "integrity": "sha512-g8QaOriHFABgJiXXSovLsHNVENC/ah6n0ZZwcA/bWZ2JEqX0SRvfobLStt4WZsmk6PFkorR4rEZwozRgyUUUPA==","dependencies": {"@codemirror/autocomplete": "^6.3.0","@codemirror/commands": "^6.1.2",@@ -13912,9 +13912,9 @@}},"node_modules/@tagspaces/tagspaces-platforms": {- "version": "2.0.45",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.45.tgz",- "integrity": "sha512-6LMsU84x4jjPgwa7xi76TDkviCA6V+EaJRara9wYnwC4zdQCwokZKLCUh1pdL/3F9+TeOcXACNqDsdHCiM/9dw==",+ "version": "2.0.53",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.53.tgz",+ "integrity": "sha512-fevd4Oyv2y7XUAExdk+ucjq2WwnHXnKWojqDGgsM+WlepCi9oYA26w5YKtbwpWq48nSmrdmXkqc534tw6qUMsQ==","hasInstallScript": true},"node_modules/@testim/chrome-version": {@@ -59545,9 +59545,9 @@}},"@tagspaces/tagspaces-md": {- "version": "2.0.52",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-md/-/tagspaces-md-2.0.52.tgz",- "integrity": "sha512-H4TGMDP6/zoBBlp7gcNaBHdTrgfEjuYHgl9JpSr87UP6RjcbtTFZeknwpuKBs3a5CJXbwBXjJ8PKF395AWqVqQ==",+ "version": "2.0.53",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-md/-/tagspaces-md-2.0.53.tgz",+ "integrity": "sha512-g8QaOriHFABgJiXXSovLsHNVENC/ah6n0ZZwcA/bWZ2JEqX0SRvfobLStt4WZsmk6PFkorR4rEZwozRgyUUUPA==","requires": {"@codemirror/autocomplete": "^6.3.0","@codemirror/commands": "^6.1.2",@@ -59612,9 +59612,9 @@}},"@tagspaces/tagspaces-platforms": {- "version": "2.0.45",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.45.tgz",- "integrity": "sha512-6LMsU84x4jjPgwa7xi76TDkviCA6V+EaJRara9wYnwC4zdQCwokZKLCUh1pdL/3F9+TeOcXACNqDsdHCiM/9dw=="+ "version": "2.0.53",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.0.53.tgz",+ "integrity": "sha512-fevd4Oyv2y7XUAExdk+ucjq2WwnHXnKWojqDGgsM+WlepCi9oYA26w5YKtbwpWq48nSmrdmXkqc534tw6qUMsQ=="},"@testim/chrome-version": {"version": "1.1.3",diff --git a/package.json b/package.jsonindex ab67cf16e..27aa9601a 100644--- a/package.json+++ b/package.json@@ -157,8 +157,8 @@"@mui/material": "5.10.15","@mui/styles": "5.10.15","@mui/x-date-pickers": "^5.0.8",- "@tagspaces/tagspaces-md": "2.0.52",- "@tagspaces/tagspaces-platforms": "2.0.45",+ "@tagspaces/tagspaces-md": "2.0.53",+ "@tagspaces/tagspaces-platforms": "2.0.53","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",