From 424166d335e7d103a2f45a5cc730e473daf4bbf6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 18 Dec 2015 11:33:27 +0800 Subject: [PATCH] Fix ie8 error caused by clipboard.js --- components/icon/index.md | 15 +++++++-------- index.js | 5 +++-- package.json | 4 +++- scripts/demo.js | 2 +- spec/colors.md | 9 +++++---- webpack.config.js | 2 +- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/components/icon/index.md b/components/icon/index.md index b669a923d8..63b8cbed92 100644 --- a/components/icon/index.md +++ b/components/icon/index.md @@ -120,16 +120,15 @@ const CopyableIcon = React.createClass({ }, 1000); }); }, - getCopyCode(type) { - return ''; - }, render() { + const text = '<Icon type="' + this.props.type + '" />'; return ( - - - {this.props.type} - + +
  • + + {this.props.type} +
  • +
    ); } }); diff --git a/index.js b/index.js index a0233b7ce6..00fa0a2fb7 100644 --- a/index.js +++ b/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; diff --git a/package.json b/package.json index 51d3752a4b..adb03e59f0 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/demo.js b/scripts/demo.js index 06ed788485..9ee3958c0c 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -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'); diff --git a/spec/colors.md b/spec/colors.md index 15061dff6a..15e4d2fe17 100644 --- a/spec/colors.md +++ b/spec/colors.md @@ -261,11 +261,11 @@ let TintShadeTool = React.createClass({ }; return
    - - + +
    -
    -
    + + {this.state.result} @@ -290,6 +290,7 @@ ReactDOM.render(, document.getElementById('color-tint-shade-too display: inline-block; vertical-align: middle; margin-right: 8px; + cursor: pointer; } .color-block:after { position: absolute; diff --git a/webpack.config.js b/webpack.config.js index edf57d99f0..47846d4856 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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$/,