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 2.0.0-beta9 to 2.0.0-rc1

postcss.config.js

4

CHANGELOG.md

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

10

lib/index.js

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

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