@lumel/mention 5.2.5 → 5.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { AriaProps, EditorCommand } from '@draft-js-plugins/editor';
2
2
  import { DraftHandleValue, EditorState, SelectionState } from 'draft-js';
3
3
  import PropTypes from 'prop-types';
4
+ import { Iterable } from 'immutable';
4
5
  import React, { Component, ComponentType, KeyboardEvent, ReactElement, RefAttributes } from 'react';
5
6
  import { MentionData, MentionPluginStore, PopperOptions } from '..';
6
7
  import { MentionPluginTheme } from '../theme';
@@ -74,7 +75,7 @@ export declare class MentionSuggestions extends Component<MentionSuggestionsProp
74
75
  activeOffsetKey?: string;
75
76
  lastSearchValue?: string;
76
77
  lastActiveTrigger?: string;
77
- lastSelectionIsInsideWord?: Immutable.Iterable<string, boolean>;
78
+ lastSelectionIsInsideWord?: Iterable<string, boolean>;
78
79
  constructor(props: MentionSuggestionsProps);
79
80
  componentDidUpdate(): void;
80
81
  componentWillUnmount(): void;
@@ -90,7 +91,7 @@ export declare class MentionSuggestions extends Component<MentionSuggestionsProp
90
91
  openDropdown: () => void;
91
92
  closeDropdown: () => void;
92
93
  private getMentionKey;
93
- renderSuggestionsList: (props: RenderSuggestionsProps) => JSX.Element;
94
+ renderSuggestionsList: (props: RenderSuggestionsProps) => ReactElement;
94
95
  render(): ReactElement | null;
95
96
  }
96
97
  export default MentionSuggestions;
@@ -1 +1 @@
1
- export {};
1
+ import '@testing-library/jest-dom';
package/lib/index.cjs.js CHANGED
@@ -11,75 +11,61 @@ var escapeRegExp = require('lodash/escapeRegExp');
11
11
  var once = require('lodash/once');
12
12
  var reactPopper = require('react-popper');
13
13
 
14
- function _extends() {
15
- _extends = Object.assign ? Object.assign.bind() : function (target) {
16
- for (var i = 1; i < arguments.length; i++) {
17
- var source = arguments[i];
18
- for (var key in source) {
19
- if (Object.prototype.hasOwnProperty.call(source, key)) {
20
- target[key] = source[key];
21
- }
22
- }
23
- }
24
- return target;
25
- };
26
- return _extends.apply(this, arguments);
27
- }
28
- function _inheritsLoose(subClass, superClass) {
29
- subClass.prototype = Object.create(superClass.prototype);
30
- subClass.prototype.constructor = subClass;
31
- _setPrototypeOf(subClass, superClass);
14
+ function _arrayLikeToArray(r, a) {
15
+ (null == a || a > r.length) && (a = r.length);
16
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
17
+ return n;
32
18
  }
33
- function _setPrototypeOf(o, p) {
34
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
35
- o.__proto__ = p;
36
- return o;
37
- };
38
- return _setPrototypeOf(o, p);
39
- }
40
- function _objectWithoutPropertiesLoose(source, excluded) {
41
- if (source == null) return {};
42
- var target = {};
43
- var sourceKeys = Object.keys(source);
44
- var key, i;
45
- for (i = 0; i < sourceKeys.length; i++) {
46
- key = sourceKeys[i];
47
- if (excluded.indexOf(key) >= 0) continue;
48
- target[key] = source[key];
49
- }
50
- return target;
51
- }
52
- function _unsupportedIterableToArray(o, minLen) {
53
- if (!o) return;
54
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
55
- var n = Object.prototype.toString.call(o).slice(8, -1);
56
- if (n === "Object" && o.constructor) n = o.constructor.name;
57
- if (n === "Map" || n === "Set") return Array.from(o);
58
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
59
- }
60
- function _arrayLikeToArray(arr, len) {
61
- if (len == null || len > arr.length) len = arr.length;
62
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
63
- return arr2;
64
- }
65
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
66
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
67
- if (it) return (it = it.call(o)).next.bind(it);
68
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
69
- if (it) o = it;
70
- var i = 0;
19
+ function _createForOfIteratorHelperLoose(r, e) {
20
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
21
+ if (t) return (t = t.call(r)).next.bind(t);
22
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
23
+ t && (r = t);
24
+ var o = 0;
71
25
  return function () {
72
- if (i >= o.length) return {
26
+ return o >= r.length ? {
73
27
  done: true
74
- };
75
- return {
28
+ } : {
76
29
  done: false,
77
- value: o[i++]
30
+ value: r[o++]
78
31
  };
79
32
  };
80
33
  }
81
34
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
82
35
  }
36
+ function _extends() {
37
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
38
+ for (var e = 1; e < arguments.length; e++) {
39
+ var t = arguments[e];
40
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
41
+ }
42
+ return n;
43
+ }, _extends.apply(null, arguments);
44
+ }
45
+ function _inheritsLoose(t, o) {
46
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
47
+ }
48
+ function _objectWithoutPropertiesLoose(r, e) {
49
+ if (null == r) return {};
50
+ var t = {};
51
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
52
+ if (-1 !== e.indexOf(n)) continue;
53
+ t[n] = r[n];
54
+ }
55
+ return t;
56
+ }
57
+ function _setPrototypeOf(t, e) {
58
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
59
+ return t.__proto__ = e, t;
60
+ }, _setPrototypeOf(t, e);
61
+ }
62
+ function _unsupportedIterableToArray(r, a) {
63
+ if (r) {
64
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
65
+ var t = {}.toString.call(r).slice(8, -1);
66
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
67
+ }
68
+ }
83
69
 
84
70
  function MentionLink(_ref) {
85
71
  var mention = _ref.mention,
@@ -267,7 +253,7 @@ function getTriggerForMention(editorState, searches, mentionTriggers) {
267
253
  };
268
254
  }
269
255
 
270
- var getRelativeParent = function getRelativeParent(element) {
256
+ var _getRelativeParent = function getRelativeParent(element) {
271
257
  if (!element) {
272
258
  return null;
273
259
  }
@@ -275,13 +261,13 @@ var getRelativeParent = function getRelativeParent(element) {
275
261
  if (position !== 'static') {
276
262
  return element;
277
263
  }
278
- return getRelativeParent(element.parentElement);
264
+ return _getRelativeParent(element.parentElement);
279
265
  };
280
266
  function positionSuggestions(_ref) {
281
267
  var decoratorRect = _ref.decoratorRect,
282
268
  popover = _ref.popover,
283
269
  props = _ref.props;
284
- var relativeParent = getRelativeParent(popover.parentElement);
270
+ var relativeParent = _getRelativeParent(popover.parentElement);
285
271
  var relativeRect;
286
272
  if (relativeParent) {
287
273
  var relativeParentRect = relativeParent.getBoundingClientRect();
@@ -463,7 +449,6 @@ function Popover(_ref) {
463
449
 
464
450
  var _excluded = ["entryComponent", "popoverComponent", "popperOptions", "popoverContainer", "onOpenChange", "onAddMention", "onSearchChange", "suggestions", "ariaProps", "callbacks", "theme", "store", "entityMutability", "positionSuggestions", "mentionTriggers", "mentionPrefix", "handleScroll", "isMentionLoading"];
465
451
  var MentionSuggestions = /*#__PURE__*/function (_Component) {
466
- _inheritsLoose(MentionSuggestions, _Component);
467
452
  function MentionSuggestions(_props) {
468
453
  var _this;
469
454
  _this = _Component.call(this, _props) || this;
@@ -471,7 +456,11 @@ var MentionSuggestions = /*#__PURE__*/function (_Component) {
471
456
  focusedOptionIndex: 0
472
457
  };
473
458
  _this.key = draftJs.genKey();
459
+ _this.popover = void 0;
460
+ _this.activeOffsetKey = void 0;
461
+ _this.lastSearchValue = void 0;
474
462
  _this.lastActiveTrigger = '';
463
+ _this.lastSelectionIsInsideWord = void 0;
475
464
  _this.onEditorStateChange = function (editorState) {
476
465
  var searches = _this.props.store.getAllSearches();
477
466
  // if no search portal is active there is no need to show the popover
@@ -659,6 +648,7 @@ var MentionSuggestions = /*#__PURE__*/function (_Component) {
659
648
  _this.props.callbacks.onChange = _this.onEditorStateChange;
660
649
  return _this;
661
650
  }
651
+ _inheritsLoose(MentionSuggestions, _Component);
662
652
  var _proto = MentionSuggestions.prototype;
663
653
  _proto.componentDidUpdate = function componentDidUpdate() {
664
654
  if (this.popover) {
@@ -790,7 +780,7 @@ MentionSuggestions.propTypes = {
790
780
 
791
781
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
792
782
  function MentionSuggestionsPortal(props) {
793
- var searchPortal = React.useRef();
783
+ var searchPortal = React.useRef(null);
794
784
 
795
785
  // Note: this is a workaround for an obscure issue: https://github.com/draft-js-plugins/draft-js-plugins/pull/667/files
796
786
  // Ideally we can remove this in the future.
package/lib/index.esm.js CHANGED
@@ -7,75 +7,61 @@ import escapeRegExp from 'lodash-es/escapeRegExp';
7
7
  import once from 'lodash-es/once';
8
8
  import { usePopper } from 'react-popper';
9
9
 
10
- function _extends() {
11
- _extends = Object.assign ? Object.assign.bind() : function (target) {
12
- for (var i = 1; i < arguments.length; i++) {
13
- var source = arguments[i];
14
- for (var key in source) {
15
- if (Object.prototype.hasOwnProperty.call(source, key)) {
16
- target[key] = source[key];
17
- }
18
- }
19
- }
20
- return target;
21
- };
22
- return _extends.apply(this, arguments);
23
- }
24
- function _inheritsLoose(subClass, superClass) {
25
- subClass.prototype = Object.create(superClass.prototype);
26
- subClass.prototype.constructor = subClass;
27
- _setPrototypeOf(subClass, superClass);
10
+ function _arrayLikeToArray(r, a) {
11
+ (null == a || a > r.length) && (a = r.length);
12
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
13
+ return n;
28
14
  }
29
- function _setPrototypeOf(o, p) {
30
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
31
- o.__proto__ = p;
32
- return o;
33
- };
34
- return _setPrototypeOf(o, p);
35
- }
36
- function _objectWithoutPropertiesLoose(source, excluded) {
37
- if (source == null) return {};
38
- var target = {};
39
- var sourceKeys = Object.keys(source);
40
- var key, i;
41
- for (i = 0; i < sourceKeys.length; i++) {
42
- key = sourceKeys[i];
43
- if (excluded.indexOf(key) >= 0) continue;
44
- target[key] = source[key];
45
- }
46
- return target;
47
- }
48
- function _unsupportedIterableToArray(o, minLen) {
49
- if (!o) return;
50
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
51
- var n = Object.prototype.toString.call(o).slice(8, -1);
52
- if (n === "Object" && o.constructor) n = o.constructor.name;
53
- if (n === "Map" || n === "Set") return Array.from(o);
54
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
55
- }
56
- function _arrayLikeToArray(arr, len) {
57
- if (len == null || len > arr.length) len = arr.length;
58
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
59
- return arr2;
60
- }
61
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
62
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
63
- if (it) return (it = it.call(o)).next.bind(it);
64
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
65
- if (it) o = it;
66
- var i = 0;
15
+ function _createForOfIteratorHelperLoose(r, e) {
16
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
17
+ if (t) return (t = t.call(r)).next.bind(t);
18
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
19
+ t && (r = t);
20
+ var o = 0;
67
21
  return function () {
68
- if (i >= o.length) return {
22
+ return o >= r.length ? {
69
23
  done: true
70
- };
71
- return {
24
+ } : {
72
25
  done: false,
73
- value: o[i++]
26
+ value: r[o++]
74
27
  };
75
28
  };
76
29
  }
77
30
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
78
31
  }
32
+ function _extends() {
33
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
34
+ for (var e = 1; e < arguments.length; e++) {
35
+ var t = arguments[e];
36
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
37
+ }
38
+ return n;
39
+ }, _extends.apply(null, arguments);
40
+ }
41
+ function _inheritsLoose(t, o) {
42
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
43
+ }
44
+ function _objectWithoutPropertiesLoose(r, e) {
45
+ if (null == r) return {};
46
+ var t = {};
47
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
48
+ if (-1 !== e.indexOf(n)) continue;
49
+ t[n] = r[n];
50
+ }
51
+ return t;
52
+ }
53
+ function _setPrototypeOf(t, e) {
54
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
55
+ return t.__proto__ = e, t;
56
+ }, _setPrototypeOf(t, e);
57
+ }
58
+ function _unsupportedIterableToArray(r, a) {
59
+ if (r) {
60
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
61
+ var t = {}.toString.call(r).slice(8, -1);
62
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
63
+ }
64
+ }
79
65
 
80
66
  function MentionLink(_ref) {
81
67
  var mention = _ref.mention,
@@ -263,7 +249,7 @@ function getTriggerForMention(editorState, searches, mentionTriggers) {
263
249
  };
264
250
  }
265
251
 
266
- var getRelativeParent = function getRelativeParent(element) {
252
+ var _getRelativeParent = function getRelativeParent(element) {
267
253
  if (!element) {
268
254
  return null;
269
255
  }
@@ -271,13 +257,13 @@ var getRelativeParent = function getRelativeParent(element) {
271
257
  if (position !== 'static') {
272
258
  return element;
273
259
  }
274
- return getRelativeParent(element.parentElement);
260
+ return _getRelativeParent(element.parentElement);
275
261
  };
276
262
  function positionSuggestions(_ref) {
277
263
  var decoratorRect = _ref.decoratorRect,
278
264
  popover = _ref.popover,
279
265
  props = _ref.props;
280
- var relativeParent = getRelativeParent(popover.parentElement);
266
+ var relativeParent = _getRelativeParent(popover.parentElement);
281
267
  var relativeRect;
282
268
  if (relativeParent) {
283
269
  var relativeParentRect = relativeParent.getBoundingClientRect();
@@ -459,7 +445,6 @@ function Popover(_ref) {
459
445
 
460
446
  var _excluded = ["entryComponent", "popoverComponent", "popperOptions", "popoverContainer", "onOpenChange", "onAddMention", "onSearchChange", "suggestions", "ariaProps", "callbacks", "theme", "store", "entityMutability", "positionSuggestions", "mentionTriggers", "mentionPrefix", "handleScroll", "isMentionLoading"];
461
447
  var MentionSuggestions = /*#__PURE__*/function (_Component) {
462
- _inheritsLoose(MentionSuggestions, _Component);
463
448
  function MentionSuggestions(_props) {
464
449
  var _this;
465
450
  _this = _Component.call(this, _props) || this;
@@ -467,7 +452,11 @@ var MentionSuggestions = /*#__PURE__*/function (_Component) {
467
452
  focusedOptionIndex: 0
468
453
  };
469
454
  _this.key = genKey();
455
+ _this.popover = void 0;
456
+ _this.activeOffsetKey = void 0;
457
+ _this.lastSearchValue = void 0;
470
458
  _this.lastActiveTrigger = '';
459
+ _this.lastSelectionIsInsideWord = void 0;
471
460
  _this.onEditorStateChange = function (editorState) {
472
461
  var searches = _this.props.store.getAllSearches();
473
462
  // if no search portal is active there is no need to show the popover
@@ -655,6 +644,7 @@ var MentionSuggestions = /*#__PURE__*/function (_Component) {
655
644
  _this.props.callbacks.onChange = _this.onEditorStateChange;
656
645
  return _this;
657
646
  }
647
+ _inheritsLoose(MentionSuggestions, _Component);
658
648
  var _proto = MentionSuggestions.prototype;
659
649
  _proto.componentDidUpdate = function componentDidUpdate() {
660
650
  if (this.popover) {
@@ -786,7 +776,7 @@ MentionSuggestions.propTypes = {
786
776
 
787
777
  var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
788
778
  function MentionSuggestionsPortal(props) {
789
- var searchPortal = useRef();
779
+ var searchPortal = useRef(null);
790
780
 
791
781
  // Note: this is a workaround for an obscure issue: https://github.com/draft-js-plugins/draft-js-plugins/pull/667/files
792
782
  // Ideally we can remove this in the future.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumel/mention",
3
- "version": "5.2.5",
3
+ "version": "5.2.6",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -43,12 +43,11 @@
43
43
  "@popperjs/core": "^2.11.8",
44
44
  "@types/lodash": "^4.14.195",
45
45
  "clsx": "^2.0.0",
46
- "immutable": "~3.7.4",
47
- "lodash": "^4.17.21",
48
- "lodash-es": "^4.17.21",
46
+ "immutable": "^3.8.3",
47
+ "lodash": "^4.18.0",
48
+ "lodash-es": "^4.18.0",
49
49
  "prop-types": "^15.8.1",
50
- "react-popper": "^2.3.0",
51
- "rollup": "^4.53.3"
50
+ "react-popper": "^2.3.0"
52
51
  },
53
52
  "peerDependencies": {
54
53
  "draft-js": "^0.10.1 || ^0.11.0",
@@ -58,4 +57,4 @@
58
57
  "publishConfig": {
59
58
  "access": "public"
60
59
  }
61
- }
60
+ }
package/CHANGELOG.md DELETED
@@ -1,290 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- This project adheres to [Semantic Versioning](http://semver.org/).
5
-
6
- ## To Be Released
7
-
8
- ## 5.2.2
9
-
10
- - adjust react peer dependency
11
-
12
- ## 5.2.1
13
-
14
- - support react 18 in peer dependencies [#2701](https://github.com/draft-js-plugins/draft-js-plugins/issues/2701)
15
-
16
- ## 5.2.0
17
-
18
- - Export `Popover` component for `MentionSuggestions` prop `popoverContainer` without lose of Popper.js functionally [#2684](https://github.com/draft-js-plugins/draft-js-plugins/issues/2684)
19
-
20
- ## 5.1.2
21
-
22
- - Fixing `popoverContainer` type for `MentionSuggestions` [#2633](https://github.com/draft-js-plugins/draft-js-plugins/issues/2633)
23
-
24
- ## 5.1.1
25
-
26
- - Add Japanese symbol to default regExp
27
- - Fixing lodash import to reduce bundle size [#2530](https://github.com/draft-js-plugins/draft-js-plugins/issues/2530)
28
-
29
- ## 5.1.0
30
-
31
- - Use current inline style for mention [#2414](https://github.com/draft-js-plugins/draft-js-plugins/issues/2414)
32
-
33
- ## 5.0.0
34
-
35
- - reset selected item on search change for mention suggestion [#2348](https://github.com/draft-js-plugins/draft-js-plugins/issues/2348)
36
- - add `selectMention` to `EntryComponentProps` [#2363](https://github.com/draft-js-plugins/draft-js-plugins/issues/2363)
37
-
38
- ## 4.6.1
39
-
40
- - delay scrolling into view for selected item in mention list [#2233](https://github.com/draft-js-plugins/draft-js-plugins/issues/2233)
41
- - add animation for `popper.js` [#2209](https://github.com/draft-js-plugins/draft-js-plugins/issues/2209)
42
-
43
- ## 4.6.0
44
-
45
- - sroll focused `Entry` component into view [#997](https://github.com/draft-js-plugins/draft-js-plugins/issues/997)
46
-
47
- ## 4.5.2
48
-
49
- - add `sideEffects` for css files [#1833](https://github.com/draft-js-plugins/draft-js-plugins/issues/1833)
50
-
51
- ## 4.5.1
52
-
53
- - do not render popover if there are no mentions, add `renderEmptyPopup` prop [#2049](https://github.com/draft-js-plugins/draft-js-plugins/issues/2049)
54
- - remove the trigger from the search value [#2047](https://github.com/draft-js-plugins/draft-js-plugins/issues/2047)
55
-
56
- ## 4.5.0
57
-
58
- - fixing multi-character trigger [#2017](https://github.com/draft-js-plugins/draft-js-plugins/issues/2017)
59
- - change MentionSuggestions to popper.js with option `popperOptions`, `popoverContainer` and deprecate `popoverComponent` and `positionSuggestions` [#1933](https://github.com/draft-js-plugins/draft-js-plugins/issues/1933)
60
- - Fix @-mentions to work when the trigger character appears within the search string, for instance an email address.
61
-
62
- ## 4.4.1
63
-
64
- - fixing issue that line does not work [#2004](https://github.com/draft-js-plugins/draft-js-plugins/issues/2004)
65
-
66
- ## 4.4.0
67
-
68
- - fixing issue with build for commen js bundels [#1976](https://github.com/draft-js-plugins/draft-js-plugins/issues/1976)
69
-
70
- ## 4.3.2
71
-
72
- - Add store to PositionSuggestionsParams types [#1945](https://github.com/draft-js-plugins/draft-js-plugins/issues/1945)
73
- - Fixing issue if trigger is first character and cursor if before trigger [#1957](https://github.com/draft-js-plugins/draft-js-plugins/issues/1957)
74
-
75
- ## 4.3.1
76
-
77
- - Fix the @ mentions to actually work. Right now they don't work in the middle of a line. If you start a line with "@" it works but if you start typing text then type "@" it doesn't work.
78
- - Extend the support for chinese symbols [#1888](https://github.com/draft-js-plugins/draft-js-plugins/issues/1888)
79
-
80
- ## 4.3.0
81
-
82
- - fixing trigger range for suggestion strategy [#1772](https://github.com/draft-js-plugins/draft-js-plugins/issues/1772)
83
- - fixing lookahead RegExp which is not supported in Safari [#1844](https://github.com/draft-js-plugins/draft-js-plugins/issues/1844)
84
- - added support for multiple triggers
85
-
86
- ## 4.2.0
87
-
88
- - remove `entryComponent` from plugin config [#1736](https://github.com/draft-js-plugins/draft-js-plugins/issues/1736)
89
-
90
- ## 4.1.0
91
-
92
- - add "sideEffects": false for tree shaking
93
- - Fix regex to ignore trigger in text with supportWhitespace [#1723](https://github.com/draft-js-plugins/draft-js-plugins/issues/1723)
94
-
95
- ## 4.0.2
96
-
97
- - Fix key bindings issue if dropdown is open but there's no suggestion [#1696](https://github.com/draft-js-plugins/draft-js-plugins/issues/1696)
98
- - Fix popoverComponent types
99
-
100
- ## 4.0.1
101
-
102
- - fixing issue Failed to execute 'removeChild' on 'Node' [#1697](https://github.com/draft-js-plugins/draft-js-plugins/issues/1697)
103
-
104
- ## 4.0.0
105
-
106
- - Add Arabic Support
107
- - Remove legacy lifecycle hooks
108
- - Require react 16.3 and above version
109
- - Migrate styles to linaria
110
- - Hide internals in single bundle
111
- - Add esm support
112
- - Use lodash-es in esm bundle
113
- - Added open and onOpenChange required props to make state controlled outside and prevent reacting on suggestions list
114
- - onOpen and onClose callbacks are removed in favour of onOpenChange
115
- - Made suggestions prop required (pass empty array for async suggestions)
116
- - Remove prevState and state from positionSuggestions
117
- - add entryComponent to mention plugin
118
- - convert to typescript
119
- - use the setEditorState and getEditorState functions from props.store in EmojiSuggestionsPortal
120
-
121
- ## 3.1.5
122
-
123
- - removed deprecated draft-js hooks (onUpArrow, onDownArrow, onEscape, onTab) usage
124
-
125
- ## 3.1.4
126
-
127
- - Allow draft-js v0.11
128
- - Remove unused dependencies
129
-
130
- ## 3.1.3
131
-
132
- - Force update regex's `lastIndex` to avoid infinite loop
133
- - Fixed replace issue while `mentionTrigger` is empty
134
-
135
- ## 3.1.2
136
-
137
- - Allow empty `mentionTrigger` with `supportWhitespace: true` #1182
138
-
139
- ## 3.1.1
140
-
141
- - Fix regression for special characters in mention strategy.
142
-
143
- ## 3.1.0
144
-
145
- - Added `supportWhitespace` option to allow more precise matching of mentions containing spaces
146
-
147
- ## 3.0.4
148
-
149
- - Added an `id` attribute on the listbox options so the `aria-activedescendant` value refers to the focused option.
150
-
151
- ## 3.0.2 - 3.0.3
152
-
153
- - bumped find-with-regex
154
-
155
- ## 3.0.1
156
-
157
- - Added `aria-selected="true"` for the suggestions listbox focused option.
158
- - Update aria attributes to use booleans
159
-
160
- ## 3.0.0
161
-
162
- - Deprecate immutable suggestions (breaking change), use arrays from now on
163
- - export default theme (in case we want to extend it)
164
-
165
- ## 2.0.2
166
-
167
- (Much thanks to "dem" aka "Michael Deryugin" - https://github.com/dem)
168
-
169
- - fix suggestions dropdown position in case of line wrap
170
- - Allow mention popup for styled text
171
- - Fixed bug where a user typed not existing mention @xxx and cursor is not moved with up/down arrow key
172
- - Updated dependencies to support react 16
173
-
174
- ## 2.0 alpha
175
-
176
- ### Added
177
-
178
- - Passing through `isFocused` prop to `entryComponent`. Thanks to @thomas88
179
- - Added support for Latin-1 Supplement and Latin Extended-A characters. Thanks to @thomas88
180
- - Fixed incorrect opening of suggestions. Thanks to @thomas88
181
- - Added multiple character support for mentionTrigger
182
- - Added config option `mentionSuggestionsComponent`. If provided the passed component replaces the default `MentionSuggestions` component. The provided component must implement the same interface like `MentionSuggestions`.
183
- - Added support popoverComponent on the `MentionSuggestions` component. Thanks to @samdroid-apps
184
- - Introduced a new configuration option `mentionTrigger`. By default it is set to `@`. As before by default typing `@` will trigger the search for mentions. You can provide a custom character or string to change when the search is triggered. [#320](https://github.com/draft-js-plugins/draft-js-plugins/pull/320) Thanks to @yjang1031
185
- - MentionSuggestions accepts a new prop `entryComponent`. The passed component is used as the template for each of the suggestions' entry. [#317](https://github.com/draft-js-plugins/draft-js-plugins/pull/327). Thanks to @Zhouzi
186
- - `defaultEntryComponent` component is passed `searchValue` prop to enable more customizations when displaying the the MentionSuggestions. Thanks to @nishp1
187
- - The config now accepts a new prop `mentionComponent`. If provided the passed component is used to render a Mention. [#271](https://github.com/draft-js-plugins/draft-js-plugins/pull/271). Thanks to @alexkuz
188
- - Introduced the `mentionRegExp` configuration to overwrite the regular expression for initiating the dropdown. By default this supports any alphanumeric character as well as Chinese, Japanese & Korean characters.
189
- - Added support for Chinese words. Thanks to @mzbac
190
- - Added support for Japanese characters (hiragana & katakana).
191
- - Added support for Korean characters (Hangul Syllables & Hangul Compatibility Jamo). Thanks to @FourwingsY
192
- - Added support for Cyrillic characters. Thanks to @imamatory
193
- - Added `onAddMention` prop to MentionSuggestions. The first argument of this callback will contain the mention entry.
194
-
195
- ### Fixed
196
-
197
- - Escape spaces before mention trigger properly
198
- - Escape mention trigger regex properly
199
- - 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)
200
- - 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)
201
- - Prevents inserting the selected item on Enter or Tab when there's no trigger in sight and dropdown is not rendered. Thanks to @alexfedoseev [#706](https://github.com/draft-js-plugins/draft-js-plugins/pull/706)
202
- - Reopens mentions dropdown if new suggestions are available. Thanks to @jameskraus [#659](https://github.com/draft-js-plugins/draft-js-plugins/pull/659)
203
- - Solved a bug with @ being placed in the beginning. Thanks to @hjyue1 [#621](https://github.com/draft-js-plugins/draft-js-plugins/pull/621)
204
- - Fixed "Cannot read property 'getBoundingClientRect' of null" issue. Thanks to @ismyrnow [#666](https://github.com/draft-js-plugins/draft-js-plugins/pull/667)
205
- - Mentions popover showed up when typing before a @ [#323](https://github.com/draft-js-plugins/draft-js-plugins/issues/323) Thanks to @nishp1
206
- - Only pass element properties to the root Div of MentionSuggestions to remove the "Unknown prop warning" in React 15.2.0
207
- - Fixed bug where a user typed @xxx (invalid mention) and hit Enter. [#416](https://github.com/draft-js-plugins/draft-js-plugins/pull/416)
208
- - Fixed bug where press up arrow would not cycle back to the bottom of suggestions
209
- - Fixed race condition where the SuggestionPortal would unregister and not register again when inputting Japanese, etc.
210
- - Fixed bug where `mentionPrefix` does not appear in `editorState`. `mentionPrefix` is no longer passed to `mentionComponent`.
211
- - Fixed bug where `onSearchChange` didn't fire when a user switched between two different mention autocompletions with the same search value. Now it will trigger `onSearchChange` in such a case.
212
- - Fixed unrecognized `isFocused` React prop.
213
-
214
- ## 1.1.2 - 2016-06-26
215
-
216
- ### Fixed
217
-
218
- - Accepts plain JavaScript Objects for mentions from now on. Until now it only accepted an `Immutable.Map`. This change would make it play nicer together with `convertFromRaw` by default. Thanks to @anderslemke [#326](https://github.com/draft-js-plugins/draft-js-plugins/pull/326)
219
- - `positionSuggestions` now works by default with non-static parents. Thanks to @Zhouzi
220
- [#309](https://github.com/draft-js-plugins/draft-js-plugins/pull/309)
221
- [#206](https://github.com/draft-js-plugins/draft-js-plugins/issues/206)
222
- [#283](https://github.com/draft-js-plugins/draft-js-plugins/issues/283)
223
- [#289](https://github.com/draft-js-plugins/draft-js-plugins/issues/289)
224
-
225
- ## 1.1.1 - 2016-06-05
226
-
227
- ### Fixed
228
-
229
- - Close mention suggestions when suggestions filtered results are empty [#291](https://github.com/draft-js-plugins/draft-js-plugins/pull/291) [#265](https://github.com/draft-js-plugins/draft-js-plugins/issues/265)
230
-
231
- ## 1.1.0 - 2016-05-27
232
-
233
- ### Added
234
-
235
- - `MentionSuggestions` now accepts `onOpen`and `onClose` props. These callbacks are triggered when the popover has opened or closed.
236
-
237
- ## 1.0.2 - 2016-05-24
238
-
239
- ### Fixed
240
-
241
- - Fix rendering the MentionSuggestions in IE11 by avoiding to render an Immutable List [#266](https://github.com/draft-js-plugins/draft-js-plugins/issues/266) [#270](https://github.com/draft-js-plugins/draft-js-plugins/pull/270)
242
- - Fix React 0.14.x support by returning `<noscript />` instead of `null` [#267](https://github.com/draft-js-plugins/draft-js-plugins/pull/267)
243
-
244
- ## 1.0.1 - 2016-04-29
245
-
246
- ### Fixed
247
-
248
- - Make sure there is no autocomplete on tab after deleting a mention [#234](https://github.com/draft-js-plugins/draft-js-plugins/issues/234)
249
-
250
- ## 1.0.0 - 2016-04-20
251
-
252
- ### Changed
253
-
254
- - Instead of the popover inline it is now exported as `MentionSuggestions` and can be placed anywhere in the DOM. It's recommended to place it right after the Editor. This change was important to avoid selection issues trigged by `contentEditable={false}`.
255
- - `mentions` has been renamed to `suggestions` and now has to be directly provided to the `MentionSuggestions` component as property.
256
- - Moved to a flat configuration. Instead of plugin properties (decorators & hooks) being stored within pluginProps they now moved to the root object. See the changes here [#150](https://github.com/draft-js-plugins/draft-js-plugins/pull/150/files) as well as the initial discussion here [#143](https://github.com/draft-js-plugins/draft-js-plugins/issues/143)
257
- - Improved the regex and now test for a whitespace in front of the `@` to make sure it doesn't match on normal text like an email [#104](https://github.com/draft-js-plugins/draft-js-plugins/issues/104)
258
- - Moved the option `theme` from an Immutable Map to a JavaScript object. This is more likely to become a standard.
259
- - Improved styling and added animations for the Suggestions overlay as well as the hover on a single suggestion.
260
- - Updated the theme properties.
261
-
262
- ### Fixed
263
-
264
- - Fix using backspace to close the autocomplete suggestions after typing an `@` [#110](https://github.com/draft-js-plugins/draft-js-plugins/issues/110)
265
-
266
- ### Added
267
-
268
- - The config now takes a property `entityMutability`. A developer can choose between 'IMMUTABLE', 'SEGMENTED' & 'MUTABLE'. Read in detail about it [here](https://draftjs.org/docs/advanced-topics-entities/#mutability).
269
- - The config now takes a property `positionSuggestions`. The function can be used to manipulate the position of the popover containing the suggestions. It receives one object as arguments containing the visible rectangle surrounding the decorated search string including the @. In addition the object contains prevProps, prevState, state & props. An object should be returned which can contain all sorts of styles. The defined properties will be applied as inline-styles.
270
- - Introduce a new config property: `mentionPrefix`. By default it is an empty String. For Twitter or Slack like mention behaviour you can provide an `@`.
271
-
272
- ```
273
- const mentionPlugin = createMentionPlugin({ entityMutability: 'IMMUTABLE' });
274
- ```
275
-
276
- - The `MentionSuggestions` component now takes a property `onSearchChange` which will trigger whenever the search value of changes.
277
- - The module now exports `defaultSuggestionsFilter` for convenience. As first argument it takes the search term as a String. The second argument is the Immutable list of mentions. The function returns the filter list based on substring matches.
278
-
279
- ## 0.0.4 - 2016-03-29
280
-
281
- ### Fixed
282
-
283
- - Fix issue with showing two menus at the same time [#132](https://github.com/draft-js-plugins/draft-js-plugins/issues/132)
284
- - When typing ahead to 0 results and then back the first item must be still selected. [#149](https://github.com/draft-js-plugins/draft-js-plugins/pull/149)
285
-
286
- ## 0.0.3 - 2016-03-25
287
-
288
- ### Released the first working version of DraftJS Mention Plugin
289
-
290
- It's not recommended to use the version 0.0.0 - 0.0.2