Skip to content

Commit

Permalink
Added field for editing class on wrapper item.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dustin L. Dodson committed Mar 9, 2018
1 parent c4d42dc commit aee788c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
18 changes: 14 additions & 4 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -20401,6 +20401,8 @@

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var debug = __webpack_require__(195)('RIETag');

var RIETag = function (_React$Component) {
_inherits(RIETag, _React$Component);

Expand All @@ -20416,11 +20418,17 @@
_this.render = function () {
return _react2.default.createElement(
'div',
{ key: _this.props.text },
{
key: _this.props.text,
className: _this.props.className
},
_this.props.text,
_react2.default.createElement(
'div',
{ onClick: _this.remove, className: _this.props.className || "remove" },
{
onClick: _this.remove,
className: _this.props.className + '-remove'
},
' \xD7 '
)
);
Expand Down Expand Up @@ -20458,6 +20466,7 @@

if ([].concat(_toConsumableArray(_this2.props.value)).length >= (_this2.props.minTags || 1)) {
var newSet = _this2.props.value;
console.log(newSet);
newSet.delete(tag);
_this2.commit(newSet);
}
Expand Down Expand Up @@ -20547,7 +20556,7 @@
};

_this2.makeTagElement = function (text) {
return _react2.default.createElement(RIETag, { key: text, text: text, removeHandler: _this2.removeTag });
return _react2.default.createElement(RIETag, { className: _this2.props.wrapperEditing, key: text, text: text, removeHandler: _this2.removeTag });
};

_this2.renderEditingComponent = function () {
Expand Down Expand Up @@ -20581,7 +20590,8 @@
blurDelay: _propTypes2.default.number,
placeholder: _propTypes2.default.string,
wrapper: _propTypes2.default.string,
wrapperClass: _propTypes2.default.string
wrapperClass: _propTypes2.default.string,
wrapperEditing: _propTypes2.default.string
};
exports.default = RIETags;

Expand Down
14 changes: 12 additions & 2 deletions src/RIETags.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,16 @@ class RIETag extends React.Component {
};

render = () => {
return <div key={this.props.text}>{this.props.text}<div onClick={this.remove} className={this.props.className || "remove"}> × </div></div>;
return <div
key={this.props.text}
className={this.props.className}
>
{this.props.text}
<div
onClick={this.remove}
className={`${this.props.className}-remove`}
> × </div>
</div>;
};
}

Expand All @@ -41,6 +50,7 @@ export default class RIETags extends RIEStatefulBase {
placeholder: PropTypes.string,
wrapper: PropTypes.string,
wrapperClass: PropTypes.string,
wrapperEditing: PropTypes.string,
};

addTag = (tag) => {
Expand Down Expand Up @@ -141,7 +151,7 @@ export default class RIETags extends RIEStatefulBase {
};

makeTagElement = (text) => {
return <RIETag key={text} text={text} removeHandler={this.removeTag} />;
return <RIETag className={this.props.wrapperEditing} key={text} text={text} removeHandler={this.removeTag} />;
};

renderEditingComponent = () => {
Expand Down

0 comments on commit aee788c

Please sign in to comment.