New file |
| | |
| | | import React, { Component } from 'react' |
| | | import { Modal, Button, Input, message } from 'antd' |
| | | import { CopyOutlined } from '@ant-design/icons' |
| | | |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | class LowerText extends Component { |
| | | state = { |
| | | visible: false, |
| | | content: '' |
| | | } |
| | | |
| | | trigger = () => { |
| | | this.setState({ |
| | | visible: true, |
| | | content: '' |
| | | }) |
| | | } |
| | | |
| | | changeValue = (e) => { |
| | | this.setState({content: e.target.value.toLowerCase()}) |
| | | } |
| | | |
| | | copy = () => { |
| | | const { content } = this.state |
| | | |
| | | if (navigator.clipboard) { |
| | | navigator.clipboard.writeText(content) |
| | | } else { |
| | | let oInput = document.createElement('input') |
| | | oInput.value = content |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | } |
| | | |
| | | message.success('复制成功。') |
| | | } |
| | | |
| | | render() { |
| | | const { visible, content } = this.state |
| | | |
| | | return ( |
| | | <> |
| | | <Button className="mk-border-yellow" onClick={this.trigger}>文本转小写</Button> |
| | | <Modal |
| | | title="文本转小写" |
| | | wrapClassName="lower-text-modal" |
| | | visible={visible} |
| | | width={700} |
| | | maskClosable={false} |
| | | centered={true} |
| | | onCancel={() => { this.setState({ visible: false })}} |
| | | footer={[ |
| | | <Button key="cancel" onClick={() => { this.setState({ visible: false })}}>关闭</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | <TextArea defaultValue="" autoFocus rows={7} onChange={this.changeValue}/> |
| | | <CopyOutlined onClick={this.copy}/> |
| | | <div className="lower-value">{content}</div> |
| | | </Modal> |
| | | </> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default LowerText |
New file |
| | |
| | | .lower-text-modal { |
| | | .ant-modal-body { |
| | | min-height: 150px; |
| | | |
| | | .anticon-copy { |
| | | float: right; |
| | | color: #52c41a; |
| | | position: relative; |
| | | top: 20px; |
| | | } |
| | | .lower-value { |
| | | border: 1px solid #91d5ff; |
| | | height: 200px; |
| | | margin-top: 40px; |
| | | padding: 5px; |
| | | overflow-y: auto; |
| | | } |
| | | .lower-value::-webkit-scrollbar { |
| | | width: 8px; |
| | | } |
| | | .lower-value::-webkit-scrollbar-thumb { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | border-radius: 5px; |
| | | } |
| | | .lower-value::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | border-radius: 3px; |
| | | } |
| | | } |
| | | } |
| | |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) |
| | | const LowerField = asyncComponent(() => import('@/menu/lowerField')) |
| | | const LowerText = asyncComponent(() => import('@/menu/lowerText')) |
| | | const Debug = asyncComponent(() => import('@/menu/debug')) |
| | | const NormalCss = asyncComponent(() => import('@/menu/normalCss')) |
| | | const NormalCopy = asyncComponent(() => import('@/menu/normalCopy')) |
| | |
| | | <ReplaceField config={config} updateConfig={this.resetConfig}/> |
| | | <LowerField config={config} updateConfig={this.resetConfig}/> |
| | | <DelExtraDb config={config} updateConfig={this.resetConfig}/> |
| | | <LowerText /> |
| | | <PictureController/> |
| | | <Button onClick={() => window.open('#/ai')}>DeepSeek</Button> |
| | | </div>} trigger={['hover']}> |
| | |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | | const DelExtraDb = asyncComponent(() => import('@/menu/delExtraDb')) |
| | | const LowerField = asyncComponent(() => import('@/menu/lowerField')) |
| | | const LowerText = asyncComponent(() => import('@/menu/lowerText')) |
| | | const Debug = asyncComponent(() => import('@/menu/debug')) |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const Transfer = asyncComponent(() => import('@/menu/transfer')) |
| | |
| | | <ReplaceField config={config} updateConfig={this.resetConfig}/> |
| | | <LowerField config={config} updateConfig={this.resetConfig}/> |
| | | <DelExtraDb config={config} updateConfig={this.resetConfig}/> |
| | | <LowerText /> |
| | | <Button onClick={() => window.open('#/ai')}>DeepSeek</Button> |
| | | </div>} trigger={['hover']}> |
| | | <div className="mk-button-more">更多<DownOutlined/></div> |