From b372b06dc08d94731223cef2a741fe7a7a6a09bb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 一月 2025 13:55:59 +0800 Subject: [PATCH] 2025-01-09 --- src/menu/components/share/sourcecomponent/index.jsx | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/menu/components/share/sourcecomponent/index.jsx b/src/menu/components/share/sourcecomponent/index.jsx index c8f515b..f14a7bb 100644 --- a/src/menu/components/share/sourcecomponent/index.jsx +++ b/src/menu/components/share/sourcecomponent/index.jsx @@ -1,8 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Radio, Modal } from 'antd' -import { PaperClipOutlined, DeleteOutlined } from '@ant-design/icons' +import { Radio, Modal, message } from 'antd' +import { PaperClipOutlined, DeleteOutlined, CopyOutlined } from '@ant-design/icons' import InputForm from './inputform' import './index.scss' @@ -45,6 +45,18 @@ this.props.onChange('') } + copyUrl = () => { + const { url } = this.state + + let oInput = document.createElement('input') + oInput.value = url + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + message.success('澶嶅埗鎴愬姛銆�') + } + handleChange = (key) => { this.setState({visible: key}) } @@ -75,11 +87,13 @@ {url && type === 'video' ? <div className="mk-source-item-info"> <PaperClipOutlined /> <a target="_blank" rel="noopener noreferrer" href={url.replace(/@mywebsite@\//ig, window.GLOB.baseurl)}>{name}</a> + <CopyOutlined title="澶嶅埗閾炬帴" onClick={this.copyUrl}/> <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/> </div> : null} {url && type !== 'video' && url !== '@icon@' ? <div className="mk-source-item-info picture"> <img src={url.replace(/@mywebsite@\//ig, window.GLOB.baseurl)} alt="" /> <a target="_blank" rel="noopener noreferrer" href={url.replace(/@mywebsite@\//ig, window.GLOB.baseurl)}>{name}</a> + <CopyOutlined title="澶嶅埗閾炬帴" onClick={this.copyUrl}/> <DeleteOutlined title="鍒犻櫎鏂囦欢" onClick={this.deleteUrl}/> </div> : null} {url && type !== 'video' && url === '@icon@' ? <div className="mk-source-item-info avatar"> -- Gitblit v1.8.0