@atlaskit/editor-plugin-emoji 14.0.0 → 14.0.2
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 +14 -0
- package/dist/cjs/emojiPlugin.js +11 -3
- package/dist/cjs/ui/quick-insert/EmojiQuickInsertMenuItem.js +28 -0
- package/dist/cjs/ui/quick-insert/getEmojiQuickInsertComponents.js +21 -0
- package/dist/es2019/emojiPlugin.js +35 -26
- package/dist/es2019/ui/quick-insert/EmojiQuickInsertMenuItem.js +20 -0
- package/dist/es2019/ui/quick-insert/getEmojiQuickInsertComponents.js +13 -0
- package/dist/esm/emojiPlugin.js +11 -3
- package/dist/esm/ui/quick-insert/EmojiQuickInsertMenuItem.js +20 -0
- package/dist/esm/ui/quick-insert/getEmojiQuickInsertComponents.js +15 -0
- package/dist/types/emojiPluginType.d.ts +4 -2
- package/dist/types/ui/quick-insert/EmojiQuickInsertMenuItem.d.ts +2 -0
- package/dist/types/ui/quick-insert/getEmojiQuickInsertComponents.d.ts +2 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-emoji
|
|
2
2
|
|
|
3
|
+
## 14.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7087f393ec725`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7087f393ec725) -
|
|
8
|
+
Add the categorized registered Quick Insert browse experience with representative native elements
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 14.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 14.0.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/cjs/emojiPlugin.js
CHANGED
|
@@ -22,6 +22,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
22
22
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
23
23
|
var _emoji2 = require("@atlaskit/emoji");
|
|
24
24
|
var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
|
|
25
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
25
26
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
27
|
var _insertEmoji = require("./editor-commands/insert-emoji");
|
|
27
28
|
var _emojiNodeSpec = require("./nodeviews/emojiNodeSpec");
|
|
@@ -29,6 +30,7 @@ var _EmojiNodeView = require("./nodeviews/EmojiNodeView");
|
|
|
29
30
|
var _actions = require("./pm-plugins/actions");
|
|
30
31
|
var _asciiInputRules = require("./pm-plugins/ascii-input-rules");
|
|
31
32
|
var _InlineEmojiPopup = require("./ui/InlineEmojiPopup");
|
|
33
|
+
var _getEmojiQuickInsertComponents = require("./ui/quick-insert/getEmojiQuickInsertComponents");
|
|
32
34
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
33
35
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
34
36
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -188,6 +190,11 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
188
190
|
return tr;
|
|
189
191
|
}
|
|
190
192
|
};
|
|
193
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
194
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
195
|
+
var _api$uiControlRegistr;
|
|
196
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getEmojiQuickInsertComponents.getEmojiQuickInsertComponents)());
|
|
197
|
+
}
|
|
191
198
|
api === null || api === void 0 || (_api$base = api.base) === null || _api$base === void 0 || _api$base.actions.registerMarks(function (_ref7) {
|
|
192
199
|
var tr = _ref7.tr,
|
|
193
200
|
node = _ref7.node,
|
|
@@ -306,7 +313,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
306
313
|
popupsScrollableElement: popupsScrollableElement
|
|
307
314
|
});
|
|
308
315
|
},
|
|
309
|
-
pluginsOptions: {
|
|
316
|
+
pluginsOptions: _objectSpread(_objectSpread({}, isRegisteredSlashCommandEnabled ? {} : {
|
|
310
317
|
quickInsert: function quickInsert(_ref10) {
|
|
311
318
|
var formatMessage = _ref10.formatMessage;
|
|
312
319
|
return [{
|
|
@@ -337,7 +344,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
337
344
|
return tr;
|
|
338
345
|
}
|
|
339
346
|
}];
|
|
340
|
-
}
|
|
347
|
+
}
|
|
348
|
+
}), {}, {
|
|
341
349
|
typeAhead: typeAhead,
|
|
342
350
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
343
351
|
var isViewMode = function isViewMode() {
|
|
@@ -398,7 +406,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
398
406
|
}
|
|
399
407
|
};
|
|
400
408
|
}
|
|
401
|
-
}
|
|
409
|
+
})
|
|
402
410
|
};
|
|
403
411
|
};
|
|
404
412
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EmojiQuickInsertMenuItem = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
|
+
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
12
|
+
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
13
|
+
var _actions = require("../../pm-plugins/actions");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
var EmojiQuickInsertMenuItem = exports.EmojiQuickInsertMenuItem = function EmojiQuickInsertMenuItem() {
|
|
16
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
17
|
+
formatMessage = _useIntl.formatMessage;
|
|
18
|
+
var onSelect = (0, _react.useCallback)(function (_ref) {
|
|
19
|
+
var insert = _ref.insert;
|
|
20
|
+
return (0, _actions.setInlineEmojiPopupOpen)(true)(insert(''));
|
|
21
|
+
}, []);
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
23
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_quickInsert.IconEmoji, null),
|
|
24
|
+
onSelect: onSelect,
|
|
25
|
+
shortcut: ":",
|
|
26
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.emoji)
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getEmojiQuickInsertComponents = void 0;
|
|
7
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
8
|
+
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
9
|
+
var _EmojiQuickInsertMenuItem = require("./EmojiQuickInsertMenuItem");
|
|
10
|
+
var getEmojiQuickInsertComponents = exports.getEmojiQuickInsertComponents = function getEmojiQuickInsertComponents() {
|
|
11
|
+
return [{
|
|
12
|
+
key: _keys.EMOJI_MENU_ITEM.key,
|
|
13
|
+
type: _keys.EMOJI_MENU_ITEM.type,
|
|
14
|
+
parents: [{
|
|
15
|
+
key: _keys.MEDIA_SECTION.key,
|
|
16
|
+
type: _keys.MEDIA_SECTION.type,
|
|
17
|
+
rank: _rank.MEDIA_SECTION_RANK[_keys.EMOJI_MENU_ITEM.key]
|
|
18
|
+
}],
|
|
19
|
+
component: _EmojiQuickInsertMenuItem.EmojiQuickInsertMenuItem
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
@@ -9,6 +9,7 @@ import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/
|
|
|
9
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { EmojiTypeAheadItem, preloadEmojiPicker, recordSelectionFailedSli, recordSelectionSucceededSli, SearchSort } from '@atlaskit/emoji';
|
|
11
11
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
12
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
12
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
13
14
|
import { createEmojiFragment, insertEmoji } from './editor-commands/insert-emoji';
|
|
14
15
|
import { emojiNodeSpec } from './nodeviews/emojiNodeSpec';
|
|
@@ -16,6 +17,7 @@ import { EmojiNodeView } from './nodeviews/EmojiNodeView';
|
|
|
16
17
|
import { ACTIONS, openTypeAhead as openTypeAheadAction, setAsciiMap as setAsciiMapAction, setInlineEmojiPopupOpen, setProvider as setProviderAction } from './pm-plugins/actions';
|
|
17
18
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
18
19
|
import { InlineEmojiPopup } from './ui/InlineEmojiPopup';
|
|
20
|
+
import { getEmojiQuickInsertComponents } from './ui/quick-insert/getEmojiQuickInsertComponents';
|
|
19
21
|
export const emojiToTypeaheadItem = (emoji, emojiProvider) => ({
|
|
20
22
|
title: emoji.shortName || '',
|
|
21
23
|
key: emoji.id || emoji.shortName,
|
|
@@ -166,6 +168,11 @@ export const emojiPlugin = ({
|
|
|
166
168
|
return tr;
|
|
167
169
|
}
|
|
168
170
|
};
|
|
171
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
172
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
173
|
+
var _api$uiControlRegistr;
|
|
174
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getEmojiQuickInsertComponents());
|
|
175
|
+
}
|
|
169
176
|
api === null || api === void 0 ? void 0 : (_api$base = api.base) === null || _api$base === void 0 ? void 0 : _api$base.actions.registerMarks(({
|
|
170
177
|
tr,
|
|
171
178
|
node,
|
|
@@ -274,34 +281,36 @@ export const emojiPlugin = ({
|
|
|
274
281
|
});
|
|
275
282
|
},
|
|
276
283
|
pluginsOptions: {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
284
|
+
...(isRegisteredSlashCommandEnabled ? {} : {
|
|
285
|
+
quickInsert: ({
|
|
286
|
+
formatMessage
|
|
287
|
+
}) => [{
|
|
288
|
+
id: 'emoji',
|
|
289
|
+
title: formatMessage(messages.emoji),
|
|
290
|
+
description: formatMessage(messages.emojiDescription),
|
|
291
|
+
priority: 500,
|
|
292
|
+
keyshortcut: ':',
|
|
293
|
+
isDisabledOffline: false,
|
|
294
|
+
icon: () => /*#__PURE__*/React.createElement(IconEmoji, null),
|
|
295
|
+
action(insert) {
|
|
296
|
+
var _api$typeAhead;
|
|
297
|
+
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
298
|
+
exposure: true
|
|
299
|
+
})) {
|
|
300
|
+
// Clear slash
|
|
301
|
+
let tr = insert('');
|
|
302
|
+
tr = setInlineEmojiPopupOpen(true)(tr);
|
|
303
|
+
return tr;
|
|
304
|
+
}
|
|
305
|
+
const tr = insert(undefined);
|
|
306
|
+
api === null || api === void 0 ? void 0 : (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 ? void 0 : _api$typeAhead.actions.openAtTransaction({
|
|
307
|
+
triggerHandler: typeAhead,
|
|
308
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
309
|
+
})(tr);
|
|
295
310
|
return tr;
|
|
296
311
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
triggerHandler: typeAhead,
|
|
300
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
301
|
-
})(tr);
|
|
302
|
-
return tr;
|
|
303
|
-
}
|
|
304
|
-
}],
|
|
312
|
+
}]
|
|
313
|
+
}),
|
|
305
314
|
typeAhead,
|
|
306
315
|
floatingToolbar: (state, intl) => {
|
|
307
316
|
const isViewMode = () => {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { IconEmoji } from '@atlaskit/editor-common/quick-insert';
|
|
5
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
6
|
+
import { setInlineEmojiPopupOpen } from '../../pm-plugins/actions';
|
|
7
|
+
export const EmojiQuickInsertMenuItem = () => {
|
|
8
|
+
const {
|
|
9
|
+
formatMessage
|
|
10
|
+
} = useIntl();
|
|
11
|
+
const onSelect = useCallback(({
|
|
12
|
+
insert
|
|
13
|
+
}) => setInlineEmojiPopupOpen(true)(insert('')), []);
|
|
14
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
15
|
+
iconBefore: /*#__PURE__*/React.createElement(IconEmoji, null),
|
|
16
|
+
onSelect: onSelect,
|
|
17
|
+
shortcut: ":",
|
|
18
|
+
title: formatMessage(messages.emoji)
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EMOJI_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
2
|
+
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
3
|
+
import { EmojiQuickInsertMenuItem } from './EmojiQuickInsertMenuItem';
|
|
4
|
+
export const getEmojiQuickInsertComponents = () => [{
|
|
5
|
+
key: EMOJI_MENU_ITEM.key,
|
|
6
|
+
type: EMOJI_MENU_ITEM.type,
|
|
7
|
+
parents: [{
|
|
8
|
+
key: MEDIA_SECTION.key,
|
|
9
|
+
type: MEDIA_SECTION.type,
|
|
10
|
+
rank: MEDIA_SECTION_RANK[EMOJI_MENU_ITEM.key]
|
|
11
|
+
}],
|
|
12
|
+
component: EmojiQuickInsertMenuItem
|
|
13
|
+
}];
|
package/dist/esm/emojiPlugin.js
CHANGED
|
@@ -14,6 +14,7 @@ import { calculateToolbarPositionAboveSelection } from '@atlaskit/editor-common/
|
|
|
14
14
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
15
15
|
import { EmojiTypeAheadItem, preloadEmojiPicker, recordSelectionFailedSli, recordSelectionSucceededSli, SearchSort } from '@atlaskit/emoji';
|
|
16
16
|
import CommentIcon from '@atlaskit/icon/core/comment';
|
|
17
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
17
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
19
|
import { createEmojiFragment, insertEmoji } from './editor-commands/insert-emoji';
|
|
19
20
|
import { emojiNodeSpec } from './nodeviews/emojiNodeSpec';
|
|
@@ -21,6 +22,7 @@ import { EmojiNodeView } from './nodeviews/EmojiNodeView';
|
|
|
21
22
|
import { ACTIONS, openTypeAhead as openTypeAheadAction, setAsciiMap as setAsciiMapAction, setInlineEmojiPopupOpen, setProvider as setProviderAction } from './pm-plugins/actions';
|
|
22
23
|
import { inputRulePlugin as asciiInputRulePlugin } from './pm-plugins/ascii-input-rules';
|
|
23
24
|
import { InlineEmojiPopup } from './ui/InlineEmojiPopup';
|
|
25
|
+
import { getEmojiQuickInsertComponents } from './ui/quick-insert/getEmojiQuickInsertComponents';
|
|
24
26
|
export var emojiToTypeaheadItem = function emojiToTypeaheadItem(emoji, emojiProvider) {
|
|
25
27
|
return {
|
|
26
28
|
title: emoji.shortName || '',
|
|
@@ -177,6 +179,11 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
177
179
|
return tr;
|
|
178
180
|
}
|
|
179
181
|
};
|
|
182
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
183
|
+
if (isRegisteredSlashCommandEnabled) {
|
|
184
|
+
var _api$uiControlRegistr;
|
|
185
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getEmojiQuickInsertComponents());
|
|
186
|
+
}
|
|
180
187
|
api === null || api === void 0 || (_api$base = api.base) === null || _api$base === void 0 || _api$base.actions.registerMarks(function (_ref7) {
|
|
181
188
|
var tr = _ref7.tr,
|
|
182
189
|
node = _ref7.node,
|
|
@@ -295,7 +302,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
295
302
|
popupsScrollableElement: popupsScrollableElement
|
|
296
303
|
});
|
|
297
304
|
},
|
|
298
|
-
pluginsOptions: {
|
|
305
|
+
pluginsOptions: _objectSpread(_objectSpread({}, isRegisteredSlashCommandEnabled ? {} : {
|
|
299
306
|
quickInsert: function quickInsert(_ref10) {
|
|
300
307
|
var formatMessage = _ref10.formatMessage;
|
|
301
308
|
return [{
|
|
@@ -326,7 +333,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
326
333
|
return tr;
|
|
327
334
|
}
|
|
328
335
|
}];
|
|
329
|
-
}
|
|
336
|
+
}
|
|
337
|
+
}), {}, {
|
|
330
338
|
typeAhead: typeAhead,
|
|
331
339
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
332
340
|
var isViewMode = function isViewMode() {
|
|
@@ -387,7 +395,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
|
|
|
387
395
|
}
|
|
388
396
|
};
|
|
389
397
|
}
|
|
390
|
-
}
|
|
398
|
+
})
|
|
391
399
|
};
|
|
392
400
|
};
|
|
393
401
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
4
|
+
import { IconEmoji } from '@atlaskit/editor-common/quick-insert';
|
|
5
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
6
|
+
import { setInlineEmojiPopupOpen } from '../../pm-plugins/actions';
|
|
7
|
+
export var EmojiQuickInsertMenuItem = function EmojiQuickInsertMenuItem() {
|
|
8
|
+
var _useIntl = useIntl(),
|
|
9
|
+
formatMessage = _useIntl.formatMessage;
|
|
10
|
+
var onSelect = useCallback(function (_ref) {
|
|
11
|
+
var insert = _ref.insert;
|
|
12
|
+
return setInlineEmojiPopupOpen(true)(insert(''));
|
|
13
|
+
}, []);
|
|
14
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
15
|
+
iconBefore: /*#__PURE__*/React.createElement(IconEmoji, null),
|
|
16
|
+
onSelect: onSelect,
|
|
17
|
+
shortcut: ":",
|
|
18
|
+
title: formatMessage(messages.emoji)
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EMOJI_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
2
|
+
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
3
|
+
import { EmojiQuickInsertMenuItem } from './EmojiQuickInsertMenuItem';
|
|
4
|
+
export var getEmojiQuickInsertComponents = function getEmojiQuickInsertComponents() {
|
|
5
|
+
return [{
|
|
6
|
+
key: EMOJI_MENU_ITEM.key,
|
|
7
|
+
type: EMOJI_MENU_ITEM.type,
|
|
8
|
+
parents: [{
|
|
9
|
+
key: MEDIA_SECTION.key,
|
|
10
|
+
type: MEDIA_SECTION.type,
|
|
11
|
+
rank: MEDIA_SECTION_RANK[EMOJI_MENU_ITEM.key]
|
|
12
|
+
}],
|
|
13
|
+
component: EmojiQuickInsertMenuItem
|
|
14
|
+
}];
|
|
15
|
+
};
|
|
@@ -3,10 +3,11 @@ import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin, TypeAhea
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
|
|
5
5
|
import type { BasePlugin } from '@atlaskit/editor-plugin-base';
|
|
6
|
-
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
6
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
7
7
|
import type { EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
8
8
|
import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
9
9
|
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
10
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
|
|
10
11
|
import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
|
|
11
12
|
import type { EmojiDescription, EmojiId, EmojiProvider, EmojiResourceConfig } from '@atlaskit/emoji';
|
|
12
13
|
import type { EmojiNodeDataProvider } from './pm-plugins/providers/EmojiNodeDataProvider';
|
|
@@ -62,7 +63,8 @@ export type EmojiPluginDependencies = [
|
|
|
62
63
|
OptionalPlugin<EditorViewModePluginType>,
|
|
63
64
|
OptionalPlugin<BasePlugin>,
|
|
64
65
|
OptionalPlugin<MetricsPlugin>,
|
|
65
|
-
OptionalPlugin<ConnectivityPlugin
|
|
66
|
+
OptionalPlugin<ConnectivityPlugin>,
|
|
67
|
+
OptionalPlugin<UiControlRegistryPlugin>
|
|
66
68
|
];
|
|
67
69
|
export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
68
70
|
actions: EmojiPluginActions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-emoji",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.2",
|
|
4
4
|
"description": "Emoji plugin for @atlaskit/editor-core",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,14 +30,17 @@
|
|
|
30
30
|
"@atlaskit/editor-plugin-editor-viewmode": "^15.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-metrics": "^14.0.0",
|
|
32
32
|
"@atlaskit/editor-plugin-type-ahead": "^14.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^7.0.0",
|
|
33
34
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
34
35
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
36
|
+
"@atlaskit/editor-ui-control-model": "^2.4.0",
|
|
35
37
|
"@atlaskit/emoji": "^71.15.0",
|
|
36
|
-
"@atlaskit/icon": "^37.
|
|
38
|
+
"@atlaskit/icon": "^37.3.0",
|
|
37
39
|
"@atlaskit/node-data-provider": "^14.0.0",
|
|
40
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
38
41
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
39
42
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
40
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^139.0.0",
|
|
41
44
|
"@atlaskit/tokens": "^16.3.0",
|
|
42
45
|
"@babel/runtime": "^7.0.0",
|
|
43
46
|
"@emotion/react": "^11.7.1",
|
|
@@ -46,7 +49,7 @@
|
|
|
46
49
|
"react-loadable": "^5.1.0"
|
|
47
50
|
},
|
|
48
51
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^117.
|
|
52
|
+
"@atlaskit/editor-common": "^117.2.0",
|
|
50
53
|
"react": "^18.2.0 || ^19.2.0",
|
|
51
54
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
52
55
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|