Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

draft-js-mention-plugin

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draft-js-mention-plugin - npm Package Compare versions

Comparing version 2.0.0-rc8 to 2.0.0-rc9

1

CHANGELOG.md

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

5

lib/mentionSuggestionsStrategy.js

@@ -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": {

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