draft-js-mention-plugin
Advanced tools
Comparing version 2.0.0-rc8 to 2.0.0-rc9
@@ -28,2 +28,3 @@ # Change Log | ||
- Escape mention trigger regex properly | ||
- Fix bug that selects candidate on hitting return key even if the dropdown was closed. Thanks to @ngs [#720](https://github.com/draft-js-plugins/draft-js-plugins/pull/720) | ||
@@ -30,0 +31,0 @@ - Fix issue with: add two mentions in the Custom Mention Component Example editor, then press backspace key, will remove the first one. Thanks to @chenyuejie [#693](https://github.com/draft-js-plugins/draft-js-plugins/pull/693) |
@@ -24,2 +24,6 @@ 'use strict'; | ||
var _lodash = require('lodash.escaperegexp'); | ||
var _lodash2 = _interopRequireDefault(_lodash); | ||
var _Entry = require('./Entry'); | ||
@@ -173,3 +177,3 @@ | ||
end = _ref4.end; | ||
return start === 0 && anchorOffset === _this.props.mentionTrigger.length && plainText.charAt(anchorOffset) !== _this.props.mentionTrigger && new RegExp(_this.props.mentionTrigger, 'g').test(plainText) && anchorOffset <= end || // @ is the first character | ||
return start === 0 && anchorOffset === _this.props.mentionTrigger.length && plainText.charAt(anchorOffset) !== _this.props.mentionTrigger && new RegExp(String.raw({ raw: '' + (0, _lodash2.default)(_this.props.mentionTrigger) }), 'g').test(plainText) && anchorOffset <= end || // @ is the first character | ||
anchorOffset > start + _this.props.mentionTrigger.length && anchorOffset <= end // @ is in the text or at the end | ||
@@ -176,0 +180,0 @@ ; |
@@ -19,4 +19,7 @@ 'use strict'; | ||
return function (contentBlock, callback) { | ||
(0, _findWithRegex2.default)(new RegExp('(\\s|^)' + (0, _lodash2.default)(trigger) + regExp, 'g'), contentBlock, callback); | ||
var reg = new RegExp(String.raw({ | ||
raw: '(s|^)' + (0, _lodash2.default)(trigger) + regExp // eslint-disable-line no-useless-escape | ||
}), 'g'); | ||
(0, _findWithRegex2.default)(reg, contentBlock, callback); | ||
}; | ||
}; |
{ | ||
"name": "draft-js-mention-plugin", | ||
"version": "2.0.0-rc8", | ||
"version": "2.0.0-rc9", | ||
"description": "Mention Plugin for DraftJS", | ||
@@ -5,0 +5,0 @@ "author": { |
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
64228
1081