draft-js-checkable-list-plugin
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -7,7 +7,7 @@ 'use strict'; | ||
var _constants = require('./constants'); | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var blockStyleFn = function blockStyleFn(block) { | ||
if (block.getType() === _constants.CHECKABLE_LIST_ITEM) { | ||
return _constants.CHECKABLE_LIST_ITEM; | ||
if (block.getType() === _draftJsCheckableListItem.CHECKABLE_LIST_ITEM) { | ||
return _draftJsCheckableListItem.CHECKABLE_LIST_ITEM; | ||
} | ||
@@ -14,0 +14,0 @@ }; |
@@ -15,2 +15,4 @@ 'use strict'; | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var _unionClassNames = require('union-class-names'); | ||
@@ -20,4 +22,2 @@ | ||
var _constants = require('../constants'); | ||
var _DefaultIcon = require('./DefaultIcon'); | ||
@@ -51,5 +51,5 @@ | ||
event.preventDefault(); | ||
_this.props.store.setEditorState(_draftJs.RichUtils.toggleBlockType(_this.props.editorState, _constants.CHECKABLE_LIST_ITEM)); | ||
}, _this.blockTypeIsActive = function () { | ||
return _draftJs.RichUtils.getCurrentBlockType(_this.props.editorState) === _constants.CHECKABLE_LIST_ITEM; | ||
_this.props.store.setEditorState(_draftJs.RichUtils.toggleBlockType(_this.props.editorState, _draftJsCheckableListItem.CHECKABLE_LIST_ITEM)); | ||
}, _this.isActive = function () { | ||
return _draftJs.RichUtils.getCurrentBlockType(_this.props.editorState) === _draftJsCheckableListItem.CHECKABLE_LIST_ITEM; | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -67,3 +67,3 @@ } | ||
var active = theme.active || 'active'; | ||
var className = this.blockTypeIsActive() ? (0, _unionClassNames2.default)(button, active) : button; | ||
var className = this.isActive() ? (0, _unionClassNames2.default)(button, active) : button; | ||
return _react2.default.createElement( | ||
@@ -70,0 +70,0 @@ 'span', |
@@ -7,21 +7,16 @@ 'use strict'; | ||
var _toggleChecked = require('./modifiers/toggleChecked'); | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var _toggleChecked2 = _interopRequireDefault(_toggleChecked); | ||
var createBlockRendererFn = function createBlockRendererFn(_ref) { | ||
var CheckableListItem = _ref.CheckableListItem; | ||
return function (block, _ref2) { | ||
var getEditorState = _ref2.getEditorState, | ||
setEditorState = _ref2.setEditorState; | ||
var _constants = require('./constants'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var createBlockRendererFn = function createBlockRendererFn(config) { | ||
return function (block, _ref) { | ||
var getEditorState = _ref.getEditorState, | ||
setEditorState = _ref.setEditorState; | ||
if (block.getType() === _constants.CHECKABLE_LIST_ITEM) { | ||
if (block.getType() === _draftJsCheckableListItem.CHECKABLE_LIST_ITEM) { | ||
return { | ||
component: config.CheckableListItem, | ||
component: CheckableListItem, | ||
props: { | ||
onChangeChecked: function onChangeChecked() { | ||
setEditorState((0, _toggleChecked2.default)(getEditorState(), block)); | ||
setEditorState(_draftJsCheckableListItem.CheckableListItemUtils.toggleChecked(getEditorState(), block)); | ||
}, | ||
@@ -28,0 +23,0 @@ |
@@ -8,34 +8,11 @@ 'use strict'; | ||
var _react = require('react'); | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _immutable = require('immutable'); | ||
var _constants = require('./constants'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
// https://github.com/facebook/draft-js/blob/master/src/model/immutable/DefaultDraftBlockRenderMap.js#L20 | ||
var wrapper = _react2.default.createElement('ul', { className: 'public-DraftStyleDefault-ul' }); | ||
var createBlockRenderMap = function createBlockRenderMap(config) { | ||
var blockRenderMap = (0, _immutable.Map)(_defineProperty({}, _constants.CHECKABLE_LIST_ITEM, { | ||
element: 'li', | ||
wrapper: wrapper | ||
})); | ||
if (config.sameWrapperAsUnorderedListItem) { | ||
return blockRenderMap.merge((0, _immutable.Map)(_defineProperty({}, _constants.UNORDERED_LIST_ITEM, { | ||
element: 'li', | ||
wrapper: wrapper | ||
}))); | ||
} | ||
return blockRenderMap; | ||
return config.sameWrapperAsUnorderedListItem ? _draftJsCheckableListItem.blockRenderMapForSameWrapperAsUnorderedListItem : _draftJsCheckableListItem.blockRenderMap; | ||
}; | ||
exports.default = createBlockRenderMap; | ||
exports.wrapper = wrapper; // for test | ||
exports.wrapper = _draftJsCheckableListItem.WRAPPER; // for test |
@@ -7,8 +7,4 @@ 'use strict'; | ||
var _adjustBlockDepth = require('./modifiers/adjustBlockDepth'); | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var _adjustBlockDepth2 = _interopRequireDefault(_adjustBlockDepth); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var createOnTab = function createOnTab(config) { | ||
@@ -21,3 +17,3 @@ return function (event, _ref) { | ||
var newEditorState = (0, _adjustBlockDepth2.default)(event, editorState, config.maxDepth); | ||
var newEditorState = _draftJsCheckableListItem.CheckableListItemUtils.onTab(event, editorState, config.maxDepth); | ||
@@ -24,0 +20,0 @@ if (editorState !== newEditorState) { |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _draftJsCheckableListItem = require('draft-js-checkable-list-item'); | ||
var _decorateComponentWithProps = require('decorate-component-with-props'); | ||
@@ -30,6 +32,2 @@ | ||
var _CheckableListItem = require('./CheckableListItem'); | ||
var _CheckableListItem2 = _interopRequireDefault(_CheckableListItem); | ||
var _Button = require('./Button'); | ||
@@ -56,3 +54,3 @@ | ||
var blockRendererConfig = _extends({ | ||
CheckableListItem: (0, _decorateComponentWithProps2.default)(_CheckableListItem2.default, checkableListItemProps) | ||
CheckableListItem: (0, _decorateComponentWithProps2.default)(_draftJsCheckableListItem.CheckableListItem, checkableListItemProps) | ||
}, config); | ||
@@ -59,0 +57,0 @@ |
{ | ||
"name": "draft-js-checkable-list-plugin", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "Checkable list plugin for DraftJS", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"start": "webpack-dev-server --progress", | ||
"start": "webpack-dev-server --progress --open", | ||
"lint": "eslint src", | ||
@@ -28,3 +28,3 @@ "type": "flow", | ||
"clean:lib": "if [ -d lib ]; then rm -rf lib; fi", | ||
"build:css": "cat src/CheckableListItem.styl src/Button.styl | stylus --compress > lib/plugin.css", | ||
"build:css": "stylus --compress -p src/Button.styl | cat node_modules/draft-js-checkable-list-item/lib/CheckableListItem.css - > lib/plugin.css", | ||
"build:js": "babel -d lib src", | ||
@@ -45,3 +45,4 @@ "prebuild": "npm run clean:lib", | ||
"decorate-component-with-props": "^1.0.2", | ||
"draft-js": "~0.9.1", | ||
"draft-js": "~0.10.0", | ||
"draft-js-checkable-list-item": "^2.0.3", | ||
"immutable": "~3.7.4", | ||
@@ -51,41 +52,41 @@ "union-class-names": "^1.0.0" | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.20.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-jest": "^17.0.2", | ||
"babel-loader": "^6.2.9", | ||
"babel-plugin-rewire": "^1.0.0", | ||
"babel-plugin-transform-class-properties": "^6.19.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.18.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.20.2", | ||
"babel-polyfill": "^6.20.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-es2016": "^6.16.0", | ||
"babel-preset-react": "^6.16.0", | ||
"coveralls": "^2.11.15", | ||
"css-loader": "^0.26.1", | ||
"draft-js-plugins-editor": "2.0.0-beta9", | ||
"enzyme": "^2.6.0", | ||
"eslint": "^3.12.0", | ||
"eslint-plugin-babel": "^4.0.0", | ||
"eslint-plugin-flowtype": "^2.29.1", | ||
"eslint-plugin-react": "^6.8.0", | ||
"flow-bin": "^0.37.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.24.1", | ||
"babel-eslint": "^7.2.2", | ||
"babel-jest": "^19.0.0", | ||
"babel-loader": "^6.4.1", | ||
"babel-plugin-rewire": "^1.1.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"babel-preset-es2016": "^6.24.1", | ||
"babel-preset-react": "^6.24.1", | ||
"coveralls": "^2.13.0", | ||
"css-loader": "^0.28.0", | ||
"draft-js-plugins-editor": "2.0.0-beta10", | ||
"enzyme": "^2.8.2", | ||
"eslint": "^3.19.0", | ||
"eslint-plugin-babel": "^4.1.1", | ||
"eslint-plugin-flowtype": "^2.30.4", | ||
"eslint-plugin-react": "^6.10.3", | ||
"flow-bin": "^0.32.0", | ||
"gh-pages": "^0.12.0", | ||
"highlight.js": "^9.8.0", | ||
"html-webpack-plugin": "^2.24.1", | ||
"jest": "^17.0.3", | ||
"react": "^15.4.1", | ||
"react-addons-test-utils": "^15.4.1", | ||
"react-dom": "^15.4.1", | ||
"highlight.js": "^9.10.0", | ||
"html-webpack-plugin": "^2.28.0", | ||
"jest": "^19.0.2", | ||
"react": "^15.5.4", | ||
"react-addons-test-utils": "^15.5.1", | ||
"react-dom": "^15.5.4", | ||
"react-ghfork": "^0.3.5", | ||
"react-hot-loader": "3.0.0-beta.6", | ||
"style-loader": "^0.13.1", | ||
"style-loader": "^0.16.1", | ||
"stylus": "^0.54.5", | ||
"stylus-loader": "^2.4.0", | ||
"webpack": "^1.14.0", | ||
"webpack-dev-server": "^1.16.2" | ||
"stylus-loader": "^3.0.1", | ||
"webpack": "^2.3.3", | ||
"webpack-dev-server": "^2.4.2" | ||
}, | ||
"peerDependencies": { | ||
"draft-js-plugins-editor": "2.0.0-beta9", | ||
"draft-js-plugins-editor": "2.0.0-beta10", | ||
"react": "^15.0.0", | ||
@@ -92,0 +93,0 @@ "react-dom": "^15.0.0" |
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
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
17262
8
12
222
+ Addeddraft-js-checkable-list-item@2.0.6(transitive)
+ Addeddraft-js-modifiers@0.1.5(transitive)
+ Addeddraft-js-plugins-editor@2.0.0-beta10(transitive)
- Removeddraft-js@0.9.1(transitive)
- Removeddraft-js-plugins-editor@2.0.0-beta9(transitive)
- Removedimmutable@5.0.3(transitive)
Updateddraft-js@~0.10.0