"copy-to-clipboard": "^3.3.3",

This commit is contained in:
Wang Kejun 2023-07-03 20:03:17 +08:00
parent 86b7bf046c
commit 34298a03a7
3 changed files with 43 additions and 33 deletions

View File

@ -16,6 +16,7 @@
"@wangeditor/editor-for-react": "^1.0.4",
"cheerio": "^1.0.0-rc.12",
"classnames": "^2.3.1",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.5",
"node-fetch": "^2.6.7",
"oak-common-aspect": "file:../oak-common-aspect",

View File

@ -7,6 +7,7 @@ import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
import Style from './web.module.less';
import { EyeOutlined } from '@ant-design/icons';
import copy from 'copy-to-clipboard';
const editorConfig: Partial<IEditorConfig> = {
readOnly: true,
@ -32,13 +33,12 @@ export default function Render(
name: string,
articleId: string
) => void;
copy: (articleId: string) => void;
}
>
) {
const { methods, data } = props;
const { content, oakId, name } = data;
const { t, onRemoveArticle, gotoArticleEdit, gotoPreview, copy } = methods;
const { t, onRemoveArticle, gotoArticleEdit, gotoPreview } = methods;
return (
@ -47,7 +47,12 @@ export default function Render(
<Space>
<Button
onClick={() => {
copy(oakId);
const url = `${window.location.host}/article/detail?oakId=${oakId}`;
copy(url);
methods.setMessage({
content: '复制链接成功',
type: 'success',
});
}}
>

View File

@ -9,6 +9,7 @@ import OakGallery from '../../extraFile/gallery';
import { EntityDict } from '../../../general-app-domain';
import { WebComponentProps } from 'oak-frontend-base';
import Style from './web.module.less';
import copy from 'copy-to-clipboard';
export default function Render(
@ -24,7 +25,6 @@ export default function Render(
{
gotoArticleEdit: (articleId:string) => void;
onRemoveArticle: (id:string) => void;
copy: (id:string) => void;
}
>
) {
@ -34,7 +34,6 @@ export default function Render(
t,
onRemoveArticle,
gotoArticleEdit,
copy,
} = method;
const editorConfig: Partial<IEditorConfig> = {
readOnly: true,
@ -48,42 +47,47 @@ export default function Render(
}
},[content])
return (
<div className={Style.rightContainer}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<div className={Style.rightContainer}>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Space>
<Button
onClick={() => {
copy(oakId);
const url = `${window.location.host}/article/detail?oakId=${oakId}`;
copy(url);
methods.setMessage({
content: '复制链接成功',
type: 'success',
});
}}
>
</Button>
</Space>
</div>
<Row>
<Col xs={24} sm={16}>
<Form
colon
labelCol={{ span: 4 }}
wrapperCol={{ span: 20 }}
>
<>
<Form.Item>
<>
<Editor
defaultConfig={editorConfig}
value={value}
mode="default"
style={{
width: 750
}}
/>
</>
</Form.Item>
</>
</Form>
</Col>
</Row>
</div>
<Row>
<Col xs={24} sm={16}>
<Form
colon
labelCol={{ span: 4 }}
wrapperCol={{ span: 20 }}
>
<>
<Form.Item>
<>
<Editor
defaultConfig={editorConfig}
value={value}
mode="default"
style={{
width: 750,
}}
/>
</>
</Form.Item>
</>
</Form>
</Col>
</Row>
</div>
);
}