Merge pull request #130 from fantasticit/fix/doc-url

client: fix build doc url
This commit is contained in:
fantasticit 2022-07-15 15:43:28 +08:00 committed by GitHub
commit d22be2dde0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -133,6 +133,7 @@ export const DocumentActions: React.FC<IProps> = ({
/>
<DocumentLinkCopyer
organizationId={organizationId}
wikiId={wikiId}
documentId={documentId}
render={({ copy, children }) => {

View File

@ -1,21 +1,23 @@
import { IconLink } from '@douyinfe/semi-icons';
import { Space, Typography } from '@douyinfe/semi-ui';
import { IDocument, IOrganization, IWiki } from '@think/domains';
import { copy } from 'helpers/copy';
import { buildUrl } from 'helpers/url';
import React, { useCallback } from 'react';
interface IProps {
wikiId: string;
documentId: string;
organizationId: IOrganization['id'];
wikiId: IWiki['id'];
documentId: IDocument['id'];
render?: (arg: { copy: () => void; children: React.ReactNode }) => React.ReactNode;
}
const { Text } = Typography;
export const DocumentLinkCopyer: React.FC<IProps> = ({ wikiId, documentId, render }) => {
export const DocumentLinkCopyer: React.FC<IProps> = ({ organizationId, wikiId, documentId, render }) => {
const handle = useCallback(() => {
copy(buildUrl(`/wiki/${wikiId}/document/${documentId}`));
}, [wikiId, documentId]);
copy(buildUrl(`/app/org/${organizationId}/wiki/${wikiId}/doc/${documentId}`));
}, [organizationId, wikiId, documentId]);
const content = (
<Space>