|
@@ -8,6 +8,7 @@ import { Button } from 'reactstrap';
|
|
|
import AppContainer from '~/client/services/AppContainer';
|
|
import AppContainer from '~/client/services/AppContainer';
|
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
import { toastError } from '~/client/util/apiNotification';
|
|
|
import { apiPost } from '~/client/util/apiv1-client';
|
|
import { apiPost } from '~/client/util/apiv1-client';
|
|
|
|
|
+import { useCommentPreviewRenderer } from '~/stores/renderer';
|
|
|
|
|
|
|
|
import { ICommentHasId, ICommentHasIdList } from '../interfaces/comment';
|
|
import { ICommentHasId, ICommentHasIdList } from '../interfaces/comment';
|
|
|
import { useSWRxPageComment } from '../stores/comment';
|
|
import { useSWRxPageComment } from '../stores/comment';
|
|
@@ -35,6 +36,7 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
const { data: comments, mutate } = useSWRxPageComment(pageId);
|
|
const { data: comments, mutate } = useSWRxPageComment(pageId);
|
|
|
|
|
+ const { data: growiRenderer } = useCommentPreviewRenderer();
|
|
|
|
|
|
|
|
const [commentToBeDeleted, setCommentToBeDeleted] = useState<ICommentHasId | null>(null);
|
|
const [commentToBeDeleted, setCommentToBeDeleted] = useState<ICommentHasId | null>(null);
|
|
|
const [isDeleteConfirmModalShown, setIsDeleteConfirmModalShown] = useState<boolean>(false);
|
|
const [isDeleteConfirmModalShown, setIsDeleteConfirmModalShown] = useState<boolean>(false);
|
|
@@ -110,7 +112,7 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
|
|
|
|
|
const generateCommentInnerElement = (comment: ICommentHasId) => (
|
|
const generateCommentInnerElement = (comment: ICommentHasId) => (
|
|
|
<Comment
|
|
<Comment
|
|
|
- growiRenderer={appContainer.getRenderer('comment')}
|
|
|
|
|
|
|
+ growiRenderer={growiRenderer}
|
|
|
deleteBtnClicked={onClickDeleteButton}
|
|
deleteBtnClicked={onClickDeleteButton}
|
|
|
comment={comment}
|
|
comment={comment}
|
|
|
onComment={mutate}
|
|
onComment={mutate}
|
|
@@ -122,7 +124,7 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
<ReplayComments
|
|
<ReplayComments
|
|
|
replyList={replyComments}
|
|
replyList={replyComments}
|
|
|
deleteBtnClicked={onClickDeleteButton}
|
|
deleteBtnClicked={onClickDeleteButton}
|
|
|
- growiRenderer={appContainer.getRenderer('comment')}
|
|
|
|
|
|
|
+ growiRenderer={growiRenderer}
|
|
|
isReadOnly={isReadOnly}
|
|
isReadOnly={isReadOnly}
|
|
|
/>
|
|
/>
|
|
|
);
|
|
);
|
|
@@ -142,6 +144,10 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (growiRenderer == null) {
|
|
|
|
|
+ return <></>;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
let commentTitleClasses = 'border-bottom py-3 mb-3';
|
|
let commentTitleClasses = 'border-bottom py-3 mb-3';
|
|
|
commentTitleClasses = titleAlign != null ? `${commentTitleClasses} text-${titleAlign}` : `${commentTitleClasses} text-center`;
|
|
commentTitleClasses = titleAlign != null ? `${commentTitleClasses} text-${titleAlign}` : `${commentTitleClasses} text-center`;
|
|
|
|
|
|
|
@@ -185,7 +191,7 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
|
|
|
{/* display reply editor */}
|
|
{/* display reply editor */}
|
|
|
{(!isReadOnly && showEditorIds.has(comment._id)) && (
|
|
{(!isReadOnly && showEditorIds.has(comment._id)) && (
|
|
|
<CommentEditor
|
|
<CommentEditor
|
|
|
- growiRenderer={appContainer.getRenderer('comment')}
|
|
|
|
|
|
|
+ growiRenderer={growiRenderer}
|
|
|
replyTo={comment._id}
|
|
replyTo={comment._id}
|
|
|
onCancelButtonClicked={() => {
|
|
onCancelButtonClicked={() => {
|
|
|
removeShowEditorId(comment._id);
|
|
removeShowEditorId(comment._id);
|