draft-js-undo-plugin
Advanced tools
Comparing version 1.0.0-beta1 to 1.0.0
@@ -8,5 +8,12 @@ # Change Log | ||
## 1.0.0 - 2016-04-20 | ||
### Changed | ||
- Moved the option `theme` from an Immutable Map to a JavaScript object. This is more likely to become a standard. | ||
- Instead of passing in the `editorState` and the `onChange` function is not necessary anymore. This is now handled by the plugin itself via a shared reference passed to the components. | ||
## 0.0.5 - 2016-03-25 | ||
### Released the first working of DraftJS Undo Plugin | ||
### Released the first working version of DraftJS Undo Plugin | ||
It's not recommended to use the version 0.0.0 - 0.0.4 |
@@ -15,4 +15,2 @@ 'use strict'; | ||
var _immutable = require('immutable'); | ||
var _styles = { | ||
@@ -30,6 +28,6 @@ "button": "draftJsUndoPlugin__button__3Vugn" | ||
var defaultTheme = (0, _immutable.Map)({ | ||
var defaultTheme = { | ||
redo: _styles2.default.button, | ||
undo: _styles2.default.button | ||
}); | ||
}; | ||
@@ -41,2 +39,6 @@ var historyPlugin = function historyPlugin() { | ||
var redoContent = config.redoContent ? config.redoContent : '↻'; | ||
var store = { | ||
getEditorState: undefined, | ||
setEditorState: undefined | ||
}; | ||
@@ -51,4 +53,11 @@ // Styles are overwritten instead of merged as merging causes a lot of confusion. | ||
return { | ||
UndoButton: (0, _decorateComponentWithProps2.default)(_UndoButton2.default, { theme: theme, children: undoContent }), | ||
RedoButton: (0, _decorateComponentWithProps2.default)(_RedoButton2.default, { theme: theme, children: redoContent }) | ||
UndoButton: (0, _decorateComponentWithProps2.default)(_UndoButton2.default, { theme: theme, store: store, children: undoContent }), | ||
RedoButton: (0, _decorateComponentWithProps2.default)(_RedoButton2.default, { theme: theme, store: store, children: redoContent }), | ||
initialize: function initialize(_ref) { | ||
var getEditorState = _ref.getEditorState; | ||
var setEditorState = _ref.setEditorState; | ||
store.getEditorState = getEditorState; | ||
store.setEditorState = setEditorState; | ||
} | ||
}; | ||
@@ -55,0 +64,0 @@ }; |
@@ -19,4 +19,2 @@ 'use strict'; | ||
var _immutable = require('immutable'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -45,3 +43,3 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(RedoButton)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.onClick = function () { | ||
_this.props.onChange(_draftJs.EditorState.redo(_this.props.editorState)); | ||
_this.props.store.setEditorState(_draftJs.EditorState.redo(_this.props.store.getEditorState())); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -55,11 +53,11 @@ } | ||
var _props$theme = _props.theme; | ||
var theme = _props$theme === undefined ? (0, _immutable.Map)() : _props$theme; | ||
var theme = _props$theme === undefined ? {} : _props$theme; | ||
var children = _props.children; | ||
var className = _props.className; | ||
var combinedClassName = (0, _unionClassNames2.default)(theme.get('redo'), className); | ||
var combinedClassName = (0, _unionClassNames2.default)(theme.redo, className); | ||
return _react2.default.createElement( | ||
'button', | ||
{ | ||
disabled: this.props.editorState.getRedoStack().isEmpty(), | ||
disabled: this.props.store.getEditorState().getRedoStack().isEmpty(), | ||
onClick: this.onClick, | ||
@@ -78,6 +76,4 @@ className: combinedClassName | ||
children: _react.PropTypes.node.isRequired, | ||
onChange: _react.PropTypes.func.isRequired, | ||
editorState: _react.PropTypes.any.isRequired, | ||
theme: _react.PropTypes.any | ||
}; | ||
exports.default = RedoButton; |
@@ -19,4 +19,2 @@ 'use strict'; | ||
var _immutable = require('immutable'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -45,3 +43,3 @@ | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(UndoButton)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.onClick = function () { | ||
_this.props.onChange(_draftJs.EditorState.undo(_this.props.editorState)); | ||
_this.props.store.setEditorState(_draftJs.EditorState.undo(_this.props.store.getEditorState())); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -55,11 +53,11 @@ } | ||
var _props$theme = _props.theme; | ||
var theme = _props$theme === undefined ? (0, _immutable.Map)() : _props$theme; | ||
var theme = _props$theme === undefined ? {} : _props$theme; | ||
var children = _props.children; | ||
var className = _props.className; | ||
var combinedClassName = (0, _unionClassNames2.default)(theme.get('undo'), className); | ||
var combinedClassName = (0, _unionClassNames2.default)(theme.undo, className); | ||
return _react2.default.createElement( | ||
'button', | ||
{ | ||
disabled: this.props.editorState.getUndoStack().isEmpty(), | ||
disabled: this.props.store.getEditorState().getUndoStack().isEmpty(), | ||
onClick: this.onClick, | ||
@@ -78,6 +76,4 @@ className: combinedClassName | ||
children: _react.PropTypes.node.isRequired, | ||
onChange: _react.PropTypes.func.isRequired, | ||
editorState: _react.PropTypes.any.isRequired, | ||
theme: _react.PropTypes.any | ||
}; | ||
exports.default = UndoButton; |
{ | ||
"name": "draft-js-undo-plugin", | ||
"version": "1.0.0-beta1", | ||
"version": "1.0.0", | ||
"description": "Undo Plugin for DraftJS", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is not supported yet
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17159
254
1
1