mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
Fix ie8 error caused by clipboard.js
This commit is contained in:
parent
d59ebf6fc2
commit
424166d335
@ -120,16 +120,15 @@ const CopyableIcon = React.createClass({
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
getCopyCode(type) {
|
||||
return '<Icon type="' + type + '" />';
|
||||
},
|
||||
render() {
|
||||
const text = '<Icon type="' + this.props.type + '" />';
|
||||
return (
|
||||
<Clip component="li" data-clipboard-text={this.getCopyCode(this.props.type)}
|
||||
onSuccess={this.onCopied} className={this.state.justCopied ? 'copied' : ''}>
|
||||
<Icon type={this.props.type} />
|
||||
<span className="anticon-class">{this.props.type}</span>
|
||||
</Clip>
|
||||
<CopyToClipboard text={text} onCopy={this.onCopied}>
|
||||
<li className={this.state.justCopied ? 'copied' : ''}>
|
||||
<Icon type={this.props.type} />
|
||||
<span className="anticon-class">{this.props.type}</span>
|
||||
</li>
|
||||
</CopyToClipboard>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
5
index.js
5
index.js
@ -46,12 +46,13 @@ const antd = {
|
||||
|
||||
antd.version = require('./package.json').version;
|
||||
|
||||
const ReactVersion = React.version;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const warning = require('warning');
|
||||
const semver = require('semver');
|
||||
const reactVersionInDeps = require('./package.json').devDependencies.react;
|
||||
warning(semver.satisfies(React.version, reactVersionInDeps) || semver.gtr(React.version, reactVersionInDeps),
|
||||
`antd@${antd.version} need react@${reactVersionInDeps} or higher, which is react@${React.version} now.`);
|
||||
warning(semver.satisfies(ReactVersion, reactVersionInDeps) || semver.gtr(ReactVersion, reactVersionInDeps),
|
||||
`antd@${antd.version} need react@${reactVersionInDeps} or higher, which is react@${ReactVersion} now.`);
|
||||
}
|
||||
|
||||
module.exports = antd;
|
||||
|
@ -77,12 +77,13 @@
|
||||
"babel-jest": "^6.0.1",
|
||||
"babel-loader": "^6.2.0",
|
||||
"babel-plugin-add-module-exports": "^0.1.1",
|
||||
"babel-plugin-transform-es3-member-expression-literals": "^6.3.13",
|
||||
"babel-plugin-transform-es3-property-literals": "^6.3.13",
|
||||
"babel-preset-es2015": "^6.1.18",
|
||||
"babel-preset-react": "^6.1.18",
|
||||
"babel-preset-stage-0": "^6.1.18",
|
||||
"busboy": "^0.2.9",
|
||||
"chalk": "^1.1.0",
|
||||
"clipboard": "^1.5.5",
|
||||
"css-loader": "^0.23.0",
|
||||
"eslint": "^1.1.0",
|
||||
"eslint-config-airbnb": "^1.0.0",
|
||||
@ -102,6 +103,7 @@
|
||||
"pre-commit": "1.x",
|
||||
"react": "~0.14.2",
|
||||
"react-addons-test-utils": "~0.14.2",
|
||||
"react-copy-to-clipboard": "^3.0.4",
|
||||
"react-dom": "~0.14.2",
|
||||
"react-router": "~1.0.0",
|
||||
"react-stateless-wrapper": "~1.0.2",
|
||||
|
@ -24,7 +24,7 @@ window.require = function (path) {
|
||||
|
||||
window['css-animation'] = require('css-animation');
|
||||
window['react-router'] = require('react-router');
|
||||
window.Clip = require('./clip');
|
||||
window.CopyToClipboard = require('react-copy-to-clipboard');
|
||||
var antd = require('../index');
|
||||
var React = require('react');
|
||||
var ReactDOM = require('react-dom');
|
||||
|
@ -261,11 +261,11 @@ let TintShadeTool = React.createClass({
|
||||
};
|
||||
return <div style={{margin: '40px 0'}}>
|
||||
<div>
|
||||
<Clip onSuccess={this.copySuccess} data-clipboard-text={this.state.result} style={{border: 0, background: '#fff', cursor: 'pointer'}}>
|
||||
<Tooltip title="点击色块复制色值">
|
||||
<Tooltip title="点击色块复制色值">
|
||||
<CopyToClipboard onCopy={this.copySuccess} text={this.state.result}>
|
||||
<div style={{backgroundColor: this.state.result}} className={'color-block ' + (this.state.justCopied ? 'copied' : '') + (this.state.darkBackground ? ' dark' : '')}></div>
|
||||
</Tooltip>
|
||||
</Clip>
|
||||
</CopyToClipboard>
|
||||
</Tooltip>
|
||||
<span style={{width: 188, display: 'inline-block', fontFamily: 'Consolas'}}>{this.state.result}</span>
|
||||
<input className="ant-input" style={{width: 80, color: this.state.color, marginRight: 8}} value={this.state.color} onChange={this.handleChangeColor} />
|
||||
<InputNumber style={{width: 70}} value={this.state.value} onChange={this.handleChangeValue} min={-100} max={100} step={5} />
|
||||
@ -290,6 +290,7 @@ ReactDOM.render(<TintShadeTool />, document.getElementById('color-tint-shade-too
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.color-block:after {
|
||||
position: absolute;
|
||||
|
@ -26,7 +26,7 @@ module.exports = {
|
||||
loader: 'babel',
|
||||
query: {
|
||||
presets: ['es2015', 'react', 'stage-0'],
|
||||
plugins: ['add-module-exports'],
|
||||
plugins: ['add-module-exports', 'transform-es3-member-expression-literals', 'transform-es3-property-literals']
|
||||
}
|
||||
}, {
|
||||
test: /\.json$/,
|
||||
|
Loading…
Reference in New Issue
Block a user