draft-js-undo-plugin
Advanced tools
Comparing version 2.0.0-beta9 to 2.0.0-rc1
@@ -8,2 +8,6 @@ # Change Log | ||
### Fixed | ||
- Fixed an issue during initialization [#740](https://github.com/draft-js-plugins/draft-js-plugins/pull/740). Thanks to @terryoy | ||
## 1.0.0 - 2016-04-20 | ||
@@ -10,0 +14,0 @@ |
@@ -32,3 +32,3 @@ 'use strict'; | ||
var historyPlugin = function historyPlugin() { | ||
exports.default = function () { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -54,4 +54,4 @@ | ||
initialize: function initialize(_ref) { | ||
var getEditorState = _ref.getEditorState; | ||
var setEditorState = _ref.setEditorState; | ||
var getEditorState = _ref.getEditorState, | ||
setEditorState = _ref.setEditorState; | ||
@@ -62,4 +62,2 @@ store.getEditorState = getEditorState; | ||
}; | ||
}; | ||
exports.default = historyPlugin; | ||
}; |
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _draftJs = require('draft-js'); | ||
@@ -50,7 +54,7 @@ | ||
value: function render() { | ||
var _props = this.props; | ||
var _props$theme = _props.theme; | ||
var theme = _props$theme === undefined ? {} : _props$theme; | ||
var children = _props.children; | ||
var className = _props.className; | ||
var _props = this.props, | ||
_props$theme = _props.theme, | ||
theme = _props$theme === undefined ? {} : _props$theme, | ||
children = _props.children, | ||
className = _props.className; | ||
@@ -61,3 +65,3 @@ var combinedClassName = (0, _unionClassNames2.default)(theme.redo, className); | ||
{ | ||
disabled: this.props.store.getEditorState().getRedoStack().isEmpty(), | ||
disabled: !this.props.store || this.props.store.getEditorState().getRedoStack().isEmpty(), | ||
onClick: this.onClick, | ||
@@ -75,5 +79,5 @@ className: combinedClassName | ||
RedoButton.propTypes = { | ||
children: _react.PropTypes.node.isRequired, | ||
theme: _react.PropTypes.any | ||
children: _propTypes2.default.node.isRequired, | ||
theme: _propTypes2.default.any | ||
}; | ||
exports.default = RedoButton; |
@@ -13,2 +13,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _draftJs = require('draft-js'); | ||
@@ -50,7 +54,7 @@ | ||
value: function render() { | ||
var _props = this.props; | ||
var _props$theme = _props.theme; | ||
var theme = _props$theme === undefined ? {} : _props$theme; | ||
var children = _props.children; | ||
var className = _props.className; | ||
var _props = this.props, | ||
_props$theme = _props.theme, | ||
theme = _props$theme === undefined ? {} : _props$theme, | ||
children = _props.children, | ||
className = _props.className; | ||
@@ -61,3 +65,3 @@ var combinedClassName = (0, _unionClassNames2.default)(theme.undo, className); | ||
{ | ||
disabled: this.props.store.getEditorState().getUndoStack().isEmpty(), | ||
disabled: !this.props.store || this.props.store.getEditorState().getUndoStack().isEmpty(), | ||
onClick: this.onClick, | ||
@@ -75,5 +79,5 @@ className: combinedClassName | ||
UndoButton.propTypes = { | ||
children: _react.PropTypes.node.isRequired, | ||
theme: _react.PropTypes.any | ||
children: _propTypes2.default.node.isRequired, | ||
theme: _propTypes2.default.any | ||
}; | ||
exports.default = UndoButton; |
{ | ||
"name": "draft-js-undo-plugin", | ||
"version": "2.0.0-beta9", | ||
"version": "2.0.0-rc1", | ||
"description": "Undo Plugin for DraftJS", | ||
@@ -36,7 +36,10 @@ "author": { | ||
"union-class-names": "^1.0.0", | ||
"draft-js": ">=0.9.1", | ||
"immutable": ">=3.8.1", | ||
"react": ">=15.3.1", | ||
"react-dom": ">=15.3.1" | ||
"immutable": "~3.7.4", | ||
"prop-types": "^15.5.8" | ||
}, | ||
"peerDependencies": { | ||
"draft-js": "^0.10.1", | ||
"react": "^15.5.0", | ||
"react-dom": "^15.5.0" | ||
} | ||
} |
@@ -23,7 +23,16 @@ # DraftJS Undo Plugin | ||
Which take two props, `onChange` (a function that takes a new editor state as an argument and updates your editor's state) and `editorState` (the current editor state). Render them with those props and your editor now has undo/redo functionality! | ||
Add `undoPlugin` to `plugins` prop of `draft-js-plugins-editor`, render the buttons and your editor now has undo/redo functionality! | ||
```HTML | ||
<UndoButton onChange={ this.onChange } editorState={ this.state.editorState } /> | ||
<RedoButton onChange={ this.onChange } editorState={ this.state.editorState } /> | ||
const MyEditor = ({ editorState, onChange }) => ( | ||
<div> | ||
<Editor | ||
editorState={editorState} | ||
onChange={onChange} | ||
plugins={[undoPlugin]} | ||
/> | ||
<UndoButton /> | ||
<RedoButton /> | ||
</div> | ||
); | ||
``` | ||
@@ -30,0 +39,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13981
9
196
71
7
+ Addedprop-types@^15.5.8
+ Addedcore-js@1.2.7(transitive)
+ Addedcreate-react-class@15.7.0(transitive)
+ Addeddraft-js@0.10.5(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addedfbjs@0.8.18(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@15.7.0(transitive)
+ Addedreact-dom@15.7.0(transitive)
+ Addedreact-is@16.13.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
- Removeddraft-js@>=0.9.1
- Removedreact@>=15.3.1
- Removedreact-dom@>=15.3.1
- Removedcore-js@3.38.1(transitive)
- Removedcross-fetch@3.1.8(transitive)
- Removeddraft-js@0.11.7(transitive)
- Removedfbjs@2.0.0(transitive)
- Removedfbjs-css-vars@1.0.2(transitive)
- Removedimmutable@4.3.7(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedreact@18.3.1(transitive)
- Removedreact-dom@18.3.1(transitive)
- Removedscheduler@0.23.2(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
Updatedimmutable@~3.7.4