@atlaskit/editor-plugin-selection-marker 12.0.9 → 12.0.11

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-selection-marker
2
2
 
3
+ ## 12.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`24d7483e9519e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/24d7483e9519e) -
8
+ Cleans up prefer static regex violations
9
+ - Updated dependencies
10
+
11
+ ## 12.0.10
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 12.0.9
4
18
 
5
19
  ### Patch Changes
@@ -13,6 +13,11 @@ var _view = require("@atlaskit/editor-prosemirror/view");
13
13
  * @jsx jsx
14
14
  */
15
15
 
16
+ // Ignored via go/ees005
17
+ // eslint-disable-next-line require-unicode-regexp
18
+ var MS_PREFIX_REGEX = /^ms/;
19
+ // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
20
+ var NON_WHITESPACE_REGEX = /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
16
21
  var selectionMarkerHighlightStyles = {
17
22
  content: "''",
18
23
  position: 'absolute',
@@ -63,10 +68,11 @@ var selectionMarkerInlineCursorStyles = {
63
68
  */
64
69
  function hyphenate(property) {
65
70
  // Ignored via go/ees005
66
- // eslint-disable-next-line require-unicode-regexp
71
+ /* eslint-disable require-unicode-regexp */
67
72
  return property.replace(/[A-Z]/g, function (match) {
68
73
  return "-".concat(match.toLowerCase());
69
- }).replace(/^ms/, '-ms');
74
+ }).replace(MS_PREFIX_REGEX, '-ms');
75
+ /* eslint-enable require-unicode-regexp */
70
76
  }
71
77
  var Widget = function Widget(_ref) {
72
78
  var type = _ref.type,
@@ -119,9 +125,7 @@ var createWidgetDecoration = exports.createWidgetDecoration = function createWid
119
125
  var areTextNodes = parent.isTextblock && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
120
126
  var lastCharacterOfBeforeNode = nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$textConte = nodeBefore.textContent) === null || _nodeBefore$textConte === void 0 ? void 0 : _nodeBefore$textConte.slice(-1);
121
127
  var firstCharacterOfAfterNode = nodeAfter === null || nodeAfter === void 0 || (_nodeAfter$textConten = nodeAfter.textContent) === null || _nodeAfter$textConten === void 0 ? void 0 : _nodeAfter$textConten.slice(0, 1);
122
- var areAdjacentCharactersNonWhitespace =
123
- // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
124
- /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(lastCharacterOfBeforeNode || '') && /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(firstCharacterOfAfterNode || '');
128
+ var areAdjacentCharactersNonWhitespace = NON_WHITESPACE_REGEX.test(lastCharacterOfBeforeNode || '') && NON_WHITESPACE_REGEX.test(firstCharacterOfAfterNode || '');
125
129
  var isInWord = Boolean(areTextNodes && areAdjacentCharactersNonWhitespace);
126
130
  return [_view.Decoration.widget(resolvedPos.pos, toDOM(type, isHighlight, isInWord), {
127
131
  side: -1,
@@ -5,6 +5,11 @@
5
5
 
6
6
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
8
+ // Ignored via go/ees005
9
+ // eslint-disable-next-line require-unicode-regexp
10
+ const MS_PREFIX_REGEX = /^ms/;
11
+ // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
12
+ const NON_WHITESPACE_REGEX = /\S/u;
8
13
  const selectionMarkerHighlightStyles = {
9
14
  content: "''",
10
15
  position: 'absolute',
@@ -55,8 +60,9 @@ const selectionMarkerInlineCursorStyles = {
55
60
  */
56
61
  function hyphenate(property) {
57
62
  // Ignored via go/ees005
58
- // eslint-disable-next-line require-unicode-regexp
59
- return property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`).replace(/^ms/, '-ms');
63
+ /* eslint-disable require-unicode-regexp */
64
+ return property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`).replace(MS_PREFIX_REGEX, '-ms');
65
+ /* eslint-enable require-unicode-regexp */
60
66
  }
61
67
  const Widget = ({
62
68
  type,
@@ -111,9 +117,7 @@ export const createWidgetDecoration = (resolvedPos, type, selection, isHighlight
111
117
  const areTextNodes = parent.isTextblock && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
112
118
  const lastCharacterOfBeforeNode = nodeBefore === null || nodeBefore === void 0 ? void 0 : (_nodeBefore$textConte = nodeBefore.textContent) === null || _nodeBefore$textConte === void 0 ? void 0 : _nodeBefore$textConte.slice(-1);
113
119
  const firstCharacterOfAfterNode = nodeAfter === null || nodeAfter === void 0 ? void 0 : (_nodeAfter$textConten = nodeAfter.textContent) === null || _nodeAfter$textConten === void 0 ? void 0 : _nodeAfter$textConten.slice(0, 1);
114
- const areAdjacentCharactersNonWhitespace =
115
- // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
116
- /\S/u.test(lastCharacterOfBeforeNode || '') && /\S/u.test(firstCharacterOfAfterNode || '');
120
+ const areAdjacentCharactersNonWhitespace = NON_WHITESPACE_REGEX.test(lastCharacterOfBeforeNode || '') && NON_WHITESPACE_REGEX.test(firstCharacterOfAfterNode || '');
117
121
  const isInWord = Boolean(areTextNodes && areAdjacentCharactersNonWhitespace);
118
122
  return [Decoration.widget(resolvedPos.pos, toDOM(type, isHighlight, isInWord), {
119
123
  side: -1,
@@ -6,6 +6,11 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
 
7
7
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
+ // Ignored via go/ees005
10
+ // eslint-disable-next-line require-unicode-regexp
11
+ var MS_PREFIX_REGEX = /^ms/;
12
+ // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
13
+ var NON_WHITESPACE_REGEX = /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
9
14
  var selectionMarkerHighlightStyles = {
10
15
  content: "''",
11
16
  position: 'absolute',
@@ -56,10 +61,11 @@ var selectionMarkerInlineCursorStyles = {
56
61
  */
57
62
  function hyphenate(property) {
58
63
  // Ignored via go/ees005
59
- // eslint-disable-next-line require-unicode-regexp
64
+ /* eslint-disable require-unicode-regexp */
60
65
  return property.replace(/[A-Z]/g, function (match) {
61
66
  return "-".concat(match.toLowerCase());
62
- }).replace(/^ms/, '-ms');
67
+ }).replace(MS_PREFIX_REGEX, '-ms');
68
+ /* eslint-enable require-unicode-regexp */
63
69
  }
64
70
  var Widget = function Widget(_ref) {
65
71
  var type = _ref.type,
@@ -112,9 +118,7 @@ export var createWidgetDecoration = function createWidgetDecoration(resolvedPos,
112
118
  var areTextNodes = parent.isTextblock && (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.isText) && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText);
113
119
  var lastCharacterOfBeforeNode = nodeBefore === null || nodeBefore === void 0 || (_nodeBefore$textConte = nodeBefore.textContent) === null || _nodeBefore$textConte === void 0 ? void 0 : _nodeBefore$textConte.slice(-1);
114
120
  var firstCharacterOfAfterNode = nodeAfter === null || nodeAfter === void 0 || (_nodeAfter$textConten = nodeAfter.textContent) === null || _nodeAfter$textConten === void 0 ? void 0 : _nodeAfter$textConten.slice(0, 1);
115
- var areAdjacentCharactersNonWhitespace =
116
- // @ts-ignore - TS1501 Older versions of TypeScript don't play nice with the u flag. With the current AFM TypeScript version, this *should* be fine, but the pipeline type check fails, hence why a ts-ignore is needed (over a ts-expect-error)
117
- /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(lastCharacterOfBeforeNode || '') && /(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(firstCharacterOfAfterNode || '');
121
+ var areAdjacentCharactersNonWhitespace = NON_WHITESPACE_REGEX.test(lastCharacterOfBeforeNode || '') && NON_WHITESPACE_REGEX.test(firstCharacterOfAfterNode || '');
118
122
  var isInWord = Boolean(areTextNodes && areAdjacentCharactersNonWhitespace);
119
123
  return [Decoration.widget(resolvedPos.pos, toDOM(type, isHighlight, isInWord), {
120
124
  side: -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-marker",
3
- "version": "12.0.9",
3
+ "version": "12.0.11",
4
4
  "description": "Selection marker plugin for @atlaskit/editor-core.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,17 +27,17 @@
27
27
  "@atlaskit/editor-plugin-type-ahead": "^12.1.0",
28
28
  "@atlaskit/editor-plugin-user-intent": "^10.0.0",
29
29
  "@atlaskit/editor-prosemirror": "^8.0.0",
30
- "@atlaskit/link": "^4.0.0",
30
+ "@atlaskit/link": "^4.1.0",
31
31
  "@atlaskit/platform-feature-flags": "^2.0.0",
32
- "@atlaskit/theme": "^26.0.0",
33
- "@atlaskit/tmp-editor-statsig": "^113.0.0",
34
- "@atlaskit/tokens": "^15.0.0",
32
+ "@atlaskit/theme": "^26.1.0",
33
+ "@atlaskit/tmp-editor-statsig": "^114.4.0",
34
+ "@atlaskit/tokens": "^15.2.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "@emotion/react": "^11.7.1",
37
37
  "lodash": "^4.17.21"
38
38
  },
39
39
  "peerDependencies": {
40
- "@atlaskit/editor-common": "^116.12.0",
40
+ "@atlaskit/editor-common": "^116.17.0",
41
41
  "react": "^18.2.0",
42
42
  "react-dom": "^18.2.0"
43
43
  },