@yuntijs/ui 1.0.0-beta.72 → 1.0.0-beta.73
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,5 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
+
import { escapeRegExp } from 'lodash-es';
|
|
3
4
|
import { useMemo } from 'react';
|
|
4
5
|
import { INSERT_MENTION_COMMAND } from "../mention-node";
|
|
5
6
|
import { MentionMenuOption } from "./utils";
|
|
@@ -24,7 +25,7 @@ export var useOptions = function useOptions(allOptions, queryString) {
|
|
|
24
25
|
if (!queryString) {
|
|
25
26
|
return menuOptions;
|
|
26
27
|
}
|
|
27
|
-
var regex = new RegExp(queryString, 'i');
|
|
28
|
+
var regex = new RegExp(escapeRegExp(queryString), 'i');
|
|
28
29
|
return menuOptions.filter(function (o) {
|
|
29
30
|
var _o$keywords;
|
|
30
31
|
return regex.test(o.label) || ((_o$keywords = o.keywords) === null || _o$keywords === void 0 ? void 0 : _o$keywords.some(function (keyword) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Flex } from 'antd';
|
|
2
|
+
import { escapeRegExp } from 'lodash-es';
|
|
2
3
|
import React, { memo, useMemo } from 'react';
|
|
3
4
|
import Typography from "../../../Typography";
|
|
4
5
|
import { useStyles } from "./style";
|
|
@@ -23,7 +24,7 @@ export var MentionMenuItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
23
24
|
var middle = '';
|
|
24
25
|
var after = '';
|
|
25
26
|
if (queryString) {
|
|
26
|
-
var regex = new RegExp(queryString, 'i');
|
|
27
|
+
var regex = new RegExp(escapeRegExp(queryString), 'i');
|
|
27
28
|
var match = regex.exec(option.label);
|
|
28
29
|
if (match) {
|
|
29
30
|
before = label.slice(0, Math.max(0, match.index));
|