Socket
Socket
Sign inDemoInstall

draft-js-undo-plugin

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draft-js-undo-plugin - npm Package Compare versions

Comparing version 1.0.0-beta1 to 1.0.0

9

CHANGELOG.md

@@ -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

21

lib/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc