draft-js-undo-plugin
Advanced tools
Comparing version 2.0.0-beta1 to 2.0.0-beta10
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _decorateComponentWithProps = require('decorate-component-with-props'); | ||
var _decorateComponentWithProps2 = _interopRequireDefault(_decorateComponentWithProps); | ||
var _UndoButton = require('./UndoButton'); | ||
@@ -22,6 +26,2 @@ | ||
var _decorateComponentWithProps = require('decorate-component-with-props'); | ||
var _decorateComponentWithProps2 = _interopRequireDefault(_decorateComponentWithProps); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -34,4 +34,4 @@ | ||
var historyPlugin = function historyPlugin() { | ||
var config = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
exports.default = function () { | ||
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
@@ -56,4 +56,4 @@ var undoContent = config.undoContent ? config.undoContent : '↺'; | ||
initialize: function initialize(_ref) { | ||
var getEditorState = _ref.getEditorState; | ||
var setEditorState = _ref.setEditorState; | ||
var getEditorState = _ref.getEditorState, | ||
setEditorState = _ref.setEditorState; | ||
@@ -64,4 +64,2 @@ store.getEditorState = getEditorState; | ||
}; | ||
}; | ||
exports.default = historyPlugin; | ||
}; |
@@ -31,3 +31,3 @@ 'use strict'; | ||
function RedoButton() { | ||
var _Object$getPrototypeO; | ||
var _ref; | ||
@@ -42,3 +42,3 @@ var _temp, _this, _ret; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(RedoButton)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.onClick = function () { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = RedoButton.__proto__ || Object.getPrototypeOf(RedoButton)).call.apply(_ref, [this].concat(args))), _this), _this.onClick = function () { | ||
_this.props.store.setEditorState(_draftJs.EditorState.redo(_this.props.store.getEditorState())); | ||
@@ -51,7 +51,7 @@ }, _temp), _possibleConstructorReturn(_this, _ret); | ||
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; | ||
@@ -58,0 +58,0 @@ var combinedClassName = (0, _unionClassNames2.default)(theme.redo, className); |
@@ -31,3 +31,3 @@ 'use strict'; | ||
function UndoButton() { | ||
var _Object$getPrototypeO; | ||
var _ref; | ||
@@ -42,3 +42,3 @@ var _temp, _this, _ret; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(UndoButton)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.onClick = function () { | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = UndoButton.__proto__ || Object.getPrototypeOf(UndoButton)).call.apply(_ref, [this].concat(args))), _this), _this.onClick = function () { | ||
_this.props.store.setEditorState(_draftJs.EditorState.undo(_this.props.store.getEditorState())); | ||
@@ -51,7 +51,7 @@ }, _temp), _possibleConstructorReturn(_this, _ret); | ||
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; | ||
@@ -58,0 +58,0 @@ var combinedClassName = (0, _unionClassNames2.default)(theme.undo, className); |
{ | ||
"name": "draft-js-undo-plugin", | ||
"version": "2.0.0-beta1", | ||
"version": "2.0.0-beta10", | ||
"description": "Undo Plugin for DraftJS", | ||
@@ -36,7 +36,9 @@ "author": { | ||
"union-class-names": "^1.0.0", | ||
"draft-js": ">=0.7.0", | ||
"immutable": ">=3.8.1", | ||
"react": ">=15.1.0", | ||
"react-dom": ">=15.1.0" | ||
"draft-js": ">=0.9.1", | ||
"immutable": "~3.7.4" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.0.0", | ||
"react-dom": "^15.0.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
9
192
71
13568
+ Addedcore-js@1.2.7(transitive)
+ Addedcreate-react-class@15.7.0(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)
- Removedreact@>=15.1.0
- Removedreact-dom@>=15.1.0
- Removedimmutable@4.3.7(transitive)
- Removedreact@18.3.1(transitive)
- Removedreact-dom@18.3.1(transitive)
- Removedscheduler@0.23.2(transitive)
Updateddraft-js@>=0.9.1
Updatedimmutable@~3.7.4