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-beta1 to 2.0.0-beta10

postcss.config.js

20

lib/index.js

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

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