@atlaskit/editor-plugin-emoji 2.7.13 → 2.7.15

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-emoji
2
2
 
3
+ ## 2.7.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [#178163](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/178163)
8
+ [`b838eba8d205f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b838eba8d205f) -
9
+ ED-26030-hide-comment-toolbar-when-user-switch-back-to-edit-mode
10
+
11
+ ## 2.7.14
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 2.7.13
4
18
 
5
19
  ### Patch Changes
@@ -295,9 +295,11 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
295
295
  },
296
296
  typeAhead: typeAhead,
297
297
  floatingToolbar: function floatingToolbar(state, intl) {
298
- var _api$editorViewMode;
299
- var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
300
- if (!isViewMode || !(0, _platformFeatureFlags.fg)('platform_inline_node_as_valid_annotation_selection')) {
298
+ var isViewMode = function isViewMode() {
299
+ var _api$editorViewMode;
300
+ return (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
301
+ };
302
+ if (!isViewMode() || !(0, _platformFeatureFlags.fg)('platform_inline_node_as_valid_annotation_selection')) {
301
303
  return undefined;
302
304
  }
303
305
  var onClick = function onClick(stateFromClickEvent, dispatch) {
@@ -332,7 +334,7 @@ var emojiPlugin = exports.emojiPlugin = function emojiPlugin(_ref2) {
332
334
  var activeCommentMark = node.marks.find(function (mark) {
333
335
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
334
336
  });
335
- var showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark;
337
+ var showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark && isViewMode();
336
338
  if (showAnnotation) {
337
339
  return [{
338
340
  type: 'button',
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  exports.inputRulePlugin = inputRulePlugin;
9
9
  exports.stateKey = void 0;
10
- var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
10
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
11
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
12
+ var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
13
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
14
14
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
15
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@@ -19,8 +19,9 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
19
19
  var _utils = require("@atlaskit/editor-common/utils");
20
20
  var _state = require("@atlaskit/editor-prosemirror/state");
21
21
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
22
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
22
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
23
23
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ function _superPropGet(t, o, e, r) { var p = (0, _get2.default)((0, _getPrototypeOf2.default)(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
24
25
  var matcher;
25
26
  function inputRulePlugin(schema, editorAnalyticsAPI, pluginInjectionApi) {
26
27
  if (schema.nodes.emoji) {
@@ -80,7 +81,7 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
80
81
  (0, _classCallCheck2.default)(this, AsciiEmojiMatcher);
81
82
  this.asciiToEmojiMap = asciiToEmojiMap;
82
83
  }
83
- (0, _createClass2.default)(AsciiEmojiMatcher, [{
84
+ return (0, _createClass2.default)(AsciiEmojiMatcher, [{
84
85
  key: "match",
85
86
  value: function match(matchParts) {
86
87
  return this.getAsciiEmojiMatch(getLeadingStringWithoutParentheses(matchParts), getAsciiWithParentheses(matchParts), getTrailingString(matchParts)) || this.getAsciiEmojiMatch(getLeadingString(matchParts), getAscii(matchParts), getTrailingString(matchParts));
@@ -96,7 +97,6 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
96
97
  } : undefined;
97
98
  }
98
99
  }]);
99
- return AsciiEmojiMatcher;
100
100
  }();
101
101
  /**
102
102
  * A matcher that will record ascii matches as usages of the matched emoji.
@@ -129,27 +129,25 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
129
129
  * See https://regex101.com/r/HRS9O2/4
130
130
  */
131
131
  (0, _defineProperty2.default)(AsciiEmojiMatcher, "REGEX", new RegExp("((?:^|[\\s".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
132
- var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher) {
133
- (0, _inherits2.default)(RecordingAsciiEmojiMatcher, _AsciiEmojiMatcher);
134
- var _super = _createSuper(RecordingAsciiEmojiMatcher);
132
+ var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher2) {
135
133
  function RecordingAsciiEmojiMatcher(emojiProvider, asciiToEmojiMap) {
136
134
  var _this;
137
135
  (0, _classCallCheck2.default)(this, RecordingAsciiEmojiMatcher);
138
- _this = _super.call(this, asciiToEmojiMap);
136
+ _this = _callSuper(this, RecordingAsciiEmojiMatcher, [asciiToEmojiMap]);
139
137
  _this.emojiProvider = emojiProvider;
140
138
  return _this;
141
139
  }
142
- (0, _createClass2.default)(RecordingAsciiEmojiMatcher, [{
140
+ (0, _inherits2.default)(RecordingAsciiEmojiMatcher, _AsciiEmojiMatcher2);
141
+ return (0, _createClass2.default)(RecordingAsciiEmojiMatcher, [{
143
142
  key: "match",
144
143
  value: function match(matchParts) {
145
- var match = (0, _get2.default)((0, _getPrototypeOf2.default)(RecordingAsciiEmojiMatcher.prototype), "match", this).call(this, matchParts);
144
+ var match = _superPropGet(RecordingAsciiEmojiMatcher, "match", this, 3)([matchParts]);
146
145
  if (match && this.emojiProvider.recordSelection) {
147
146
  this.emojiProvider.recordSelection(match.emoji);
148
147
  }
149
148
  return match;
150
149
  }
151
150
  }]);
152
- return RecordingAsciiEmojiMatcher;
153
151
  }(AsciiEmojiMatcher);
154
152
  var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
155
153
  function AsciiEmojiTransactionCreator(state, match, start, end, editorAnalyticsAPI) {
@@ -160,7 +158,7 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
160
158
  this.end = end;
161
159
  this.editorAnalyticsAPI = editorAnalyticsAPI;
162
160
  }
163
- (0, _createClass2.default)(AsciiEmojiTransactionCreator, [{
161
+ return (0, _createClass2.default)(AsciiEmojiTransactionCreator, [{
164
162
  key: "create",
165
163
  value: function create() {
166
164
  var _this$editorAnalytics;
@@ -222,7 +220,6 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
222
220
  return this.state.schema.text(this.match.trailingString);
223
221
  }
224
222
  }]);
225
- return AsciiEmojiTransactionCreator;
226
223
  }();
227
224
  var stateKey = exports.stateKey = new _state.PluginKey('asciiEmojiPlugin');
228
225
  var plugins = function plugins(schema, providerFactory, featureFlags, editorAnalyticsAPI, pluginInjectionApi) {
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { emojiPlugin } from './plugin';
@@ -254,9 +254,11 @@ export const emojiPlugin = ({
254
254
  }],
255
255
  typeAhead,
256
256
  floatingToolbar: (state, intl) => {
257
- var _api$editorViewMode, _api$editorViewMode$s;
258
- const isViewMode = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
259
- if (!isViewMode || !fg('platform_inline_node_as_valid_annotation_selection')) {
257
+ const isViewMode = () => {
258
+ var _api$editorViewMode, _api$editorViewMode$s;
259
+ return (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
260
+ };
261
+ if (!isViewMode() || !fg('platform_inline_node_as_valid_annotation_selection')) {
260
262
  return undefined;
261
263
  }
262
264
  const onClick = (stateFromClickEvent, dispatch) => {
@@ -289,7 +291,7 @@ export const emojiPlugin = ({
289
291
  var _api$annotation2;
290
292
  const annotationState = api === null || api === void 0 ? void 0 : (_api$annotation2 = api.annotation) === null || _api$annotation2 === void 0 ? void 0 : _api$annotation2.sharedState.currentState();
291
293
  const activeCommentMark = node.marks.find(mark => mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false);
292
- const showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark;
294
+ const showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark && isViewMode();
293
295
  if (showAnnotation) {
294
296
  return [{
295
297
  type: 'button',
package/dist/esm/index.js CHANGED
@@ -1 +1,4 @@
1
+ /* eslint-disable @atlaskit/editor/no-re-export */
2
+ // Entry file in package.json
3
+
1
4
  export { emojiPlugin } from './plugin';
@@ -283,9 +283,11 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
283
283
  },
284
284
  typeAhead: typeAhead,
285
285
  floatingToolbar: function floatingToolbar(state, intl) {
286
- var _api$editorViewMode;
287
- var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
288
- if (!isViewMode || !fg('platform_inline_node_as_valid_annotation_selection')) {
286
+ var isViewMode = function isViewMode() {
287
+ var _api$editorViewMode;
288
+ return (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
289
+ };
290
+ if (!isViewMode() || !fg('platform_inline_node_as_valid_annotation_selection')) {
289
291
  return undefined;
290
292
  }
291
293
  var onClick = function onClick(stateFromClickEvent, dispatch) {
@@ -320,7 +322,7 @@ export var emojiPlugin = function emojiPlugin(_ref2) {
320
322
  var activeCommentMark = node.marks.find(function (mark) {
321
323
  return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
322
324
  });
323
- var showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark;
325
+ var showAnnotation = annotationState && annotationState.isVisible && !annotationState.bookmark && !annotationState.mouseData.isSelecting && !activeCommentMark && isViewMode();
324
326
  if (showAnnotation) {
325
327
  return [{
326
328
  type: 'button',
@@ -1,12 +1,13 @@
1
- import _get from "@babel/runtime/helpers/get";
2
- import _inherits from "@babel/runtime/helpers/inherits";
3
1
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
4
2
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
3
+ import _get from "@babel/runtime/helpers/get";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
6
6
  import _createClass from "@babel/runtime/helpers/createClass";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
8
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
9
9
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
10
+ function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
10
11
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
12
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
12
13
  import { createRule } from '@atlaskit/editor-common/utils';
@@ -71,7 +72,7 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
71
72
  _classCallCheck(this, AsciiEmojiMatcher);
72
73
  this.asciiToEmojiMap = asciiToEmojiMap;
73
74
  }
74
- _createClass(AsciiEmojiMatcher, [{
75
+ return _createClass(AsciiEmojiMatcher, [{
75
76
  key: "match",
76
77
  value: function match(matchParts) {
77
78
  return this.getAsciiEmojiMatch(getLeadingStringWithoutParentheses(matchParts), getAsciiWithParentheses(matchParts), getTrailingString(matchParts)) || this.getAsciiEmojiMatch(getLeadingString(matchParts), getAscii(matchParts), getTrailingString(matchParts));
@@ -87,7 +88,6 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
87
88
  } : undefined;
88
89
  }
89
90
  }]);
90
- return AsciiEmojiMatcher;
91
91
  }();
92
92
  /**
93
93
  * A matcher that will record ascii matches as usages of the matched emoji.
@@ -120,27 +120,25 @@ var AsciiEmojiMatcher = /*#__PURE__*/function () {
120
120
  * See https://regex101.com/r/HRS9O2/4
121
121
  */
122
122
  _defineProperty(AsciiEmojiMatcher, "REGEX", new RegExp("((?:^|[\\s".concat(leafNodeReplacementCharacter, "])(?:\\(*?))(\\(?)([^:\\s").concat(leafNodeReplacementCharacter, "\\(]\\S{1,3}|:\\S{1,3}( ))$")));
123
- var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher) {
124
- _inherits(RecordingAsciiEmojiMatcher, _AsciiEmojiMatcher);
125
- var _super = _createSuper(RecordingAsciiEmojiMatcher);
123
+ var RecordingAsciiEmojiMatcher = /*#__PURE__*/function (_AsciiEmojiMatcher2) {
126
124
  function RecordingAsciiEmojiMatcher(emojiProvider, asciiToEmojiMap) {
127
125
  var _this;
128
126
  _classCallCheck(this, RecordingAsciiEmojiMatcher);
129
- _this = _super.call(this, asciiToEmojiMap);
127
+ _this = _callSuper(this, RecordingAsciiEmojiMatcher, [asciiToEmojiMap]);
130
128
  _this.emojiProvider = emojiProvider;
131
129
  return _this;
132
130
  }
133
- _createClass(RecordingAsciiEmojiMatcher, [{
131
+ _inherits(RecordingAsciiEmojiMatcher, _AsciiEmojiMatcher2);
132
+ return _createClass(RecordingAsciiEmojiMatcher, [{
134
133
  key: "match",
135
134
  value: function match(matchParts) {
136
- var match = _get(_getPrototypeOf(RecordingAsciiEmojiMatcher.prototype), "match", this).call(this, matchParts);
135
+ var match = _superPropGet(RecordingAsciiEmojiMatcher, "match", this, 3)([matchParts]);
137
136
  if (match && this.emojiProvider.recordSelection) {
138
137
  this.emojiProvider.recordSelection(match.emoji);
139
138
  }
140
139
  return match;
141
140
  }
142
141
  }]);
143
- return RecordingAsciiEmojiMatcher;
144
142
  }(AsciiEmojiMatcher);
145
143
  var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
146
144
  function AsciiEmojiTransactionCreator(state, match, start, end, editorAnalyticsAPI) {
@@ -151,7 +149,7 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
151
149
  this.end = end;
152
150
  this.editorAnalyticsAPI = editorAnalyticsAPI;
153
151
  }
154
- _createClass(AsciiEmojiTransactionCreator, [{
152
+ return _createClass(AsciiEmojiTransactionCreator, [{
155
153
  key: "create",
156
154
  value: function create() {
157
155
  var _this$editorAnalytics;
@@ -213,7 +211,6 @@ var AsciiEmojiTransactionCreator = /*#__PURE__*/function () {
213
211
  return this.state.schema.text(this.match.trailingString);
214
212
  }
215
213
  }]);
216
- return AsciiEmojiTransactionCreator;
217
214
  }();
218
215
  export var stateKey = new PluginKey('asciiEmojiPlugin');
219
216
  var plugins = function plugins(schema, providerFactory, featureFlags, editorAnalyticsAPI, pluginInjectionApi) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-emoji",
3
- "version": "2.7.13",
3
+ "version": "2.7.15",
4
4
  "description": "Emoji plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -21,9 +21,9 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@atlaskit/adf-schema": "^46.1.0",
24
- "@atlaskit/editor-common": "^96.3.0",
24
+ "@atlaskit/editor-common": "^96.4.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
26
- "@atlaskit/editor-plugin-annotation": "1.26.2",
26
+ "@atlaskit/editor-plugin-annotation": "1.26.3",
27
27
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
28
28
  "@atlaskit/editor-plugin-type-ahead": "^1.11.0",
29
29
  "@atlaskit/editor-prosemirror": "6.2.1",