@atlaskit/editor-plugin-emoji 2.7.21 → 2.7.23

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,22 @@
1
1
  # @atlaskit/editor-plugin-emoji
2
2
 
3
+ ## 2.7.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [#97984](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97984)
8
+ [`8ffeab9aaf1ab`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8ffeab9aaf1ab) -
9
+ [ux] [ED-23573] Added new actions (resolveMarks and registerMarks) to basePlugin. Callbacks added
10
+ to mentions, card, emoji and base plugins to handle conversion to inline code. Deprecated code
11
+ removed from editor-common.
12
+ - Updated dependencies
13
+
14
+ ## 2.7.22
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 2.7.21
4
21
 
5
22
  ### Patch Changes
@@ -85,7 +85,7 @@ var TRIGGER = ':';
85
85
  * from `@atlaskit/editor-core`.
86
86
  */
87
87
  var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
88
- var _api$analytics5;
88
+ var _api$base, _api$analytics5;
89
89
  var options = _ref2.config,
90
90
  api = _ref2.api;
91
91
  var previousEmojiProvider;
@@ -193,6 +193,19 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
193
193
  return tr;
194
194
  }
195
195
  };
196
+ api === null || api === void 0 || (_api$base = api.base) === null || _api$base === void 0 || _api$base.actions.registerMarks(function (_ref7) {
197
+ var tr = _ref7.tr,
198
+ node = _ref7.node,
199
+ pos = _ref7.pos;
200
+ var doc = tr.doc;
201
+ var schema = doc.type.schema;
202
+ var emojiNodeType = schema.nodes.emoji;
203
+ if (node.type === emojiNodeType) {
204
+ var newText = node.attrs.text;
205
+ var currentPos = tr.mapping.map(pos);
206
+ tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
207
+ }
208
+ });
196
209
  return {
197
210
  name: 'emoji',
198
211
  nodes: function nodes() {
@@ -209,9 +222,9 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
209
222
  }
210
223
  }, {
211
224
  name: 'emojiAsciiInputRule',
212
- plugin: function plugin(_ref7) {
225
+ plugin: function plugin(_ref8) {
213
226
  var _api$analytics4;
214
- var schema = _ref7.schema;
227
+ var schema = _ref8.schema;
215
228
  return (0, _asciiInputRules.inputRulePlugin)(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, api);
216
229
  }
217
230
  }];
@@ -221,10 +234,10 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
221
234
  if (!editorState) {
222
235
  return undefined;
223
236
  }
224
- var _ref8 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
225
- emojiResourceConfig = _ref8.emojiResourceConfig,
226
- asciiMap = _ref8.asciiMap,
227
- emojiProvider = _ref8.emojiProvider;
237
+ var _ref9 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
238
+ emojiResourceConfig = _ref9.emojiResourceConfig,
239
+ asciiMap = _ref9.asciiMap,
240
+ emojiProvider = _ref9.emojiProvider;
228
241
  return {
229
242
  emojiResourceConfig: emojiResourceConfig,
230
243
  asciiMap: asciiMap,
@@ -252,8 +265,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
252
265
  return _context.abrupt("return", false);
253
266
  case 5:
254
267
  previousEmojiProvider = provider;
255
- return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref9) {
256
- var tr = _ref9.tr;
268
+ return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref10) {
269
+ var tr = _ref10.tr;
257
270
  return setProviderTr(provider)(tr);
258
271
  })) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
259
272
  case 7:
@@ -272,8 +285,8 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
272
285
  insertEmoji: (0, _insertEmoji.insertEmoji)(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)
273
286
  },
274
287
  pluginsOptions: {
275
- quickInsert: function quickInsert(_ref10) {
276
- var formatMessage = _ref10.formatMessage;
288
+ quickInsert: function quickInsert(_ref11) {
289
+ var formatMessage = _ref11.formatMessage;
277
290
  return [{
278
291
  id: 'emoji',
279
292
  title: formatMessage(_messages.toolbarInsertBlockMessages.emoji),
@@ -441,12 +454,12 @@ function createEmojiPlugin(pmPluginFactoryParams, options, api) {
441
454
  return {};
442
455
  },
443
456
  apply: function apply(tr, pluginState) {
444
- var _ref11 = tr.getMeta(emojiPluginKey) || {
457
+ var _ref12 = tr.getMeta(emojiPluginKey) || {
445
458
  action: null,
446
459
  params: null
447
460
  },
448
- action = _ref11.action,
449
- params = _ref11.params;
461
+ action = _ref12.action,
462
+ params = _ref12.params;
450
463
  var newPluginState = pluginState;
451
464
  switch (action) {
452
465
  case _actions.ACTIONS.SET_PROVIDER:
@@ -68,7 +68,7 @@ export const emojiPlugin = ({
68
68
  config: options,
69
69
  api
70
70
  }) => {
71
- var _api$analytics5;
71
+ var _api$base, _api$analytics5;
72
72
  let previousEmojiProvider;
73
73
  const typeAhead = {
74
74
  id: TypeAheadAvailableNodes.EMOJI,
@@ -174,6 +174,26 @@ export const emojiPlugin = ({
174
174
  return tr;
175
175
  }
176
176
  };
177
+ api === null || api === void 0 ? void 0 : (_api$base = api.base) === null || _api$base === void 0 ? void 0 : _api$base.actions.registerMarks(({
178
+ tr,
179
+ node,
180
+ pos
181
+ }) => {
182
+ const {
183
+ doc
184
+ } = tr;
185
+ const {
186
+ schema
187
+ } = doc.type;
188
+ const {
189
+ emoji: emojiNodeType
190
+ } = schema.nodes;
191
+ if (node.type === emojiNodeType) {
192
+ const newText = node.attrs.text;
193
+ const currentPos = tr.mapping.map(pos);
194
+ tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
195
+ }
196
+ });
177
197
  return {
178
198
  name: 'emoji',
179
199
  nodes() {
@@ -73,7 +73,7 @@ var TRIGGER = ':';
73
73
  * from `@atlaskit/editor-core`.
74
74
  */
75
75
  export var emojiPlugin = function emojiPlugin(_ref2) {
76
- var _api$analytics5;
76
+ var _api$base, _api$analytics5;
77
77
  var options = _ref2.config,
78
78
  api = _ref2.api;
79
79
  var previousEmojiProvider;
@@ -181,6 +181,19 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
181
181
  return tr;
182
182
  }
183
183
  };
184
+ api === null || api === void 0 || (_api$base = api.base) === null || _api$base === void 0 || _api$base.actions.registerMarks(function (_ref7) {
185
+ var tr = _ref7.tr,
186
+ node = _ref7.node,
187
+ pos = _ref7.pos;
188
+ var doc = tr.doc;
189
+ var schema = doc.type.schema;
190
+ var emojiNodeType = schema.nodes.emoji;
191
+ if (node.type === emojiNodeType) {
192
+ var newText = node.attrs.text;
193
+ var currentPos = tr.mapping.map(pos);
194
+ tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
195
+ }
196
+ });
184
197
  return {
185
198
  name: 'emoji',
186
199
  nodes: function nodes() {
@@ -197,9 +210,9 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
197
210
  }
198
211
  }, {
199
212
  name: 'emojiAsciiInputRule',
200
- plugin: function plugin(_ref7) {
213
+ plugin: function plugin(_ref8) {
201
214
  var _api$analytics4;
202
- var schema = _ref7.schema;
215
+ var schema = _ref8.schema;
203
216
  return asciiInputRulePlugin(schema, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, api);
204
217
  }
205
218
  }];
@@ -209,10 +222,10 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
209
222
  if (!editorState) {
210
223
  return undefined;
211
224
  }
212
- var _ref8 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
213
- emojiResourceConfig = _ref8.emojiResourceConfig,
214
- asciiMap = _ref8.asciiMap,
215
- emojiProvider = _ref8.emojiProvider;
225
+ var _ref9 = (_emojiPluginKey$getSt = emojiPluginKey.getState(editorState)) !== null && _emojiPluginKey$getSt !== void 0 ? _emojiPluginKey$getSt : {},
226
+ emojiResourceConfig = _ref9.emojiResourceConfig,
227
+ asciiMap = _ref9.asciiMap,
228
+ emojiProvider = _ref9.emojiProvider;
216
229
  return {
217
230
  emojiResourceConfig: emojiResourceConfig,
218
231
  asciiMap: asciiMap,
@@ -240,8 +253,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
240
253
  return _context.abrupt("return", false);
241
254
  case 5:
242
255
  previousEmojiProvider = provider;
243
- return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref9) {
244
- var tr = _ref9.tr;
256
+ return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref10) {
257
+ var tr = _ref10.tr;
245
258
  return setProviderTr(provider)(tr);
246
259
  })) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
247
260
  case 7:
@@ -260,8 +273,8 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
260
273
  insertEmoji: insertEmoji(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)
261
274
  },
262
275
  pluginsOptions: {
263
- quickInsert: function quickInsert(_ref10) {
264
- var formatMessage = _ref10.formatMessage;
276
+ quickInsert: function quickInsert(_ref11) {
277
+ var formatMessage = _ref11.formatMessage;
265
278
  return [{
266
279
  id: 'emoji',
267
280
  title: formatMessage(messages.emoji),
@@ -429,12 +442,12 @@ export function createEmojiPlugin(pmPluginFactoryParams, options, api) {
429
442
  return {};
430
443
  },
431
444
  apply: function apply(tr, pluginState) {
432
- var _ref11 = tr.getMeta(emojiPluginKey) || {
445
+ var _ref12 = tr.getMeta(emojiPluginKey) || {
433
446
  action: null,
434
447
  params: null
435
448
  },
436
- action = _ref11.action,
437
- params = _ref11.params;
449
+ action = _ref12.action,
450
+ params = _ref12.params;
438
451
  var newPluginState = pluginState;
439
452
  switch (action) {
440
453
  case ACTIONS.SET_PROVIDER:
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
5
+ import type { BasePlugin } from '@atlaskit/editor-plugin-base';
5
6
  import { type EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
8
  import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
@@ -43,7 +44,8 @@ export type EmojiPlugin = NextEditorPlugin<'emoji', {
43
44
  OptionalPlugin<AnalyticsPlugin>,
44
45
  TypeAheadPlugin,
45
46
  OptionalPlugin<AnnotationPluginType>,
46
- OptionalPlugin<EditorViewModePluginType>
47
+ OptionalPlugin<EditorViewModePluginType>,
48
+ OptionalPlugin<BasePlugin>
47
49
  ];
48
50
  sharedState: EmojiPluginSharedState | undefined;
49
51
  commands: {
@@ -2,6 +2,7 @@ import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
3
3
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { InlineCommentInputMethod, InlineCommentMap } from '@atlaskit/editor-plugin-annotation';
5
+ import type { BasePlugin } from '@atlaskit/editor-plugin-base';
5
6
  import { type EditorViewModePluginState } from '@atlaskit/editor-plugin-editor-viewmode';
6
7
  import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
7
8
  import type { SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
@@ -43,7 +44,8 @@ export type EmojiPlugin = NextEditorPlugin<'emoji', {
43
44
  OptionalPlugin<AnalyticsPlugin>,
44
45
  TypeAheadPlugin,
45
46
  OptionalPlugin<AnnotationPluginType>,
46
- OptionalPlugin<EditorViewModePluginType>
47
+ OptionalPlugin<EditorViewModePluginType>,
48
+ OptionalPlugin<BasePlugin>
47
49
  ];
48
50
  sharedState: EmojiPluginSharedState | undefined;
49
51
  commands: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "2.7.21",
3
+ "version": "2.7.23",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,14 +21,15 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^46.1.0",
24
- "@atlaskit/editor-common": "^98.0.0",
24
+ "@atlaskit/editor-common": "^99.0.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
26
- "@atlaskit/editor-plugin-annotation": "1.26.9",
26
+ "@atlaskit/editor-plugin-annotation": "1.26.11",
27
+ "@atlaskit/editor-plugin-base": "^2.1.0",
27
28
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
28
29
  "@atlaskit/editor-plugin-type-ahead": "^1.11.0",
29
30
  "@atlaskit/editor-prosemirror": "6.2.1",
30
- "@atlaskit/emoji": "^67.11.0",
31
- "@atlaskit/icon": "^23.1.0",
31
+ "@atlaskit/emoji": "^67.12.0",
32
+ "@atlaskit/icon": "^23.3.0",
32
33
  "@atlaskit/node-data-provider": "^3.0.0",
33
34
  "@atlaskit/platform-feature-flags": "^0.3.0",
34
35
  "@atlaskit/prosemirror-input-rules": "^3.2.0",