Skip to content

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

fix: improvement for markdown in various places

Ilian Sapundshiev1a22a8383ee8
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index f4f7205d4..dcdec8e91 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -899,6 +899,15 @@ function EntryProperties(props: Props) {
overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
}}
>
+ {/* {editDescription === undefined &&
+ !currentEntry.editMode &&
+ editName === undefined && (
+ <span
+ style={{ paddingLeft: 5, paddingTop: 5, color: 'lightgray' }}
+ >
+ {i18n.t('core:addMarkdownDescription')}
+ </span>
+ )} */}
<MilkdownEditor
ref={fileDescriptionRef}
content={currentEntry.description || ''}
@@ -913,7 +922,7 @@ function EntryProperties(props: Props) {
color: theme.palette.text.primary
}}
>
- Formatting: <i className={classes.mdHelpers}>_italic_</i>{' '}
+ 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>
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 3f9eb55fe..5f47eebe3 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -492,7 +492,8 @@ function GridPagination(props: Props) {
<Tooltip title={i18n.t('core:filePropertiesDescription')}>
<Typography
style={{
- fontSize: '0.8rem'
+ fontSize: '0.8rem',
+ wordBreak: 'break-all'
}}
>
{descriptionPreview}
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index 0121cd4e5..8b9d57836 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -1145,15 +1145,18 @@ export function loadFileContentPromise(
/**
* @param mdContent
- * @param length - for preview of fist 200 chars
+ * @param maxLength - for preview of fist 200 chars
*/
-export function getDescriptionPreview(mdContent, length = 200) {
+export function getDescriptionPreview(mdContent, maxLength = 200) {
if (!mdContent) return '';
- let preview;
- if (mdContent.length > 200) {
- preview = mdContent.substring(0, 200) + '...';
- } else preview = mdContent;
- return preview.replace(/[#*_\[\]()`]/g, '');
+ let preview = mdContent.replace(
+ /\(data:([\w\/\+]+);(charset=[\w-]+|base64).*,([a-zA-Z0-9+/]+={0,2})\)/g,
+ ''
+ );
+ if (preview.length > maxLength) {
+ preview = preview.substring(0, maxLength) + '...';
+ }
+ return preview.replace(/[#*!_\[\]()`]/g, '');
}
export function removeMarkDown(mdContent) {