@atlaskit/editor-plugin-emoji 12.0.14 → 12.1.0
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 +21 -0
- package/EmojiNodeDataProvider/package.json +1 -8
- package/dist/cjs/nodeviews/EmojiNodeView.js +18 -3
- package/dist/es2019/nodeviews/EmojiNodeView.js +19 -3
- package/dist/esm/nodeviews/EmojiNodeView.js +18 -3
- package/emojiPlugin/package.json +1 -8
- package/emojiPluginType/package.json +1 -8
- package/package.json +5 -2
- package/dist/types-ts4.5/editor-commands/insert-emoji.d.ts +0 -7
- package/dist/types-ts4.5/emojiPlugin.d.ts +0 -28
- package/dist/types-ts4.5/emojiPluginType.d.ts +0 -74
- package/dist/types-ts4.5/entry-points/EmojiNodeDataProvider.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/emojiPlugin.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/emojiPluginType.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -3
- package/dist/types-ts4.5/nodeviews/EmojiNodeView.d.ts +0 -57
- package/dist/types-ts4.5/nodeviews/emojiNodeSpec.d.ts +0 -9
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +0 -15
- package/dist/types-ts4.5/pm-plugins/ascii-input-rules.d.ts +0 -9
- package/dist/types-ts4.5/pm-plugins/providers/EmojiNodeDataProvider.d.ts +0 -35
- package/dist/types-ts4.5/ui/InlineEmojiPopup.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-emoji
|
|
2
2
|
|
|
3
|
+
## 12.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f0ba9072fb20c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f0ba9072fb20c) -
|
|
8
|
+
[ux] Add feature gate `platform_editor_custom_emoji_unicode_fallback` to render the Unicode
|
|
9
|
+
Replacement Character (U+FFFD) instead of the shortName text when a custom emoji image cannot be
|
|
10
|
+
rendered. Applies to both the editor (EmojiNodeView fallback) and the renderer (plain-span
|
|
11
|
+
fallback when no emoji provider is configured). Standard emojis continue to fall back to their
|
|
12
|
+
Unicode text representation. When the gate is off, behavior is unchanged in both surfaces.
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 12.0.15
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 12.0.14
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/EmojiNodeDataProvider.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/EmojiNodeDataProvider.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/EmojiNodeDataProvider.d.ts"
|
|
17
10
|
}
|
|
@@ -18,6 +18,7 @@ var _emoji = require("@atlaskit/editor-common/emoji");
|
|
|
18
18
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
19
19
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
20
20
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
22
23
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
24
|
var _emojiNodeSpec = require("./emojiNodeSpec");
|
|
@@ -33,7 +34,7 @@ function isSingleEmoji(fallbackText) {
|
|
|
33
34
|
// Regular expression to match a single emoji character
|
|
34
35
|
var emojiRegex =
|
|
35
36
|
// @ts-ignore - TS1501 TypeScript 5.9.2 upgrade
|
|
36
|
-
/^((?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])
|
|
37
|
+
/^((?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])(?:(?:\uD83C[\uDFFB-\uDFFF]))?|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F(?:(?:\uD83C[\uDFFB-\uDFFF]))?(?:\u200D(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?)*|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?(?:\u200D(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?)+|(?:\uD83C[\uDDE6-\uDDFF])(?:\uD83C[\uDDE6-\uDDFF]))$/;
|
|
37
38
|
return emojiRegex.test(fallbackText);
|
|
38
39
|
}
|
|
39
40
|
|
|
@@ -230,8 +231,22 @@ var EmojiNodeView = exports.EmojiNodeView = /*#__PURE__*/function () {
|
|
|
230
231
|
doc = document;
|
|
231
232
|
}
|
|
232
233
|
var fallbackElement = doc.createElement('span');
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
var _this$node$attrs2 = this.node.attrs,
|
|
235
|
+
text = _this$node$attrs2.text,
|
|
236
|
+
shortName = _this$node$attrs2.shortName;
|
|
237
|
+
|
|
238
|
+
// When the gate is enabled and the emoji is "custom" (i.e. its fallback
|
|
239
|
+
// text is not a single standard Unicode emoji), render the Unicode
|
|
240
|
+
// Replacement Character (U+FFFD) instead of the shortName text. Standard
|
|
241
|
+
// emojis continue to fall back to their Unicode text representation.
|
|
242
|
+
var fallbackText = text || shortName;
|
|
243
|
+
var useReplacementChar = (0, _platformFeatureFlags.fg)('platform_editor_custom_emoji_unicode_fallback') && !isSingleEmoji(fallbackText);
|
|
244
|
+
var renderedFallbackText = useReplacementChar ? "\uFFFD" : fallbackText;
|
|
245
|
+
fallbackElement.innerText = renderedFallbackText;
|
|
246
|
+
fallbackElement.setAttribute('role', 'img');
|
|
247
|
+
fallbackElement.setAttribute('title', shortName);
|
|
248
|
+
fallbackElement.setAttribute('aria-label', shortName);
|
|
249
|
+
fallbackElement.setAttribute('data-testid', "fallback-emoji-".concat(shortName));
|
|
235
250
|
fallbackElement.setAttribute('data-emoji-type', 'fallback');
|
|
236
251
|
this.dom.appendChild(fallbackElement);
|
|
237
252
|
}
|
|
@@ -6,6 +6,7 @@ import { messages, EmojiSharedCssClassName, defaultEmojiHeight } from '@atlaskit
|
|
|
6
6
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
7
7
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
8
8
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { emojiToDom } from './emojiNodeSpec';
|
|
@@ -21,7 +22,7 @@ export function isSingleEmoji(fallbackText) {
|
|
|
21
22
|
// Regular expression to match a single emoji character
|
|
22
23
|
const emojiRegex =
|
|
23
24
|
// @ts-ignore - TS1501 TypeScript 5.9.2 upgrade
|
|
24
|
-
/^(\p{Emoji_Presentation}
|
|
25
|
+
/^(\p{Emoji_Presentation}(?:[\u{1F3FB}-\u{1F3FF}])?|\p{Extended_Pictographic}\u{FE0F}(?:[\u{1F3FB}-\u{1F3FF}])?(?:\u{200D}\p{Extended_Pictographic}\u{FE0F}?(?:[\u{1F3FB}-\u{1F3FF}])?)*|\p{Extended_Pictographic}\u{FE0F}?(?:[\u{1F3FB}-\u{1F3FF}])?(?:\u{200D}\p{Extended_Pictographic}\u{FE0F}?(?:[\u{1F3FB}-\u{1F3FF}])?)+|\p{Regional_Indicator}\p{Regional_Indicator})$/u;
|
|
25
26
|
return emojiRegex.test(fallbackText);
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -198,8 +199,23 @@ export class EmojiNodeView {
|
|
|
198
199
|
doc = document;
|
|
199
200
|
}
|
|
200
201
|
const fallbackElement = doc.createElement('span');
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
const {
|
|
203
|
+
text,
|
|
204
|
+
shortName
|
|
205
|
+
} = this.node.attrs;
|
|
206
|
+
|
|
207
|
+
// When the gate is enabled and the emoji is "custom" (i.e. its fallback
|
|
208
|
+
// text is not a single standard Unicode emoji), render the Unicode
|
|
209
|
+
// Replacement Character (U+FFFD) instead of the shortName text. Standard
|
|
210
|
+
// emojis continue to fall back to their Unicode text representation.
|
|
211
|
+
const fallbackText = text || shortName;
|
|
212
|
+
const useReplacementChar = fg('platform_editor_custom_emoji_unicode_fallback') && !isSingleEmoji(fallbackText);
|
|
213
|
+
const renderedFallbackText = useReplacementChar ? '\uFFFD' : fallbackText;
|
|
214
|
+
fallbackElement.innerText = renderedFallbackText;
|
|
215
|
+
fallbackElement.setAttribute('role', 'img');
|
|
216
|
+
fallbackElement.setAttribute('title', shortName);
|
|
217
|
+
fallbackElement.setAttribute('aria-label', shortName);
|
|
218
|
+
fallbackElement.setAttribute('data-testid', `fallback-emoji-${shortName}`);
|
|
203
219
|
fallbackElement.setAttribute('data-emoji-type', 'fallback');
|
|
204
220
|
this.dom.appendChild(fallbackElement);
|
|
205
221
|
}
|
|
@@ -10,6 +10,7 @@ import { messages, EmojiSharedCssClassName, defaultEmojiHeight } from '@atlaskit
|
|
|
10
10
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
11
11
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
12
12
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { emojiToDom } from './emojiNodeSpec';
|
|
@@ -25,7 +26,7 @@ export function isSingleEmoji(fallbackText) {
|
|
|
25
26
|
// Regular expression to match a single emoji character
|
|
26
27
|
var emojiRegex =
|
|
27
28
|
// @ts-ignore - TS1501 TypeScript 5.9.2 upgrade
|
|
28
|
-
/^((?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])
|
|
29
|
+
/^((?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8])(?:(?:\uD83C[\uDFFB-\uDFFF]))?|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F(?:(?:\uD83C[\uDFFB-\uDFFF]))?(?:\u200D(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?)*|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?(?:\u200D(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDC2C-\uDC2F\uDC94-\uDC9F\uDCAF\uDCB0\uDCC0\uDCCF\uDCD0\uDCF6-\uDCFF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAE-\uDDE5\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDE5F\uDE66-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFA]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDEE5\uDEE9\uDEEB-\uDEF0\uDEF3-\uDEFF\uDFDA-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE\uDCAF\uDCBC-\uDCBF\uDCC2-\uDCCF\uDCD9-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE58-\uDE5F\uDE6E-\uDEFF]|\uD83F[\uDC00-\uDFFD])\uFE0F?(?:(?:\uD83C[\uDFFB-\uDFFF]))?)+|(?:\uD83C[\uDDE6-\uDDFF])(?:\uD83C[\uDDE6-\uDDFF]))$/;
|
|
29
30
|
return emojiRegex.test(fallbackText);
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -222,8 +223,22 @@ export var EmojiNodeView = /*#__PURE__*/function () {
|
|
|
222
223
|
doc = document;
|
|
223
224
|
}
|
|
224
225
|
var fallbackElement = doc.createElement('span');
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
var _this$node$attrs2 = this.node.attrs,
|
|
227
|
+
text = _this$node$attrs2.text,
|
|
228
|
+
shortName = _this$node$attrs2.shortName;
|
|
229
|
+
|
|
230
|
+
// When the gate is enabled and the emoji is "custom" (i.e. its fallback
|
|
231
|
+
// text is not a single standard Unicode emoji), render the Unicode
|
|
232
|
+
// Replacement Character (U+FFFD) instead of the shortName text. Standard
|
|
233
|
+
// emojis continue to fall back to their Unicode text representation.
|
|
234
|
+
var fallbackText = text || shortName;
|
|
235
|
+
var useReplacementChar = fg('platform_editor_custom_emoji_unicode_fallback') && !isSingleEmoji(fallbackText);
|
|
236
|
+
var renderedFallbackText = useReplacementChar ? "\uFFFD" : fallbackText;
|
|
237
|
+
fallbackElement.innerText = renderedFallbackText;
|
|
238
|
+
fallbackElement.setAttribute('role', 'img');
|
|
239
|
+
fallbackElement.setAttribute('title', shortName);
|
|
240
|
+
fallbackElement.setAttribute('aria-label', shortName);
|
|
241
|
+
fallbackElement.setAttribute('data-testid', "fallback-emoji-".concat(shortName));
|
|
227
242
|
fallbackElement.setAttribute('data-emoji-type', 'fallback');
|
|
228
243
|
this.dom.appendChild(fallbackElement);
|
|
229
244
|
}
|
package/emojiPlugin/package.json
CHANGED
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/emojiPlugin.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/emojiPlugin.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/emojiPlugin.d.ts"
|
|
17
10
|
}
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/entry-points/emojiPluginType.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/entry-points/emojiPluginType.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/entry-points/emojiPluginType.d.ts"
|
|
17
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-emoji",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"description": "Emoji plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/node-data-provider": "^12.0.0",
|
|
38
38
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
39
39
|
"@atlaskit/prosemirror-input-rules": "^3.7.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
40
|
+
"@atlaskit/tmp-editor-statsig": "^103.0.0",
|
|
41
41
|
"@atlaskit/tokens": "^13.4.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
43
43
|
"@emotion/react": "^11.7.1",
|
|
@@ -110,6 +110,9 @@
|
|
|
110
110
|
},
|
|
111
111
|
"platform_twemoji_removal_unicode_emojis": {
|
|
112
112
|
"type": "boolean"
|
|
113
|
+
},
|
|
114
|
+
"platform_editor_custom_emoji_unicode_fallback": {
|
|
115
|
+
"type": "boolean"
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
|
-
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { Node, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { EmojiId } from '@atlaskit/emoji';
|
|
6
|
-
export declare const createEmojiFragment: (doc: Node, pos: ResolvedPos, emoji: EmojiId) => Fragment;
|
|
7
|
-
export declare const insertEmoji: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
|
|
4
|
-
import type { EmojiPlugin, EmojiPluginState } from './emojiPluginType';
|
|
5
|
-
export declare const emojiToTypeaheadItem: (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem;
|
|
6
|
-
export declare function memoize<ResultFn extends (emoji: EmojiDescription, emojiProvider?: EmojiProvider) => TypeAheadItem>(fn: ResultFn): {
|
|
7
|
-
call: ResultFn;
|
|
8
|
-
clear: () => void;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Emoji plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
12
|
-
* from `@atlaskit/editor-core`.
|
|
13
|
-
*/
|
|
14
|
-
export declare const emojiPlugin: EmojiPlugin;
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* Wrapper to call `onLimitReached` when a specified number of calls of that function
|
|
18
|
-
* have been made within a time period.
|
|
19
|
-
*
|
|
20
|
-
* Note: It does not rate limit
|
|
21
|
-
*
|
|
22
|
-
* @param fn Function to wrap
|
|
23
|
-
* @param limitTime Time limit in milliseconds
|
|
24
|
-
* @param limitCount Number of function calls before `onRateReached` is called (per time period)
|
|
25
|
-
* @returns Wrapped function
|
|
26
|
-
*/
|
|
27
|
-
export declare function createRateLimitReachedFunction<LimitedFunction extends (...args: any[]) => any>(fn: Function, limitTime: number, limitCount: number, onLimitReached: () => void): (...args: Parameters<LimitedFunction>) => ReturnType<LimitedFunction> | undefined;
|
|
28
|
-
export declare const emojiPluginKey: PluginKey<EmojiPluginState>;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
-
import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
|
|
5
|
-
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
6
|
-
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
7
|
-
import type { EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
8
|
-
import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
9
|
-
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
10
|
-
import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
11
|
-
import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
12
|
-
import type { EmojiNodeDataProvider } from './pm-plugins/providers/EmojiNodeDataProvider';
|
|
13
|
-
type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod) => Command;
|
|
14
|
-
type AnnotationPluginType = NextEditorPlugin<'annotation', {
|
|
15
|
-
actions: {
|
|
16
|
-
setInlineCommentDraftState: SetInlineCommentDraftState;
|
|
17
|
-
};
|
|
18
|
-
sharedState: {
|
|
19
|
-
annotations: InlineCommentMap;
|
|
20
|
-
bookmark?: SelectionBookmark;
|
|
21
|
-
isVisible: boolean;
|
|
22
|
-
mouseData: {
|
|
23
|
-
isSelecting: boolean;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
|
-
type EditorViewModePluginType = NextEditorPlugin<'editorViewMode', {
|
|
28
|
-
sharedState: EditorViewModePluginState;
|
|
29
|
-
}>;
|
|
30
|
-
export interface EmojiPluginOptions {
|
|
31
|
-
disableAutoformat?: boolean;
|
|
32
|
-
emojiNodeDataProvider?: EmojiNodeDataProvider;
|
|
33
|
-
emojiProvider?: Promise<EmojiProvider>;
|
|
34
|
-
headless?: boolean;
|
|
35
|
-
}
|
|
36
|
-
export type EmojiPluginState = {
|
|
37
|
-
asciiMap?: Map<string, EmojiDescription>;
|
|
38
|
-
emojiProvider?: EmojiProvider;
|
|
39
|
-
/**
|
|
40
|
-
* Occassionally it may be more convenient to deal with the
|
|
41
|
-
* promise version of the emoji provider. This is available
|
|
42
|
-
* immediately if used for the initial configuration
|
|
43
|
-
*/
|
|
44
|
-
emojiProviderPromise?: Promise<EmojiProvider>;
|
|
45
|
-
emojiResourceConfig?: EmojiResourceConfig;
|
|
46
|
-
inlineEmojiPopupOpen?: boolean;
|
|
47
|
-
};
|
|
48
|
-
export type EmojiPluginSharedState = EmojiPluginState & {
|
|
49
|
-
typeAheadHandler: TypeAheadHandler;
|
|
50
|
-
};
|
|
51
|
-
export type EmojiPluginCommands = {
|
|
52
|
-
insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
53
|
-
};
|
|
54
|
-
export type EmojiPluginActions = {
|
|
55
|
-
openTypeAhead: (inputMethod: TypeAheadInputMethod) => boolean;
|
|
56
|
-
setProvider: (provider: Promise<EmojiProvider>) => Promise<boolean>;
|
|
57
|
-
};
|
|
58
|
-
export type EmojiPluginDependencies = [
|
|
59
|
-
OptionalPlugin<AnalyticsPlugin>,
|
|
60
|
-
TypeAheadPlugin,
|
|
61
|
-
OptionalPlugin<AnnotationPluginType>,
|
|
62
|
-
OptionalPlugin<EditorViewModePluginType>,
|
|
63
|
-
OptionalPlugin<BasePlugin>,
|
|
64
|
-
OptionalPlugin<MetricsPlugin>,
|
|
65
|
-
OptionalPlugin<ConnectivityPlugin>
|
|
66
|
-
];
|
|
67
|
-
export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
68
|
-
actions: EmojiPluginActions;
|
|
69
|
-
commands: EmojiPluginCommands;
|
|
70
|
-
dependencies: EmojiPluginDependencies;
|
|
71
|
-
pluginConfiguration: EmojiPluginOptions | undefined;
|
|
72
|
-
sharedState: EmojiPluginSharedState | undefined;
|
|
73
|
-
}>;
|
|
74
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EmojiNodeDataProvider } from '../pm-plugins/providers/EmojiNodeDataProvider';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { emojiPlugin } from '../emojiPlugin';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { EmojiPlugin, EmojiPluginOptions, EmojiPluginState, EmojiPluginSharedState, EmojiPluginDependencies, EmojiPluginActions, EmojiPluginCommands, } from '../emojiPluginType';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export type { EmojiPlugin, EmojiPluginOptions, EmojiPluginState, EmojiPluginSharedState, EmojiPluginDependencies, EmojiPluginActions, EmojiPluginCommands, } from './emojiPluginType';
|
|
2
|
-
export { emojiPlugin } from './emojiPlugin';
|
|
3
|
-
export { EmojiNodeDataProvider } from './pm-plugins/providers/EmojiNodeDataProvider';
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { EmojiPlugin } from '../emojiPluginType';
|
|
6
|
-
import type { EmojiNodeDataProvider } from '../pm-plugins/providers/EmojiNodeDataProvider';
|
|
7
|
-
interface Params {
|
|
8
|
-
api: ExtractInjectionAPI<EmojiPlugin> | undefined;
|
|
9
|
-
emojiNodeDataProvider?: EmojiNodeDataProvider;
|
|
10
|
-
intl: IntlShape;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Check if we can nicely fallback to the nodes text
|
|
14
|
-
*
|
|
15
|
-
* @param fallbackText string of the nodes fallback text
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* isSingleEmoji('😀') // true
|
|
19
|
-
*/
|
|
20
|
-
export declare function isSingleEmoji(fallbackText: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Emoji node view for renderering emoji nodes
|
|
23
|
-
*/
|
|
24
|
-
export declare class EmojiNodeView implements NodeView {
|
|
25
|
-
dom: Node;
|
|
26
|
-
domElement: HTMLElement | undefined;
|
|
27
|
-
private readonly node;
|
|
28
|
-
private readonly intl;
|
|
29
|
-
private renderingFallback;
|
|
30
|
-
readonly destroy: () => void;
|
|
31
|
-
private static logError;
|
|
32
|
-
/**
|
|
33
|
-
* Prosemirror node view for rendering emoji nodes. This class is responsible for
|
|
34
|
-
* rendering emoji nodes in the editor, handling updates, and managing fallback rendering.
|
|
35
|
-
*
|
|
36
|
-
* @param node - The ProseMirror node representing the emoji.
|
|
37
|
-
* @param extraProps - An object containing additional parameters.
|
|
38
|
-
* @param extraProps.intl - The internationalization object for formatting messages.
|
|
39
|
-
* @param extraProps.api - The editor API for accessing shared state and connectivity features.
|
|
40
|
-
* @param extraProps.emojiNodeDataProvider - (Optional) A provider for fetching emoji data.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const emojiNodeView = new EmojiNodeView(node, { intl, api, emojiNodeDataProvider });
|
|
44
|
-
*/
|
|
45
|
-
constructor(node: PMNode, { intl, api, emojiNodeDataProvider }: Params);
|
|
46
|
-
/** Type guard to check if a Node is an HTMLElement in a safe way. */
|
|
47
|
-
private isHTMLElement;
|
|
48
|
-
private updateDom;
|
|
49
|
-
private static isEmojiRepresentationSupported;
|
|
50
|
-
private cleanUpAndRenderCommonAttributes;
|
|
51
|
-
private renderFallback;
|
|
52
|
-
private renderEmoji;
|
|
53
|
-
private createUnicodeEmojiElement;
|
|
54
|
-
private createSpriteEmojiElement;
|
|
55
|
-
private createImageEmojiElement;
|
|
56
|
-
}
|
|
57
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper for ADF emoji node spec to augment toDOM implementation
|
|
4
|
-
* with fallback UI for lazy node view rendering / window virtualization
|
|
5
|
-
* @nodeSpecException:toDOM patch
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare const emojiNodeSpec: () => NodeSpec;
|
|
9
|
-
export declare function emojiToDom(node: PMNode): DOMOutputSpec;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { TypeAheadHandler, TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { EmojiDescription, EmojiProvider } from '@atlaskit/emoji';
|
|
5
|
-
import type { EmojiPlugin } from '../emojiPluginType';
|
|
6
|
-
export declare const ACTIONS: {
|
|
7
|
-
SET_PROVIDER: string;
|
|
8
|
-
SET_RESULTS: string;
|
|
9
|
-
SET_ASCII_MAP: string;
|
|
10
|
-
SET_INLINE_POPUP: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const setAsciiMap: (asciiMap: Map<string, EmojiDescription>) => (tr: Transaction) => Transaction;
|
|
13
|
-
export declare const openTypeAhead: (typeaheadHandler: TypeAheadHandler, api?: PublicPluginAPI<EmojiPlugin>) => (inputMethod: TypeAheadInputMethod) => boolean;
|
|
14
|
-
export declare const setProvider: (provider?: EmojiProvider) => (tr: Transaction) => Transaction;
|
|
15
|
-
export declare const setInlineEmojiPopupOpen: (open: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
-
import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
-
import type { EmojiPlugin } from '../emojiPluginType';
|
|
7
|
-
export declare function inputRulePlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, pluginInjectionApi: ExtractInjectionAPI<EmojiPlugin> | undefined, disableAutoformat?: boolean): SafePlugin | undefined;
|
|
8
|
-
declare const plugins: (schema: Schema, providerFactory: ProviderFactory, featureFlags: FeatureFlags, editorAnalyticsAPI: EditorAnalyticsAPI | undefined, pluginInjectionApi: ExtractInjectionAPI<EmojiPlugin> | undefined) => SafePlugin[];
|
|
9
|
-
export default plugins;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { EmojiDefinition } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { JSONNode } from '@atlaskit/editor-json-transformer';
|
|
3
|
-
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
-
import type { EmojiResource, OptionalEmojiDescriptionWithVariations } from '@atlaskit/emoji';
|
|
5
|
-
import { NodeDataProvider } from '@atlaskit/node-data-provider';
|
|
6
|
-
export declare class EmojiNodeDataProvider extends NodeDataProvider<EmojiDefinition, OptionalEmojiDescriptionWithVariations> {
|
|
7
|
-
name: "emojiNodeDataProvider";
|
|
8
|
-
private readonly emojiResource;
|
|
9
|
-
private readonly emojiProvider;
|
|
10
|
-
constructor(resource: EmojiResource);
|
|
11
|
-
isNodeSupported(node: JSONNode): node is EmojiDefinition;
|
|
12
|
-
nodeDataKey(node: EmojiDefinition): string;
|
|
13
|
-
/**
|
|
14
|
-
* Implementing different re-fetching strategy for emoji.
|
|
15
|
-
*
|
|
16
|
-
* Default strategy for NodeDataProvider is to:
|
|
17
|
-
* 1. If entry is in cache = return from cache
|
|
18
|
-
* 2. Re-fetch data.
|
|
19
|
-
* 3. Update cache
|
|
20
|
-
* 4. Re-render node with fresh data.
|
|
21
|
-
*
|
|
22
|
-
* This is similar, but doesn't update the node.
|
|
23
|
-
* 1. If entry is in cache = return from cache
|
|
24
|
-
* 2. Re-fetch data.
|
|
25
|
-
* 3. Update cache
|
|
26
|
-
*/
|
|
27
|
-
getData(node: EmojiDefinition | PMNode, callback: (payload: {
|
|
28
|
-
data: OptionalEmojiDescriptionWithVariations;
|
|
29
|
-
error?: undefined;
|
|
30
|
-
} | {
|
|
31
|
-
data?: undefined;
|
|
32
|
-
error: Error;
|
|
33
|
-
}) => void): void;
|
|
34
|
-
fetchNodesData(nodes: EmojiDefinition[]): Promise<OptionalEmojiDescriptionWithVariations[]>;
|
|
35
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { EmojiPlugin } from '../emojiPluginType';
|
|
5
|
-
type InlineEmojiPopupProps = Pick<UiComponentFactoryParams, 'popupsBoundariesElement' | 'popupsMountPoint' | 'popupsScrollableElement'> & {
|
|
6
|
-
api: ExtractInjectionAPI<EmojiPlugin>;
|
|
7
|
-
editorView: EditorView;
|
|
8
|
-
};
|
|
9
|
-
export declare const InlineEmojiPopupOld: ({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorView, onClose, }: InlineEmojiPopupProps & {
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
}) => React.JSX.Element | null;
|
|
12
|
-
export declare const InlineEmojiPopup: React.MemoExoticComponent<({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, editorView, }: InlineEmojiPopupProps) => React.JSX.Element | null>;
|
|
13
|
-
export {};
|