|
@@ -3,6 +3,7 @@ import React, {
|
|
|
ForwardRefRenderFunction, memo, useCallback, useImperativeHandle, useRef,
|
|
ForwardRefRenderFunction, memo, useCallback, useImperativeHandle, useRef,
|
|
|
} from 'react';
|
|
} from 'react';
|
|
|
|
|
|
|
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
import { CustomInput } from 'reactstrap';
|
|
import { CustomInput } from 'reactstrap';
|
|
|
|
|
|
|
|
import Clamp from 'react-multiline-clamp';
|
|
import Clamp from 'react-multiline-clamp';
|
|
@@ -55,6 +56,8 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
|
|
|
onClickItem, onCheckboxChanged, onPageDuplicated, onPageRenamed, onPageDeleted, onPagePutBacked,
|
|
onClickItem, onCheckboxChanged, onPageDuplicated, onPageRenamed, onPageDeleted, onPagePutBacked,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
+ const { t } = useTranslation();
|
|
|
|
|
+
|
|
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
|
|
|
|
|
|
// publish ISelectable methods
|
|
// publish ISelectable methods
|
|
@@ -139,7 +142,7 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
|
|
|
// background color of list item changes when class "active" exists under 'list-group-item'
|
|
// background color of list item changes when class "active" exists under 'list-group-item'
|
|
|
const styleActive = !isDeviceSmallerThanLg && isSelected ? 'active' : '';
|
|
const styleActive = !isDeviceSmallerThanLg && isSelected ? 'active' : '';
|
|
|
|
|
|
|
|
- const shouldDangerouslySetInnerHTMLForPaths = elasticSearchResult != null && elasticSearchResult.highlightedPath.length > 0;
|
|
|
|
|
|
|
+ const shouldDangerouslySetInnerHTMLForPaths = elasticSearchResult != null && elasticSearchResult.highlightedPath != null;
|
|
|
|
|
|
|
|
let likerCount;
|
|
let likerCount;
|
|
|
if (isSelected && isIPageInfoForEntity(pageInfo)) {
|
|
if (isSelected && isIPageInfoForEntity(pageInfo)) {
|
|
@@ -157,6 +160,9 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
|
|
|
bookmarkCount = pageMeta?.bookmarkCount;
|
|
bookmarkCount = pageMeta?.bookmarkCount;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const canRenderESSnippet = elasticSearchResult != null && elasticSearchResult.snippet != null;
|
|
|
|
|
+ const canRenderRevisionSnippet = revisionShortBody != null;
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<li
|
|
<li
|
|
|
key={pageData._id}
|
|
key={pageData._id}
|
|
@@ -239,13 +245,21 @@ const PageListItemLSubstance: ForwardRefRenderFunction<ISelectable, Props> = (pr
|
|
|
</div>
|
|
</div>
|
|
|
<div className="page-list-snippet py-1">
|
|
<div className="page-list-snippet py-1">
|
|
|
<Clamp lines={2}>
|
|
<Clamp lines={2}>
|
|
|
- { elasticSearchResult != null && elasticSearchResult?.snippet.length > 0 && (
|
|
|
|
|
|
|
+ { elasticSearchResult != null && elasticSearchResult.snippet != null && (
|
|
|
// eslint-disable-next-line react/no-danger
|
|
// eslint-disable-next-line react/no-danger
|
|
|
<div dangerouslySetInnerHTML={{ __html: elasticSearchResult.snippet }}></div>
|
|
<div dangerouslySetInnerHTML={{ __html: elasticSearchResult.snippet }}></div>
|
|
|
) }
|
|
) }
|
|
|
{ revisionShortBody != null && (
|
|
{ revisionShortBody != null && (
|
|
|
<div>{revisionShortBody}</div>
|
|
<div>{revisionShortBody}</div>
|
|
|
) }
|
|
) }
|
|
|
|
|
+ {
|
|
|
|
|
+ !canRenderESSnippet && !canRenderRevisionSnippet && (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <i className="icon-exclamation p-1"></i>
|
|
|
|
|
+ {t('not_allowed_to_see_this_page')}
|
|
|
|
|
+ </>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
</Clamp>
|
|
</Clamp>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|