From 478fa95137878943b610acf29a388ab88d9f6954 Mon Sep 17 00:00:00 2001 From: jpuri Date: Tue, 19 Sep 2017 00:20:17 +0530 Subject: [PATCH 1/3] Toolbar buttons for outdent and indent should be only enabled if the corresponding action is possible --- package.json | 2 +- src/controls/List/Component/index.js | 13 ++++++++- src/controls/List/index.js | 42 ++++++++++++++++++++-------- yarn.lock | 23 ++++++++------- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index f37507130..9ffbd249f 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ }, "dependencies": { "classnames": "^2.2.5", - "draftjs-utils": "^0.8.06", + "draftjs-utils": "^0.8.07", "prop-types": "^15.5.10" }, "peerDependencies": { diff --git a/src/controls/List/Component/index.js b/src/controls/List/Component/index.js index 15c1e8279..2c0375603 100644 --- a/src/controls/List/Component/index.js +++ b/src/controls/List/Component/index.js @@ -19,6 +19,8 @@ export default class LayoutComponent extends Component { onChange: PropTypes.func, currentState: PropTypes.object, translations: PropTypes.object, + indentDisabled: PropTypes.bool, + outdentDisabled: PropTypes.bool, }; options: Array = ['unordered', 'ordered', 'indent', 'outdent']; @@ -41,7 +43,13 @@ export default class LayoutComponent extends Component { // todo: evaluate refactoring this code to put a loop there and in other places also in code // hint: it will require moving click handlers renderInFlatList(): Object { - const { config, currentState: { listType }, translations } = this.props; + const { + config, + currentState: { listType }, + translations, + indentDisabled, + outdentDisabled + } = this.props; const { options, unordered, ordered, indent, outdent, className } = config; return (
@@ -71,6 +79,7 @@ export default class LayoutComponent extends Component { } {options.indexOf('indent') >= 0 && } {options.indexOf('outdent') >= 0 &&