@atlaskit/editor-plugin-emoji 7.7.2 → 7.7.3

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,13 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 7.7.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ada8445a9624f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ada8445a9624f) -
8
+ Add experiment to fix ascii emoji replacement behaviour
9
+ - Updated dependencies
10
+
3
11
  ## 7.7.2
4
12
 
5
13
  ### Patch Changes
@@ -29,7 +29,7 @@ function inputRulePlugin(schema, editorAnalyticsAPI, pluginInjectionApi, disable
29
29
  }
30
30
  if (schema.nodes.emoji) {
31
31
  initMatcher(pluginInjectionApi);
32
- var asciiEmojiRule = (0, _utils.createRule)(AsciiEmojiMatcher.REGEX, inputRuleHandler(editorAnalyticsAPI));
32
+ var asciiEmojiRule = (0, _utils.createRule)((0, _expValEquals.expValEquals)('platform_editor_wait_for_space_after_ascii_emoji', 'isEnabled', true) ? AsciiEmojiMatcher.REGEX_WITH_WHITESPACE : AsciiEmojiMatcher.REGEX_LEGACY, inputRuleHandler(editorAnalyticsAPI));
33
33
  return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('emoji', [asciiEmojiRule]));
34
34
  }
35
35
  return;
@@ -131,9 +131,14 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
131
131
  *
132
132
  * See https://regex101.com/r/HRS9O2/4
133
133
  */
134
+ // New behavior: All emoticons require whitespace after them
134
135
  // Ignored via go/ees005
135
136
  // eslint-disable-next-line require-unicode-regexp
136
- (0, _defineProperty2.default)(AsciiEmojiMatcher, "REGEX", new RegExp("((?:^|[\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
137
+ (0, _defineProperty2.default)(AsciiEmojiMatcher, "REGEX_WITH_WHITESPACE", new RegExp("((?:^|[\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3})([\\s\\t\\n])$")));
138
+ // Legacy behavior: Non-colon emoticons don't require whitespace
139
+ // Ignored via go/ees005
140
+ // eslint-disable-next-line require-unicode-regexp
141
+ (0, _defineProperty2.default)(AsciiEmojiMatcher, "REGEX_LEGACY", new RegExp("((?:^|[\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
137
142
  var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher2) {
138
143
  function RecordingAsciiEmojiMatcher(emojiProvider, asciiToEmojiMap) {
139
144
  var _this;
@@ -11,7 +11,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI, pluginInjectionApi,
11
11
  }
12
12
  if (schema.nodes.emoji) {
13
13
  initMatcher(pluginInjectionApi);
14
- const asciiEmojiRule = createRule(AsciiEmojiMatcher.REGEX, inputRuleHandler(editorAnalyticsAPI));
14
+ const asciiEmojiRule = createRule(expValEquals('platform_editor_wait_for_space_after_ascii_emoji', 'isEnabled', true) ? AsciiEmojiMatcher.REGEX_WITH_WHITESPACE : AsciiEmojiMatcher.REGEX_LEGACY, inputRuleHandler(editorAnalyticsAPI));
15
15
  return new SafePlugin(createPlugin('emoji', [asciiEmojiRule]));
16
16
  }
17
17
  return;
@@ -95,9 +95,14 @@ class AsciiEmojiMatcher {
95
95
  *
96
96
  * See https://regex101.com/r/HRS9O2/4
97
97
  */
98
+ // New behavior: All emoticons require whitespace after them
98
99
  // Ignored via go/ees005
99
100
  // eslint-disable-next-line require-unicode-regexp
100
- _defineProperty(AsciiEmojiMatcher, "REGEX", new RegExp(`((?:^|[\\s${leafNodeReplacementCharacter}])(?:\\(*?))(\\(?)([^:\\s${leafNodeReplacementCharacter}\\(]\\S{1,3}|:\\S{1,3}( ))$`));
101
+ _defineProperty(AsciiEmojiMatcher, "REGEX_WITH_WHITESPACE", new RegExp(`((?:^|[\\s${leafNodeReplacementCharacter}])(?:\\(*?))(\\(?)([^:\\s${leafNodeReplacementCharacter}\\(]\\S{1,3}|:\\S{1,3})([\\s\\t\\n])$`));
102
+ // Legacy behavior: Non-colon emoticons don't require whitespace
103
+ // Ignored via go/ees005
104
+ // eslint-disable-next-line require-unicode-regexp
105
+ _defineProperty(AsciiEmojiMatcher, "REGEX_LEGACY", new RegExp(`((?:^|[\\s${leafNodeReplacementCharacter}])(?:\\(*?))(\\(?)([^:\\s${leafNodeReplacementCharacter}\\(]\\S{1,3}|:\\S{1,3}( ))$`));
101
106
  class RecordingAsciiEmojiMatcher extends AsciiEmojiMatcher {
102
107
  constructor(emojiProvider, asciiToEmojiMap) {
103
108
  super(asciiToEmojiMap);
@@ -21,7 +21,7 @@ export function inputRulePlugin(schema, editorAnalyticsAPI, pluginInjectionApi,
21
21
  }
22
22
  if (schema.nodes.emoji) {
23
23
  initMatcher(pluginInjectionApi);
24
- var asciiEmojiRule = createRule(AsciiEmojiMatcher.REGEX, inputRuleHandler(editorAnalyticsAPI));
24
+ var asciiEmojiRule = createRule(expValEquals('platform_editor_wait_for_space_after_ascii_emoji', 'isEnabled', true) ? AsciiEmojiMatcher.REGEX_WITH_WHITESPACE : AsciiEmojiMatcher.REGEX_LEGACY, inputRuleHandler(editorAnalyticsAPI));
25
25
  return new SafePlugin(createPlugin('emoji', [asciiEmojiRule]));
26
26
  }
27
27
  return;
@@ -123,9 +123,14 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
123
123
  *
124
124
  * See https://regex101.com/r/HRS9O2/4
125
125
  */
126
+ // New behavior: All emoticons require whitespace after them
126
127
  // Ignored via go/ees005
127
128
  // eslint-disable-next-line require-unicode-regexp
128
- _defineProperty(AsciiEmojiMatcher, "REGEX", new RegExp("((?:^|[\\s".concat(leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
129
+ _defineProperty(AsciiEmojiMatcher, "REGEX_WITH_WHITESPACE", new RegExp("((?:^|[\\s".concat(leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3})([\\s\\t\\n])$")));
130
+ // Legacy behavior: Non-colon emoticons don't require whitespace
131
+ // Ignored via go/ees005
132
+ // eslint-disable-next-line require-unicode-regexp
133
+ _defineProperty(AsciiEmojiMatcher, "REGEX_LEGACY", new RegExp("((?:^|[\\s".concat(leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
129
134
  var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher2) {
130
135
  function RecordingAsciiEmojiMatcher(emojiProvider, asciiToEmojiMap) {
131
136
  var _this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "7.7.2",
3
+ "version": "7.7.3",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/node-data-provider": "^7.5.0",
36
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
37
37
  "@atlaskit/prosemirror-input-rules": "^3.6.0",
38
- "@atlaskit/tmp-editor-statsig": "^14.2.0",
38
+ "@atlaskit/tmp-editor-statsig": "^14.3.0",
39
39
  "@atlaskit/tokens": "^8.4.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "@emotion/react": "^11.7.1",