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 3.1.3 to 3.1.4

5

CHANGELOG.md

@@ -6,2 +6,7 @@ # Change Log

## 3.1.4
- Allow draft-js v0.11
- Remove unused dependencies
## 3.1.3

@@ -8,0 +13,0 @@ - Force update regex's `lastIndex` to avoid infinite loop

24

lib/index.js

@@ -8,2 +8,5 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // eslint-disable-line import/no-named-as-default
var _MentionSuggestions = require('./MentionSuggestions');

@@ -18,5 +21,5 @@

var _decorateComponentWithProps = require('decorate-component-with-props');
var _react = require('react');
var _decorateComponentWithProps2 = _interopRequireDefault(_decorateComponentWithProps);
var _react2 = _interopRequireDefault(_react);

@@ -171,3 +174,3 @@ var _immutable = require('immutable');

_config$mentionSugges = config.mentionSuggestionsComponent,
mentionSuggestionsComponent = _config$mentionSugges === undefined ? _MentionSuggestions2.default : _config$mentionSugges,
MentionSuggestionsComponent = _config$mentionSugges === undefined ? _MentionSuggestions2.default : _config$mentionSugges,
_config$entityMutabil = config.entityMutability,

@@ -192,10 +195,19 @@ entityMutability = _config$entityMutabil === undefined ? 'SEGMENTED' : _config$entityMutabil,

};
var DecoratedMentionSuggestionsComponent = function DecoratedMentionSuggestionsComponent(props) {
return _react2.default.createElement(MentionSuggestionsComponent, _extends({}, props, mentionSearchProps));
};
var DecoratedMention = function DecoratedMention(props) {
return _react2.default.createElement(_Mention2.default, _extends({}, props, { theme: theme, mentionComponent: mentionComponent }));
};
var DecoratedMentionSuggestionsPortal = function DecoratedMentionSuggestionsPortal(props) {
return _react2.default.createElement(_MentionSuggestionsPortal2.default, _extends({}, props, { store: store }));
};
return {
MentionSuggestions: (0, _decorateComponentWithProps2.default)(mentionSuggestionsComponent, mentionSearchProps),
MentionSuggestions: DecoratedMentionSuggestionsComponent,
decorators: [{
strategy: (0, _mentionStrategy2.default)(mentionTrigger),
component: (0, _decorateComponentWithProps2.default)(_Mention2.default, { theme: theme, mentionComponent: mentionComponent })
component: DecoratedMention
}, {
strategy: (0, _mentionSuggestionsStrategy2.default)(mentionTrigger, supportWhitespace, mentionRegExp),
component: (0, _decorateComponentWithProps2.default)(_MentionSuggestionsPortal2.default, { store: store })
component: DecoratedMentionSuggestionsPortal
}],

@@ -202,0 +214,0 @@ getAccessibilityProps: function getAccessibilityProps() {

@@ -11,5 +11,5 @@ 'use strict';

var _unionClassNames = require('union-class-names');
var _clsx = require('clsx');
var _unionClassNames2 = _interopRequireDefault(_unionClassNames);
var _clsx2 = _interopRequireDefault(_clsx);

@@ -57,3 +57,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var combinedClassName = (0, _unionClassNames2.default)(theme.mention, className);
var combinedClassName = (0, _clsx2.default)(theme.mention, className);
var mention = contentState.getEntity(entityKey).getData().mention;

@@ -60,0 +60,0 @@

@@ -22,5 +22,5 @@ 'use strict';

var _lodash = require('lodash.escaperegexp');
var _escapeRegExp = require('lodash/escapeRegExp');
var _lodash2 = _interopRequireDefault(_lodash);
var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);

@@ -163,3 +163,3 @@ var _Entry = require('./Entry');

end = _ref4.end;
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
return start === 0 && anchorOffset === _this.props.mentionTrigger.length && plainText.charAt(anchorOffset) !== _this.props.mentionTrigger && new RegExp(String.raw({ raw: '' + (0, _escapeRegExp2.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

@@ -166,0 +166,0 @@ ;

{
"name": "draft-js-mention-plugin",
"version": "3.1.3",
"version": "3.1.4",
"description": "Mention Plugin for DraftJS",

@@ -15,2 +15,5 @@ "author": {

"main": "lib/index.js",
"files": [
"lib"
],
"keywords": [

@@ -35,11 +38,10 @@ "editor",

"dependencies": {
"decorate-component-with-props": "^1.0.2",
"find-with-regex": "^1.1.3",
"clsx": "^1.0.4",
"immutable": "~3.7.4",
"lodash": "^4.17.14",
"prop-types": "^15.5.8",
"lodash.escaperegexp": "^4.1.2",
"union-class-names": "^1.0.0"
},
"peerDependencies": {
"draft-js": "^0.10.1",
"draft-js": "^0.10.1 || ^0.11.0",
"react": "^15.5.0 || ^16.0.0-rc",

@@ -46,0 +48,0 @@ "react-dom": "^15.5.0 || ^16.0.0-rc"

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