@ckeditor/ckeditor5-mention 42.0.2 → 43.0.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-mention",
3
- "version": "42.0.2",
3
+ "version": "43.0.0-alpha.0",
4
4
  "description": "Mention feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -13,11 +13,11 @@
13
13
  "type": "module",
14
14
  "main": "src/index.js",
15
15
  "dependencies": {
16
- "@ckeditor/ckeditor5-core": "42.0.2",
17
- "@ckeditor/ckeditor5-typing": "42.0.2",
18
- "@ckeditor/ckeditor5-ui": "42.0.2",
19
- "@ckeditor/ckeditor5-utils": "42.0.2",
20
- "ckeditor5": "42.0.2",
16
+ "@ckeditor/ckeditor5-core": "43.0.0-alpha.0",
17
+ "@ckeditor/ckeditor5-typing": "43.0.0-alpha.0",
18
+ "@ckeditor/ckeditor5-ui": "43.0.0-alpha.0",
19
+ "@ckeditor/ckeditor5-utils": "43.0.0-alpha.0",
20
+ "ckeditor5": "43.0.0-alpha.0",
21
21
  "lodash-es": "4.17.21"
22
22
  },
23
23
  "author": "CKSource (http://cksource.com/)",
package/src/mentionui.js CHANGED
@@ -525,7 +525,13 @@ export function createRegExp(marker, minimumCharacters) {
525
525
  const numberOfCharacters = minimumCharacters == 0 ? '*' : `{${minimumCharacters},}`;
526
526
  const openAfterCharacters = env.features.isRegExpUnicodePropertySupported ? '\\p{Ps}\\p{Pi}"\'' : '\\(\\[{"\'';
527
527
  const mentionCharacters = '.';
528
+ // I wanted to make an util out of it, but since this regexp uses "u" flag, it became difficult.
529
+ // When "u" flag is used, the regexp has "strict" escaping rules, i.e. if you try to escape a character that does not need
530
+ // to be escaped, RegExp() will throw. It made it difficult to write a generic util, because different characters are
531
+ // allowed in different context. For example, escaping "-" sometimes was correct, but sometimes it threw an error.
532
+ marker = marker.replace(/[.*+?^${}()\-|[\]\\]/g, '\\$&');
528
533
  // The pattern consists of 3 groups:
534
+ //
529
535
  // - 0 (non-capturing): Opening sequence - start of the line, space or an opening punctuation character like "(" or "\"",
530
536
  // - 1: The marker character,
531
537
  // - 2: Mention input (taking the minimal length into consideration to trigger the UI),